Skip to content

Commit ac84561

Browse files
authored
Merge pull request #182 from VisActor/release/2.0.2
[Auto release] release 2.0.2
2 parents 53642b8 + 952514a commit ac84561

File tree

12 files changed

+41
-32
lines changed

12 files changed

+41
-32
lines changed

common/config/rush/pnpm-lock.yaml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/config/rush/version-policies.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"definitionName": "lockStepVersion",
44
"policyName": "vmindMin",
5-
"version": "1.2.14",
5+
"version": "2.0.2",
66
"mainProject": "@visactor/vmind",
77
"nextBump": "patch"
88
}

packages/calculator/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@visactor/calculator",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "SQL-like query executor with DSL",
55
"main": "lib",
66
"module": "es",

packages/chart-advisor/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@visactor/chart-advisor",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "图表推荐模块",
55
"main": "lib",
66
"module": "es",

packages/vmind/CHANGELOG.json

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{
22
"name": "@visactor/vmind",
33
"entries": [
4+
{
5+
"version": "2.0.2",
6+
"tag": "@visactor/vmind_v2.0.2",
7+
"date": "Sun, 23 Feb 2025 10:21:08 GMT",
8+
"comments": {
9+
"none": [
10+
{
11+
"comment": "fix fieldinfo may undefiend while chart-advistor"
12+
}
13+
]
14+
}
15+
},
416
{
517
"version": "2.0.1",
618
"tag": "@visactor/vmind_v2.0.1",
@@ -152,4 +164,4 @@
152164
"comments": {}
153165
}
154166
]
155-
}
167+
}

packages/vmind/CHANGELOG.md

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Change Log - @visactor/vmind
22

3-
This log was last generated on Fri, 21 Feb 2025 07:38:30 GMT and should not be manually modified.
3+
This log was last generated on Sun, 23 Feb 2025 10:21:08 GMT and should not be manually modified.
4+
5+
## 2.0.2
6+
Sun, 23 Feb 2025 10:21:08 GMT
7+
8+
### Updates
9+
10+
- fix fieldinfo may undefiend while chart-advistor
411

