diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index a534b8ec..47c7ba7e 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -148,8 +148,8 @@ importers: '@types/react-dom': ^18.0.0 '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/calculator': workspace:2.0.1 - '@visactor/chart-advisor': workspace:2.0.1 + '@visactor/calculator': workspace:2.0.2 + '@visactor/chart-advisor': workspace:2.0.2 '@visactor/vchart': ^1.12.4 '@visactor/vchart-theme': ^1.11.2 '@visactor/vdataset': ~0.17.4 diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index e3b3144c..28bc1906 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -2,7 +2,7 @@ { "definitionName": "lockStepVersion", "policyName": "vmindMin", - "version": "1.2.14", + "version": "2.0.2", "mainProject": "@visactor/vmind", "nextBump": "patch" } diff --git a/packages/calculator/package.json b/packages/calculator/package.json index c894cdfb..2a8633a5 100644 --- a/packages/calculator/package.json +++ b/packages/calculator/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/calculator", - "version": "2.0.1", + "version": "2.0.2", "description": "SQL-like query executor with DSL", "main": "lib", "module": "es", diff --git a/packages/chart-advisor/package.json b/packages/chart-advisor/package.json index 802f4b24..41c8dcc8 100644 --- a/packages/chart-advisor/package.json +++ b/packages/chart-advisor/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/chart-advisor", - "version": "2.0.1", + "version": "2.0.2", "description": "图表推荐模块", "main": "lib", "module": "es", diff --git a/packages/vmind/CHANGELOG.json b/packages/vmind/CHANGELOG.json index e5ad7dec..5849cdd7 100644 --- a/packages/vmind/CHANGELOG.json +++ b/packages/vmind/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@visactor/vmind", "entries": [ + { + "version": "2.0.2", + "tag": "@visactor/vmind_v2.0.2", + "date": "Sun, 23 Feb 2025 10:21:08 GMT", + "comments": { + "none": [ + { + "comment": "fix fieldinfo may undefiend while chart-advistor" + } + ] + } + }, { "version": "2.0.1", "tag": "@visactor/vmind_v2.0.1", @@ -152,4 +164,4 @@ "comments": {} } ] -} \ No newline at end of file +} diff --git a/packages/vmind/CHANGELOG.md b/packages/vmind/CHANGELOG.md index 3f8947fa..7f72a6ee 100644 --- a/packages/vmind/CHANGELOG.md +++ b/packages/vmind/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log - @visactor/vmind -This log was last generated on Fri, 21 Feb 2025 07:38:30 GMT and should not be manually modified. +This log was last generated on Sun, 23 Feb 2025 10:21:08 GMT and should not be manually modified. + +## 2.0.2 +Sun, 23 Feb 2025 10:21:08 GMT + +### Updates + +- fix fieldinfo may undefiend while chart-advistor ## 2.0.1 Fri, 21 Feb 2025 07:38:30 GMT @@ -10,17 +17,6 @@ Fri, 21 Feb 2025 07:38:30 GMT - Overall architecture upgrade - Support DeepSeek and other custom model with api-key - 12 new chart types added for chart generation - - [Range Bar Chart](https://www.visactor.io/vchart/demo/range-column-chart/range-bar) - - [Liquid Chart](https://www.visactor.io/vchart/demo/liquid-chart/liquid-chart) - - [Linear Progress Bar](https://www.visactor.io/vchart/demo/progress/linear-progress) - - [Circular Progress Bar](https://www.visactor.io/vchart/demo/progress/circular-progress) - - [Circle Packing Chart](https://www.visactor.io/vchart/demo/circle-packing-chart/basic-circle-packing) - - [Sunburst Chart](https://www.visactor.io/vchart/demo/sunburst-chart/basic-sunburst) - - [Gauge Chart](https://www.visactor.io/vchart/demo/gauge-chart/basic-gauge) - - [Treemap Chart](https://www.visactor.io/vchart/demo/treemap-chart/basic-treemap) - - [Heatmap Chart](https://www.visactor.io/vchart/demo/heatmap-chart/basic-heatmap) - - [Venn Chart](https://www.visactor.io/vchart/demo/venn-chart/venn-chart) - - [Map](https://www.visactor.io/vchart/demo/map-chart/basic-map) - Add Text2Chart capability - Add Chart Insight capability diff --git a/packages/vmind/package.json b/packages/vmind/package.json index ba8ae8c5..1d5474ad 100644 --- a/packages/vmind/package.json +++ b/packages/vmind/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vmind", - "version": "2.0.1", + "version": "2.0.2", "main": "cjs/index.js", "module": "esm/index.js", "types": "esm/index.d.ts", @@ -93,14 +93,14 @@ }, "dependencies": { "chroma-js": "^3.1.1", - "@visactor/chart-advisor": "workspace:2.0.1", + "@visactor/chart-advisor": "workspace:2.0.2", "@visactor/vdataset": "~0.17.4", "@visactor/vutils": "~0.17.4", "axios": "^1.4.0", "json5": "~2.2.3", "dayjs": "~1.11.10", "js-yaml": "~4.1.0", - "@visactor/calculator": "workspace:2.0.1", + "@visactor/calculator": "workspace:2.0.2", "alasql": "~4.3.2", "@visactor/vchart-theme": "^1.11.2", "jstat": "~1.9.6", diff --git a/packages/vmind/src/atom/chartGenerator/index.ts b/packages/vmind/src/atom/chartGenerator/index.ts index 6db394f7..48f06f39 100644 --- a/packages/vmind/src/atom/chartGenerator/index.ts +++ b/packages/vmind/src/atom/chartGenerator/index.ts @@ -146,12 +146,13 @@ export class ChartGeneratorAtom extends BaseAtom { const { y: celly } = cell; const yFields = isArray(celly) ? celly : [celly]; const yFieldsInfo = yFields.map(field => fieldInfo.find(v => v.fieldName === field)); - const isAllRatio = yFieldsInfo.every(v => !!v.ratioGranularity); + const isAllRatio = yFieldsInfo.every(v => !!v?.ratioGranularity); const isSameUnit = uniqArray(yFieldsInfo.map(v => v?.unit).filter(v => !!v)).length === 1; spec.axes = [ @@ -975,7 +975,7 @@ export const commonLabel = (context: GenerateChartCellContext) => { } else if (celly) { const field = isArray(celly) ? celly[0] : celly; const info = fieldInfo.find(v => v.fieldName === field); - if (info.ratioGranularity) { + if (info?.ratioGranularity) { spec.label.formatter = `{${field}:~%}`; } } @@ -1066,7 +1066,7 @@ export const scatterAxis = (context: GenerateChartCellContext) => { spec.axes = [ { orient: 'bottom', - type: [DataType.DATE, DataType.STRING].includes(xFieldInfo.type) ? 'band' : 'linear', + type: [DataType.DATE, DataType.STRING].includes(xFieldInfo?.type) ? 'band' : 'linear', label: { style: { //fill: '#FFFFFF' @@ -1081,7 +1081,7 @@ export const scatterAxis = (context: GenerateChartCellContext) => { }, { orient: 'left', - type: [DataType.DATE, DataType.STRING].includes(yFieldInfo.type) ? 'band' : 'linear', + type: [DataType.DATE, DataType.STRING].includes(yFieldInfo?.type) ? 'band' : 'linear', label: { style: { //fill: '#FFFFFF' diff --git a/packages/vmind/src/atom/dataClean/utils.ts b/packages/vmind/src/atom/dataClean/utils.ts index da8e4282..d2d1522c 100644 --- a/packages/vmind/src/atom/dataClean/utils.ts +++ b/packages/vmind/src/atom/dataClean/utils.ts @@ -150,9 +150,9 @@ export const getCtxBymeasureAutoTransfer = (context: DataCleanCtx, text?: string } } // transfer ratio value to absolue value without unit - if (info.ratioGranularity === '%') { + if (info?.ratioGranularity === '%') { dataTable[i][info.fieldName] = value / 100; - } else if (info.ratioGranularity === '‰') { + } else if (info?.ratioGranularity === '‰') { dataTable[i][info.fieldName] = value / 1000; } } diff --git a/packages/vmind/src/schedule/index.ts b/packages/vmind/src/schedule/index.ts index 0f341f55..4a3025e6 100644 --- a/packages/vmind/src/schedule/index.ts +++ b/packages/vmind/src/schedule/index.ts @@ -131,7 +131,7 @@ export class Schedule { for (const key in oldUsage) { if (Object.prototype.hasOwnProperty.call(oldUsage, key)) { const curKey = key as keyof Usage; - result[curKey] = (oldUsage[curKey] || 0) + (newUsage[curKey] || 0); + result[curKey] = (oldUsage[curKey] || 0) + (newUsage?.[curKey] || 0); } } diff --git a/packages/vmind/src/utils/field.ts b/packages/vmind/src/utils/field.ts index 756c384a..0fa7632b 100644 --- a/packages/vmind/src/utils/field.ts +++ b/packages/vmind/src/utils/field.ts @@ -16,7 +16,7 @@ export const formatFieldInfo = (fieldInfo: FieldInfo[]) => { fieldInfo.forEach(info => { info.role = getRoleByFieldType(info.type); info.location = getRoleByFieldType(info.type) as any; - info.ratioGranularity = info?.type === DataType.RATIO ? info.ratioGranularity || '%' : null; + info.ratioGranularity = info?.type === DataType.RATIO ? info?.ratioGranularity || '%' : null; }); return fieldInfo; }; @@ -36,7 +36,7 @@ export const getFieldByRole = (fields: FieldInfo[], role: ROLE) => { }; export const getFieldByDataType = (fields: FieldInfo[], dataTypeList: DataType[]) => { - return fields.find(f => dataTypeList.includes(f.type)); + return (fields || []).find(f => dataTypeList.includes(f.type)); }; export const getFieldsByDataType = (fields: FieldInfo[], dataTypeList: DataType[]) => { return fields.filter(f => dataTypeList.includes(f.type));