Skip to content

Commit

Permalink
Merge pull request #182 from VisActor/release/2.0.2
Browse files Browse the repository at this point in the history
[Auto release] release 2.0.2
  • Loading branch information
666haiwen authored Feb 23, 2025
2 parents 53642b8 + 952514a commit ac84561
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 32 deletions.
4 changes: 2 additions & 2 deletions common/config/rush/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"definitionName": "lockStepVersion",
"policyName": "vmindMin",
"version": "1.2.14",
"version": "2.0.2",
"mainProject": "@visactor/vmind",
"nextBump": "patch"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/calculator/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/chart-advisor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/chart-advisor",
"version": "2.0.1",
"version": "2.0.2",
"description": "图表推荐模块",
"main": "lib",
"module": "es",
Expand Down
14 changes: 13 additions & 1 deletion packages/vmind/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -152,4 +164,4 @@
"comments": {}
}
]
}
}
20 changes: 8 additions & 12 deletions packages/vmind/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions packages/vmind/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion packages/vmind/src/atom/chartGenerator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,13 @@ export class ChartGeneratorAtom extends BaseAtom<ChartGeneratorCtx, ChartGenerat
};
if (!this.useRule && (this.useChartAdvisor || this.options.useChartAdvisor)) {
// @todo
const { cell, dataset, chartType, advisedList } = getCellContextByAdvisor({
const { cell, dataset, chartType, advisedList, usage } = getCellContextByAdvisor({
...this.context,
...additionalCtx
});
this.context = {
...this.context,
usage,
cell,
dataTable: dataset,
chartType,
Expand Down
10 changes: 5 additions & 5 deletions packages/vmind/src/atom/chartGenerator/spec/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type { GenerateChartCellContext } from '../type';
import { getFieldByDataType, getFieldIdInCell } from '../../../utils/field';
import { isValidDataTable } from '../../../utils/dataTable';
import { DataType, ChartType, ROLE } from '../../../types';
import type { DataCell, DataTable, FieldInfo } from '../../../types';
import type { DataCell, DataTable } from '../../../types';
import { builtinThemeMap } from '../const';

const chartTypeMap: { [chartName: string]: string } = {
Expand Down Expand Up @@ -919,7 +919,7 @@ export const axis = (context: GenerateChartCellContext) => {
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 = [
Expand Down Expand Up @@ -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}:~%}`;
}
}
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions packages/vmind/src/atom/dataClean/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vmind/src/schedule/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class Schedule<T extends AtomName[]> {
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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/vmind/src/utils/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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));
Expand Down

0 comments on commit ac84561

Please sign in to comment.