512
## 2.0.1
613
Fri, 21 Feb 2025 07:38:30 GMT
@@ -10,17 +17,6 @@ Fri, 21 Feb 2025 07:38:30 GMT
1017
- Overall architecture upgrade
1118
- Support DeepSeek and other custom model with api-key
1219
- 12 new chart types added for chart generation
13-
- [Range Bar Chart](https://www.visactor.io/vchart/demo/range-column-chart/range-bar)
14-
- [Liquid Chart](https://www.visactor.io/vchart/demo/liquid-chart/liquid-chart)
15-
- [Linear Progress Bar](https://www.visactor.io/vchart/demo/progress/linear-progress)
16-
- [Circular Progress Bar](https://www.visactor.io/vchart/demo/progress/circular-progress)
17-
- [Circle Packing Chart](https://www.visactor.io/vchart/demo/circle-packing-chart/basic-circle-packing)
18-
- [Sunburst Chart](https://www.visactor.io/vchart/demo/sunburst-chart/basic-sunburst)
19-
- [Gauge Chart](https://www.visactor.io/vchart/demo/gauge-chart/basic-gauge)
20-
- [Treemap Chart](https://www.visactor.io/vchart/demo/treemap-chart/basic-treemap)
21-
- [Heatmap Chart](https://www.visactor.io/vchart/demo/heatmap-chart/basic-heatmap)
22-
- [Venn Chart](https://www.visactor.io/vchart/demo/venn-chart/venn-chart)
23-
- [Map](https://www.visactor.io/vchart/demo/map-chart/basic-map)
2420
- Add Text2Chart capability
2521
- Add Chart Insight capability
2622

packages/vmind/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@visactor/vmind",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"main": "cjs/index.js",
55
"module": "esm/index.js",
66
"types": "esm/index.d.ts",
@@ -93,14 +93,14 @@
9393
},
9494
"dependencies": {
9595
"chroma-js": "^3.1.1",
96-
"@visactor/chart-advisor": "workspace:2.0.1",
96+
"@visactor/chart-advisor": "workspace:2.0.2",
9797
"@visactor/vdataset": "~0.17.4",
9898
"@visactor/vutils": "~0.17.4",
9999
"axios": "^1.4.0",
100100
"json5": "~2.2.3",
101101
"dayjs": "~1.11.10",
102102
"js-yaml": "~4.1.0",
103-
"@visactor/calculator": "workspace:2.0.1",
103+
"@visactor/calculator": "workspace:2.0.2",
104104
"alasql": "~4.3.2",
105105
"@visactor/vchart-theme": "^1.11.2",
106106
"jstat": "~1.9.6",

packages/vmind/src/atom/chartGenerator/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,13 @@ export class ChartGeneratorAtom extends BaseAtom<ChartGeneratorCtx, ChartGenerat
146146
};
147147
if (!this.useRule && (this.useChartAdvisor || this.options.useChartAdvisor)) {
148148
// @todo
149-
const { cell, dataset, chartType, advisedList } = getCellContextByAdvisor({
149+
const { cell, dataset, chartType, advisedList, usage } = getCellContextByAdvisor({
150150
...this.context,
151151
...additionalCtx
152152
});
153153
this.context = {
154154
...this.context,
155+
usage,
155156
cell,
156157
dataTable: dataset,
157158
chartType,

packages/vmind/src/atom/chartGenerator/spec/transformers.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type { GenerateChartCellContext } from '../type';
2121
import { getFieldByDataType, getFieldIdInCell } from '../../../utils/field';
2222
import { isValidDataTable } from '../../../utils/dataTable';
2323
import { DataType, ChartType, ROLE } from '../../../types';
24-
import type { DataCell, DataTable, FieldInfo } from '../../../types';
24+
import type { DataCell, DataTable } from '../../../types';
2525
import { builtinThemeMap } from '../const';
2626

2727
const chartTypeMap: { [chartName: string]: string } = {
@@ -919,7 +919,7 @@ export const axis = (context: GenerateChartCellContext) => {
919919
const { y: celly } = cell;
920920
const yFields = isArray(celly) ? celly : [celly];
921921
const yFieldsInfo = yFields.map(field => fieldInfo.find(v => v.fieldName === field));
922-
const isAllRatio = yFieldsInfo.every(v => !!v.ratioGranularity);
922+
const isAllRatio = yFieldsInfo.every(v => !!v?.ratioGranularity);
923923
const isSameUnit = uniqArray(yFieldsInfo.map(v => v?.unit).filter(v => !!v)).length === 1;
924924

925925
spec.axes = [
@@ -975,7 +975,7 @@ export const commonLabel = (context: GenerateChartCellContext) => {
975975
} else if (celly) {
976976
const field = isArray(celly) ? celly[0] : celly;
977977
const info = fieldInfo.find(v => v.fieldName === field);
978-
if (info.ratioGranularity) {
978+
if (info?.ratioGranularity) {
979979
spec.label.formatter = `{${field}:~%}`;
980980
}
981981
}
@@ -1066,7 +1066,7 @@ export const scatterAxis = (context: GenerateChartCellContext) => {
10661066
spec.axes = [
10671067
{
10681068
orient: 'bottom',
1069-
type: [DataType.DATE, DataType.STRING].includes(xFieldInfo.type) ? 'band' : 'linear',
1069+
type: [DataType.DATE, DataType.STRING].includes(xFieldInfo?.type) ? 'band' : 'linear',
10701070
label: {
10711071
style: {
10721072
//fill: '#FFFFFF'
@@ -1081,7 +1081,7 @@ export const scatterAxis = (context: GenerateChartCellContext) => {
10811081
},
10821082
{
10831083
orient: 'left',
1084-
type: [DataType.DATE, DataType.STRING].includes(yFieldInfo.type) ? 'band' : 'linear',
1084+
type: [DataType.DATE, DataType.STRING].includes(yFieldInfo?.type) ? 'band' : 'linear',
10851085
label: {
10861086
style: {
10871087
//fill: '#FFFFFF'

packages/vmind/src/atom/dataClean/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ export const getCtxBymeasureAutoTransfer = (context: DataCleanCtx, text?: string
150150
}
151151
}
152152
// transfer ratio value to absolue value without unit
153-
if (info.ratioGranularity === '%') {
153+
if (info?.ratioGranularity === '%') {
154154
dataTable[i][info.fieldName] = value / 100;
155-
} else if (info.ratioGranularity === '‰') {
155+
} else if (info?.ratioGranularity === '‰') {
156156
dataTable[i][info.fieldName] = value / 1000;
157157
}
158158
}

packages/vmind/src/schedule/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class Schedule<T extends AtomName[]> {
131131
for (const key in oldUsage) {
132132
if (Object.prototype.hasOwnProperty.call(oldUsage, key)) {
133133
const curKey = key as keyof Usage;
134-
result[curKey] = (oldUsage[curKey] || 0) + (newUsage[curKey] || 0);
134+
result[curKey] = (oldUsage[curKey] || 0) + (newUsage?.[curKey] || 0);
135135
}
136136
}
137137

packages/vmind/src/utils/field.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const formatFieldInfo = (fieldInfo: FieldInfo[]) => {
1616
fieldInfo.forEach(info => {
1717
info.role = getRoleByFieldType(info.type);
1818
info.location = getRoleByFieldType(info.type) as any;
19-
info.ratioGranularity = info?.type === DataType.RATIO ? info.ratioGranularity || '%' : null;
19+
info.ratioGranularity = info?.type === DataType.RATIO ? info?.ratioGranularity || '%' : null;
2020
});
2121
return fieldInfo;
2222
};
@@ -36,7 +36,7 @@ export const getFieldByRole = (fields: FieldInfo[], role: ROLE) => {
3636
};
3737

3838
export const getFieldByDataType = (fields: FieldInfo[], dataTypeList: DataType[]) => {
39-
return fields.find(f => dataTypeList.includes(f.type));
39+
return (fields || []).find(f => dataTypeList.includes(f.type));
4040
};
4141
export const getFieldsByDataType = (fields: FieldInfo[], dataTypeList: DataType[]) => {
4242
return fields.filter(f => dataTypeList.includes(f.type));

0 commit comments

Comments
 (0)