Skip to content

Commit 7f0cc4c

Browse files
authored
Merge pull request #52 from VisActor/release/1.2.6
[Auto release] release 1.2.7
2 parents b354209 + 7accfa6 commit 7f0cc4c

19 files changed

+302
-22
lines changed

README.md

+42-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,49 @@
1-
# @visactor/vmind
1+
2+
<div align="center">
3+
<a href="https://github.com/VisActor#gh-light-mode-only" target="_blank">
4+
<img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_light.svg"/>
5+
</a>
6+
<a href="https://github.com/VisActor#gh-dark-mode-only" target="_blank">
7+
<img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_dark.svg"/>
8+
</a>
9+
</div>
10+
11+
<div align="center">
12+
<h1>VMind</h1>
13+
</div>
14+
15+
<div align="center">
16+
17+
Not just automatic, but also fantastic.Open-source solution for intelligent visualization.
18+
19+
<p align="center">
20+
<a href="https://www.visactor.io/vmind">Introduction</a> •
21+
<a href="https://www.visactor.io/vmind/example">Demo</a> •
22+
<a href="https://www.visactor.io/vmind/guide/Intro_to_VMind">Tutorial</a> •
23+
<a href="https://www.visactor.io/vmind/api/VMind_Instance">API</a>•
24+
<a href="https://www.visactor.io/vmind/openapi">OpenApi</a>
25+
</p>
26+
27+
![](https://github.com/visactor/vmind/actions/workflows/bug-server.yml/badge.svg)
28+
![](https://github.com/visactor/vmind/actions/workflows/unit-test.yml/badge.svg)
29+
[![npm Version](https://img.shields.io/npm/v/@visactor/vmind.svg)](https://www.npmjs.com/package/@visactor/vmind)
30+
[![npm Download](https://img.shields.io/npm/dm/@visactor/vmind.svg)](https://www.npmjs.com/package/@visactor/vmind)
31+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/VisActor/VMind/blob/main/CONTRIBUTING.md#your-first-pull-request)
32+
33+
![](https://img.shields.io/badge/language-TypeScript-red.svg) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/visactor/vmind/blob/main/LICENSE)
34+
35+
</div>
36+
37+
238

339
<div align="center">
440

541
English | [简体中文](readme-zh.md)
642

743
</div>
844

45+
## 简介
46+
947
`@visactor/vmind` is an intelligent chart component based on LLM provided by [VisActor](https://www.visactor.io/), including dialog-based chart generation and editing capabilities. It provides a natural language interaction interface, allowing you to easily create chart narrative works with `@visactor/VMind` with just one sentence, and edit them through continuous dialogue, greatly improving your efficiency in creating data visualization works.
1048

1149
The main features of `@visactor/vmind` include:
@@ -17,9 +55,9 @@ The main features of `@visactor/vmind` include:
1755

1856
## Development Guide
1957

20-
### Demo Page
58+
### Docs Page
2159

22-
Enter the VChart repository and execute:
60+
Enter the VMind repository and execute:
2361

2462
```bash
2563
# Install dependencies
@@ -28,11 +66,10 @@ $ rush update
2866
$ rush docs
2967
```
3068

31-
Select VMind from the top navigation bar, enter your OpenAI Key, click generate chart, and you can experience VMind.
3269

3370
### Start the Development Page
3471

35-
Enter the VChart repository and execute:
72+
Enter the VMind repository and execute:
3673

3774
```bash
3875
# Install dependencies

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.5",
5+
"version": "1.2.7",
66
"mainProject": "@visactor/vmind",
77
"nextBump": "patch"
88
}

docs/assets/api/en/dataQuery.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The dataQuery function is a powerful data aggregation tool. It takes three param
77
## Supported Models:
88
- GPT-3.5
99
- GPT-4
10+
- [skylark2-pro](https://www.volcengine.com/product/yunque)
1011

1112
## Interface Parameters:
1213

docs/assets/api/en/generateChart.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The generateChart function is used for intelligent chart generation.
88
- GPT-3.5
99
- GPT-4
1010
- [skylark2-pro](https://www.volcengine.com/product/yunque)
11+
- [chart-advisor](../guide/Basic_tutorial/Chart_Advisor)
1112

1213
## Interface Parameters:
1314

@@ -65,6 +66,9 @@ const { spec, time } = await vmind.generateChart(userPrompt, fieldInfo, dataset,
6566
- The generateChart method will pass the userPrompt and fieldInfo to the large language model for chart generation, but the detailed data in the dataset will not be passed.
6667
- In the process of generating the chart, VMind will first use the large language model, according to the userPrompt and fieldInfo, to recommend a suitable chart type. Then, it will map the fields in the fieldInfo to the x-axis, y-axis, color, size and other visual channels of the chart.
6768
- VMind will add an entrance animation to the generated chart by default, so it will also return the duration of the chart animation time. If you want to turn off the chart animation, you can set spec.animation to false.
69+
- When the model type is set to chart-advisor, it will not call a large language model to generate charts. The results generated will include multiple types of charts. For details, please refer to [Rule-based Chart Generation](../guide/Basic_Tutorial/Chart_Advisor).
6870

6971
## Related Tutorials
70-
[Intelligent Chart Generation](../guide/Basic_Tutorial/Chart_Generation)
72+
- [Intelligent Chart Generation](../guide/Basic_Tutorial/Chart_Generation)
73+
- [Rule-based Chart Generation](../guide/Basic_Tutorial/Chart_Advisor)
74+

docs/assets/api/zh/dataQuery.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ dataQuery函数是一个强大的数据聚合工具,它接收三个参数:
66
## 支持模型:
77
- GPT-3.5
88
- GPT-4
9+
- [skylark2-pro](https://www.volcengine.com/product/yunque)
910

1011
## 接口参数:
1112

docs/assets/api/zh/generateChart.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ generateChart函数用于图表智能生成。
88
- GPT-3.5
99
- GPT-4
1010
- [skylark2-pro](https://www.volcengine.com/product/yunque)
11+
- [chart-advisor](../guide/Basic_tutorial/Chart_Advisor)
1112

1213
## 接口参数:
1314

@@ -65,6 +66,8 @@ const { spec, time } = await vmind.generateChart(userPrompt, fieldInfo, dataset,
6566
- generateChart方法会将userPrompt和fieldInfo传递给大语言模型用于生成图表,但是dataset中的详细数据并不会被传递。
6667
- 在生成图表的过程中,VMind首先会利用大语言模型,根据userPrompt和fieldInfo,推荐一个适合的图表类型。然后,它会将fieldInfo中的字段映射到图表的x轴、y轴、颜色、尺寸等视觉通道上。
6768
- VMind默认会为生成的图表添加入场动画,因此它还会返回图表动画的时长time。如果你想关闭图表动画,可以将spec.animation设为false。
69+
- 当设定模型类型为chart-advisor时,将不需调用大型语言模型生成图表,产生的结果将包括多种图表,详情可参见[基于规则的图表生成](../guide/Basic_Tutorial/Chart_Advisor)
6870

6971
## 相关教程
70-
[图表智能生成](../guide/Basic_Tutorial/Chart_Generation)
72+
- [图表智能生成](../guide/Basic_Tutorial/Chart_Generation)
73+
- [基于规则的图表生成](../guide/Basic_Tutorial/Chart_Advisor)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Rule-based Chart Generation
2+
VMind can automatically generate charts based on the current dataset in combination with the built-in @visactor/chart-advisor. Chart-advisor is fully dependent on visualization rules and does not need to call large language models. When you use generateChart, and the large model cannot successfully generate a chart, VMind will use chart-advisor as an alternative to create a chart.
3+
4+
You can also actively choose to use chart-advisor to generate charts, just set the model type to chart-advisor when initializing the VMind object:
5+
```ts
6+
import VMind, { Model } from '@visactor/vmind'
7+
8+
const vmind = new VMind({
9+
model: Model.CHART_ADVISOR,
10+
})
11+
const userPrompt = '';
12+
const advisorResult = await vmind.generateChart(userPrompt, fieldInfo, dataset);
13+
```
14+
Since chart-advisor does not rely on large language models, userPrompt can be set to empty.
15+
You can learn more about fieldInfo and dataset in the [Data Format and Data Processing](./Data_Process) section.
16+
17+
Chart-advisor will generate several available charts based on a series of rules, at which time generateChart will return a list containing chart types, scores, and spec.
18+
19+
## Example
20+
Here is an example of a chart generated by chart-advisor using product sales data:
21+
22+
```ts
23+
const dataset = [
24+
{
25+
"Product name": "Coke",
26+
"Sales": 2350
27+
},
28+
{
29+
"Product name": "Sprite",
30+
"total_sales": 1056
31+
},
32+
{
33+
"Product name": "Fanta",
34+
"total_sales": 4778
35+
},
36+
{
37+
"Product name": "Mirinda",
38+
"total_sales": 3336
39+
}
40+
// ...more data
41+
]
42+
43+
const fieldInfo = [
44+
{
45+
"fieldName": "Product name",
46+
"type": "string",
47+
"role": "dimension"
48+
},
49+
{
50+
"fieldName": "Sales",
51+
"type": "int",
52+
"role": "measure"
53+
}
54+
]
55+
56+
const advisorResult = await vmind.generateChart(userPrompt, fieldInfo, dataset);
57+
58+
```
59+
The advisorResult result is as follows:
60+
```json
61+
[
62+
{
63+
"chartSource": "chartAdvisor", // Chart source
64+
"spec": ..., // Generated chart spec
65+
"chartType": "BAR CHART", // Chart type
66+
"score": 1, // Current chart score
67+
},
68+
{
69+
"chartSource": "chartAdvisor",
70+
"spec": ..., // Generated chart spec
71+
"chartType": "RADAR CHART", // Chart type
72+
"score": 0.16666666666666666 // Current chart score
73+
}
74+
]
75+
```
76+
77+
Here, score represents the degree of fit between the current chart type and the input data, the higher the score means that the chart type is more suitable for displaying the current data.
78+
79+
80+
The generated chart is as follows:
81+
82+
![](https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vmind/tutorials/VMind_advisor.png)
83+
84+
According to the characteristics of the input data and the field information in fieldInfo, chart-advisor will score each type of chart based on a full set of visualization rules and sort each type of chart based on the score. These rules ensure the accuracy and aesthetics of the visualization results and minimize visual confusion and visual errors in the chart.

docs/assets/guide/en/Basic_Tutorial/Data_Aggregation.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Data Aggregation
2-
📢 Note: Currently, the data aggregation feature only supports GPT series models, and we are working hard to integrate more models.
32

43
## Overview of Data Aggregation
54
When we use chart libraries like VChart to draw bar charts, line charts, etc., if the dataset used has not been aggregated, it may have a negative impact on the visualization effect.

docs/assets/guide/menu.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@
8080
"en": "Intelligent Chart Generation"
8181
}
8282
},
83+
{
84+
"path": "Chart_Advisor",
85+
"title": {
86+
"zh": "基于规则的图表生成",
87+
"en": "Rule-based Chart Generation"
88+
}
89+
},
8390
{
8491
"path": "Custom_Request",
8592
"title": {
@@ -90,4 +97,4 @@
9097
]
9198
}
9299
]
93-
}
100+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# 基于规则的图表生成
2+
VMind可以结合内建的@visactor/chart-advisor,自动根据当前数据集生成图表。chart-advisor完整依赖于可视化规则,不需要调用大型语言模型。当你使用generateChart,而大模型无法成功生成图表时,VMind会使用chart-advisor作为备选方案来创建一个图表。
3+
4+
你同样可以主动选择使用chart-advisor来生成图表,只需在初始化VMind对象时,将模型类型设置为chart-advisor:
5+
```ts
6+
import VMind, { Model } from '@visactor/vmind'
7+
8+
const vmind = new VMind({
9+
model: Model.CHART_ADVISOR,
10+
})
11+
const userPrompt = '';
12+
const advisorResult = await vmind.generateChart(userPrompt, fieldInfo, dataset);
13+
```
14+
由于chart-advisor不依赖大型模型,userPrompt可以设为空。
15+
你可以在[数据格式与数据处理](./Data_Process)章节了解fieldInfo和dataset的更多相关信息。
16+
17+
chart-advisor会根据一系列规则生成几种可用的图表,此时generateChart将返回包含图表类型、得分以及spec的列表。
18+
19+
## 示例
20+
下面是一个使用商品销售额数据,通过chart-advisor生成图表的示例:
21+
22+
```ts
23+
const dataset = [
24+
{
25+
"Product name": "Coke",
26+
"Sales": 2350
27+
},
28+
{
29+
"Product name": "Sprite",
30+
"total_sales": 1056
31+
},
32+
{
33+
"Product name": "Fanta",
34+
"total_sales": 4778
35+
},
36+
{
37+
"Product name": "Mirinda",
38+
"total_sales": 3336
39+
}
40+
// ...more data
41+
]
42+
43+
const fieldInfo = [
44+
{
45+
"fieldName": "Product name",
46+
"type": "string",
47+
"role": "dimension"
48+
},
49+
{
50+
"fieldName": "Sales",
51+
"type": "int",
52+
"role": "measure"
53+
}
54+
]
55+
56+
const advisorResult = await vmind.generateChart(userPrompt, fieldInfo, dataset);
57+
58+
```
59+
advisorResult结果如下:
60+
```json
61+
[
62+
{
63+
"chartSource": "chartAdvisor", //图表来源
64+
"spec": ..., //生成的图表spec
65+
"chartType": "BAR CHART", //图表类型
66+
"score": 1, //当前图表得分
67+
},
68+
{
69+
"chartSource": "chartAdvisor",
70+
"spec": ..., //生成的图表spec
71+
"chartType": "RADAR CHART", //图表类型
72+
"score": 0.16666666666666666 //当前图表得分
73+
}
74+
]
75+
```
76+
77+
其中,score表示当前图表类型与输入数据的匹配程度,分数越高表示该类型的图表越适用于展示当前数据。
78+
79+
80+
生成的图表如下:
81+
82+
![](https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vmind/tutorials/VMind_advisor.png)
83+
84+
根据输入数据的特性以及fieldInfo中的字段信息,chart-advisor会基于一整套可视化规则,为每种图表类型打分,并依分数将各图表类型排序。这些规则确保了可视化结果的准确度和美观性,并尽可能地减少图表中的视觉混乱和视觉错误。

docs/assets/guide/zh/Basic_Tutorial/Data_Aggregation.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# 数据聚合
2-
📢 注意:目前数据聚合功能仅支持GPT系列模型,我们正在努力接入更多模型。
32

43
## 数据聚合概述
54
当我们使用VChart等图表库来绘制柱状图、折线图等图表时,如果使用的数据集dataset并未经过聚合处理,可能会对可视化效果产生不良影响。

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": "1.2.5",
3+
"version": "1.2.7",
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": "1.2.5",
3+
"version": "1.2.7",
44
"description": "图表推荐模块",
55
"main": "lib",
66
"module": "es",

packages/chart-advisor/src/score.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1183,17 +1183,17 @@ export const scorer: Scorer = params => {
11831183
calBar,
11841184
calBarPercent,
11851185
calBarParallel,
1186-
calCombination,
1186+
//calCombination,
11871187
calScatterplot,
11881188
calLineChart,
11891189
// calLineChartCombine,
11901190
calPieChart,
1191-
calMeasureCard,
1191+
//calMeasureCard,
11921192
calRadar,
11931193
calWordCloud,
11941194
calFunnelChart,
1195-
calDualAxis,
1196-
calTable
1195+
calDualAxis
1196+
//calTable
11971197
];
11981198

11991199
return scoreCalculators;

0 commit comments

Comments
 (0)