Skip to content

Commit

Permalink
Merge pull request #38 from VisActor/27-bug-sparkline-render
Browse files Browse the repository at this point in the history
27 bug sparkline render
  • Loading branch information
fangsmile committed Jun 16, 2023
2 parents 57b117a + 9c0b03d commit ec77e89
Show file tree
Hide file tree
Showing 20 changed files with 91 additions and 101 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@
"editor.tabSize": 2,
"editor.detectIndentation": false,
// Typescript
"typescript.preferences.importModuleSpecifier": "project-relative"
"typescript.preferences.importModuleSpecifier": "project-relative",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}
2 changes: 1 addition & 1 deletion common/config/rush/pnpm-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
* PNPM documentation: https://pnpm.io/package_json#pnpmoverrides
*/
"globalOverrides": {
"@visactor/vrender": "0.9.2-fill-stroke.10"
"@visactor/vrender": "0.10.0-alpha.1"
},
/**
* The `globalPeerDependencyRules` setting provides various settings for suppressing validation errors
Expand Down
51 changes: 26 additions & 25 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/vtable/examples/pivot/pivot-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ export function createTable() {
}
},
point: {
visible: true,
hover: {
stroke: 'blue',
strokeWidth: 1,
Expand Down
43 changes: 16 additions & 27 deletions packages/vtable/examples/type/spark-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,32 +99,26 @@ export function createTable() {
type: 'line',
xField: {
field: 'x',
domain: [0, 1, 2, 3, 4, 5, 6, 7, 8],
type: 'point'
domain: [0, 1, 2, 3, 4, 5, 6, 7, 8]
},
yField: {
field: 'y',
domain: [0, 80],
type: 'linear'
domain: [0, 80]
},
pointShowRule: 'all',
line: {
visible: true,
style: {
stroke: '#2E62F1',
strokeWidth: 2
}
},
point: {
visible: true,
state: {
hover: {
stroke: 'blue',
strokeWidth: 1,
fill: 'red',
shape: 'circle',
size: 4
}
hover: {
stroke: 'blue',
strokeWidth: 1,
fill: 'red',
shape: 'circle',
size: 4
},
style: {
stroke: 'red',
Expand All @@ -147,22 +141,18 @@ export function createTable() {
yField: 'y',
pointShowRule: 'all',
line: {
visible: true,
style: {
stroke: 'green',
strokeWidth: 4
}
},
point: {
visible: true,
state: {
hover: {
stroke: 'blue',
strokeWidth: 1,
fill: 'red',
shape: 'circle',
size: 4
}
hover: {
stroke: 'blue',
strokeWidth: 1,
fill: 'red',
shape: 'circle',
size: 4
},
style: {
stroke: 'red',
Expand Down Expand Up @@ -192,7 +182,6 @@ export function createTable() {
}
},
point: {
visible: true,
hover: {
stroke: 'blue',
strokeWidth: 1,
Expand Down Expand Up @@ -243,6 +232,7 @@ export function createTable() {
width: 250,
columnType: 'sparkline',
sparklineSpec: Object.assign({}, baseSpec, {
smooth: true,
point: {
visible: false,
state: {
Expand Down Expand Up @@ -282,8 +272,7 @@ export function createTable() {
yField: 'y',
crosshair: {
style: {
stroke: 'red',
interpolate: 'monotone'
stroke: 'red'
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vtable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
"ci": "node github-ci.js"
},
"dependencies": {
"@visactor/vrender": "0.9.2-fill-stroke.10",
"@visactor/vrender": "0.10.0-alpha.1",
"@visactor/vutils": "0.9.0-alpha.2",
"@visactor/vrender-components": "0.9.2-fill-stroke.10",
"@visactor/vrender-components": "0.10.0-alpha.1",
"cssfontparser": "^1.2.1",
"@visactor/vscale": "0.9.0-alpha.2"
},
Expand Down
6 changes: 1 addition & 5 deletions packages/vtable/site-demo/business/trend.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,23 +284,19 @@ const option = {
pointShowRule: 'none',
smooth: true,
line: {
visible: true,
style: {
stroke: '#2E62F1',
strokeWidth: 2,
// interpolate: 'monotone',
},
},
symbol: {
visible: true,
state: {
point: {
hover: {
stroke: 'blue',
strokeWidth: 1,
fill: 'red',
shape: 'circle',
size: 4,
},
},
style: {
stroke: 'red',
Expand Down
3 changes: 1 addition & 2 deletions packages/vtable/site-demo/cell-type/multi-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ const columns = [
strokeWidth: 2,
},
},
symbol: {
visible: true,
point: {
hover: {
stroke: 'blue',
strokeWidth: 1,
Expand Down
4 changes: 1 addition & 3 deletions packages/vtable/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import type {
ListTableConstructorOptions,
PivotTableConstructorOptions,
IHeaderTreeDefine,
IDimension,
IIndicatorCustom
IDimension
} from './ts-types';
import { ListTable } from './ListTable';
import { PivotTable } from './PivotTable';
Expand All @@ -45,7 +44,6 @@ export {
PivotTableConstructorOptions,
IHeaderTreeDefine,
IDimension,
IIndicatorCustom,
ColumnsDefine,
ColumnDefine,
LinkColumnDefine,
Expand Down
9 changes: 5 additions & 4 deletions packages/vtable/src/scenegraph/component/table-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ export class TableComponent {
const y = Math.min(tableHeight, totalHeight);
const rangeEnd = Math.max(0.05, (tableWidth - frozenColsWidth) / (totalWidth - frozenColsWidth));
this.hScrollBar.setAttributes({
x: frozenColsWidth,
y: y - (this.table.theme.scrollStyle.hoverOn ? width : 0),
x: frozenColsWidth + (!this.table.theme.scrollStyle.hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0),
y: y - (this.table.theme.scrollStyle.hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y),
width: tableWidth - frozenColsWidth,
range: [0, rangeEnd],
visible: visible === 'always'
Expand All @@ -260,8 +260,9 @@ export class TableComponent {
const x = Math.min(tableWidth, totalWidth);
const rangeEnd = Math.max(0.05, (tableHeight - frozenRowsHeight) / (totalHeight - frozenRowsHeight));
this.vScrollBar.setAttributes({
x: x - (this.table.theme.scrollStyle.hoverOn ? width : 0),
y: frozenRowsHeight,
x: x - (this.table.theme.scrollStyle.hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.x),
y:
frozenRowsHeight + (!this.table.theme.scrollStyle.hoverOn ? this.table.scenegraph.tableGroup.attribute.y : 0),
height: tableHeight - frozenRowsHeight,
range: [0, rangeEnd],
visible: visible === 'always'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ function createSparkLine(
// 更新symbol节点属性
const symbolGroup = chartGroup.getChildByName('sparkline-symbol-group') as ILine;
if (symbolGroup) {
const isShowIsolatedPoint = sparklineSpec.point?.visible && sparklineSpec.pointShowRule === 'isolatedPoint';
if (sparklineSpec.point?.visible && sparklineSpec.pointShowRule === 'all') {
const isShowIsolatedPoint = sparklineSpec.pointShowRule === 'isolatedPoint';
if (sparklineSpec.pointShowRule === 'all') {
for (let i = 0; i < items.length; i++) {
const { x, y, defined } = items[i];
if (defined) {
Expand Down Expand Up @@ -257,7 +257,7 @@ function createChartGroup(
const line = createLine({
x: 0,
y: 0,
curveType: specObj.smooth ?? specObj.line?.style?.interpolate === 'linear' ? 'linear' : 'monotoneX',
curveType: specObj.smooth ? 'monotoneX' : 'linear',
stroke: specObj.line?.style?.stroke ?? 'blue',
lineWidth: specObj.line?.style?.strokeWidth ?? 2
});
Expand Down
12 changes: 6 additions & 6 deletions packages/vtable/src/ts-types/pivot-table/corner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import type { IImageStyleOption, ITextStyleOption, IStyleOption } from '../colum
import type { ShowColumnRowType } from '../table-engine';

interface IBasicCornerDefine {
titleOnDimension: ShowColumnRowType; //角头标题是否显示列维度名称 否则显示行维度名称
titleOnDimension?: ShowColumnRowType; //角头标题是否显示列维度名称 否则显示行维度名称
// headerStyle?: HeaderStyleOption | null; //角头标题的样式
// headerType?: HeaderTypeOption | null; //角头标题的类型
}

interface ITextCornerDefine extends IBasicCornerDefine {
headerType: 'text';
headerStyle: ITextStyleOption;
headerType?: 'text';
headerStyle?: ITextStyleOption;
}

interface IImageCornerDefine extends IBasicCornerDefine {
headerType: 'image';
headerStyle: IImageStyleOption;
headerStyle?: IImageStyleOption;
}

interface ILinkCornerDefine extends IBasicCornerDefine {
headerType: 'link';
headerStyle: ITextStyleOption;
headerStyle?: ITextStyleOption;
}

export type ICornerDefine = Partial<ITextCornerDefine | IImageCornerDefine | ILinkCornerDefine>;
export type ICornerDefine = IImageCornerDefine | ILinkCornerDefine | ITextCornerDefine;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import type { IImageDimension } from './image-dimension';
import type { ILinkDimension } from './link-dimension';
import type { ITextDimension } from './multilinetext-dimension';

export type IDimension = Partial<ITextDimension | ILinkDimension | IImageDimension>;
export type IDimension = ILinkDimension | IImageDimension | ITextDimension;
Loading

0 comments on commit ec77e89

Please sign in to comment.