Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
396 changes: 198 additions & 198 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.3.2","mainProject":"@visactor/vchart","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.3.3","mainProject":"@visactor/vchart","nextBump":"patch"}]
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Three canvases need to be declared, and pay attention to the order of declaratio
- `bar_tooltip_canvas` is used to draw the canvas of the tooltip. The tooltip of the cross-end environment is drawn using the canvas.

```html
<view class="chart-space">
<view class="vchart">
<!-- canvas order is important -->
<canvas
name="bar_hidden_canvas"
Expand Down Expand Up @@ -86,7 +86,7 @@ const chartInstance = new VChart(spec, {
});
```

2. Regarding events, users need to bind events to the canvas (canvas used for drawing) element themselves, and then manually dispatch events in the event listening function to trigger events inside ChartSpace.
2. Regarding events, users need to bind events to the canvas (canvas used for drawing) element themselves, and then manually dispatch events in the event listening function to trigger events inside VChart.

```ts
bindChartEvent(event) {
Expand All @@ -106,7 +106,7 @@ The following is the completed code related to index.js:

```ts
import barSpec from './data/bar';
import ChartSpace from '@visactor/vchart';
import VChart from '@visactor/vchart';
import mapJson from './data/map-data-china';

Card({
Expand All @@ -120,8 +120,8 @@ Card({
]
},
onLoad: function () {
// If you need to use a map, you need to register the map first
ChartSpace.registerMap('china', mapJson, {
// 如果需要使用地图,需要先注册地图
VChart.registerMap('china', mapJson, {
type: 'geojson'
});
this.init();
Expand All @@ -135,33 +135,25 @@ Card({
method: 'boundingClientRect',
success: domRef => {
if (!domRef) {
console.error(`#${item.id} canvas not found`);
console.error(`未找到 #${item.id} 画布`);
return;
}
domRef.id = item.id;
const pixelRatio = SystemInfo.pixelRatio;

const chartInstance = new ChartSpace(
{
width: domRef.width, // Tip: Cross-end environment needs to manually pass in the width and height
height: domRef.height,
...item.spec
const chartInstance = new VChart(item.spec, {
mode: 'lynx', // Tip: 跨端环境需要手动传入 mode
// 跨端参数
modeParams: {
domref: domRef, // 图表绘制的 canvas 节点
force: true, // 是否强制使用 canvas 绘制
canvasIdLists: [`${item.id}_draw_canvas`, `${item.id}_tooltip_canvas`, `${item.id}_hidden_canvas`], // canvasId 列表
tooltipCanvasId: `${item.id}_tooltip_canvas`, // tooltip canvasId
freeCanvasIdx: 1 // 自由 canvas 索引
},
{
mode: 'lynx', // Tip: Cross-end environment needs to manually pass in mode
// Cross-end parameters
modeParams: {
domref: domRef, // Canvas node for chart drawing
force: true, // Whether to force the use of canvas for drawing
canvasIdLists: [`${item.id}_draw_canvas`, `${item.id}_tooltip_canvas`, `${item.id}_hidden_canvas`], // canvasId list
tooltipCanvasId: `${item.id}_tooltip_canvas`, // tooltip canvasId
freeCanvasIdx: 1 // Free canvas index
},
dpr: pixelRatio, // Tip: Cross-end environment needs to manually pass in dpr
renderCanvas: `${item.id}_draw_canvas` // Declare the canvasId used for drawing
// animation: false
}
);
dpr: pixelRatio, // Tip: 跨端环境需要手动传入 dpr
renderCanvas: `${item.id}_draw_canvas` // 声明用于绘制的 canvasId
});
item.chart = chartInstance;

if (item.events) {
Expand All @@ -184,7 +176,7 @@ Card({
const targetChart = this.data.chartList.find(x => x.id === id);
const chartInstance = targetChart?.chart;
if (chartInstance) {
event.target = chartInstance.getCanvas(); // Tip: Must be set
event.target = chartInstance.getCanvas(); // Tip: 必须设置
chartInstance.getStage().window.dispatchEvent(event);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Lynx 是字节内用 Web 技术栈快速构建 Native 视图的高性能跨端
- `bar_tooltip_canvas` 用于绘制 tooltip 的 canvas,跨端环境的 tooltip 使用 canvas 绘制。

```html
<view class="chart-space">
<view class="vchart">
<!-- canvas顺序很重要 -->
<canvas
name="bar_hidden_canvas"
Expand Down Expand Up @@ -86,7 +86,7 @@ const chartInstance = new VChart(spec, {
});
```

2. 在事件上,需要用户自己在 canvas(用于绘制的 canvas) 元素上绑定事件,然后在事件监听函数中手动得分发事件来触发 ChartSpace 内部的事件。
2. 在事件上,需要用户自己在 canvas(用于绘制的 canvas) 元素上绑定事件,然后在事件监听函数中手动得分发事件来触发 VChart 内部的事件。

```ts
bindChartEvent(event) {
Expand All @@ -106,7 +106,7 @@ bindChartEvent(event) {

```ts
import barSpec from './data/bar';
import ChartSpace from '@visactor/vchart';
import VChart from '@visactor/vchart';
import mapJson from './data/map-data-china';

Card({
Expand All @@ -121,7 +121,7 @@ Card({
},
onLoad: function () {
// 如果需要使用地图,需要先注册地图
ChartSpace.registerMap('china', mapJson, {
VChart.registerMap('china', mapJson, {
type: 'geojson'
});
this.init();
Expand All @@ -141,27 +141,19 @@ Card({
domRef.id = item.id;
const pixelRatio = SystemInfo.pixelRatio;

const chartInstance = new ChartSpace(
{
width: domRef.width, // Tip: 跨端环境需要手动传入宽高
height: domRef.height,
...item.spec
const chartInstance = new VChart(item.spec, {
mode: 'lynx', // Tip: 跨端环境需要手动传入 mode
// 跨端参数
modeParams: {
domref: domRef, // 图表绘制的 canvas 节点
force: true, // 是否强制使用 canvas 绘制
canvasIdLists: [`${item.id}_draw_canvas`, `${item.id}_tooltip_canvas`, `${item.id}_hidden_canvas`], // canvasId 列表
tooltipCanvasId: `${item.id}_tooltip_canvas`, // tooltip canvasId
freeCanvasIdx: 1 // 自由 canvas 索引
},
{
mode: 'lynx', // Tip: 跨端环境需要手动传入 mode
// 跨端参数
modeParams: {
domref: domRef, // 图表绘制的 canvas 节点
force: true, // 是否强制使用 canvas 绘制
canvasIdLists: [`${item.id}_draw_canvas`, `${item.id}_tooltip_canvas`, `${item.id}_hidden_canvas`], // canvasId 列表
tooltipCanvasId: `${item.id}_tooltip_canvas`, // tooltip canvasId
freeCanvasIdx: 1 // 自由 canvas 索引
},
dpr: pixelRatio, // Tip: 跨端环境需要手动传入 dpr
renderCanvas: `${item.id}_draw_canvas` // 声明用于绘制的 canvasId
// animation: false
}
);
dpr: pixelRatio, // Tip: 跨端环境需要手动传入 dpr
renderCanvas: `${item.id}_draw_canvas` // 声明用于绘制的 canvasId
});
item.chart = chartInstance;

if (item.events) {
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@arco-design/web-react": "2.46.1",
"@visactor/vchart": "workspace:1.3.2",
"@visactor/vchart": "workspace:1.3.3",
"@visactor/vutils": "~0.15.14",
"@visactor/vgrammar": "~0.6.6",
"@visactor/vrender": "~0.14.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/block-vchart/block/vchart/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/lark-vchart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/lark-vchart",
"version": "1.3.2",
"version": "1.3.3",
"description": "VChart 飞书小程序组件",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/lark-vchart/src/vchart/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/react-vchart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vchart",
"version": "1.3.2",
"version": "1.3.3",
"description": "The react version of VChart 4.x",
"keywords": [
"react",
Expand Down Expand Up @@ -28,7 +28,7 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"@visactor/vchart": "workspace:1.3.2",
"@visactor/vchart": "workspace:1.3.3",
"@visactor/vutils": "~0.15.14",
"@visactor/vgrammar": "~0.6.6",
"@visactor/vrender": "~0.14.8",
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-vchart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/taro-vchart",
"version": "1.3.2",
"version": "1.3.3",
"description": "Taro VChart 图表组件",
"sideEffects": false,
"main": "lib/src/index.js",
Expand Down Expand Up @@ -40,7 +40,7 @@
},
"license": "MIT",
"dependencies": {
"@visactor/vchart": "workspace:1.3.2"
"@visactor/vchart": "workspace:1.3.3"
},
"devDependencies": {
"@internal/eslint-config": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/tt-vchart/src/vchart/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/vchart-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"test-watch": "DEBUG_MODE=1 jest --watch"
},
"dependencies": {
"@visactor/vchart": "workspace:1.3.2",
"@visactor/vchart": "workspace:1.3.3",
"@visactor/vutils": "~0.15.14",
"@visactor/vdataset": "~0.15.14",
"@visactor/vrender": "~0.14.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vchart-schema",
"version": "1.3.2",
"version": "1.3.3",
"description": "The VChart JSON schema file.",
"sideEffects": false,
"main": "vchart.json",
Expand Down
Loading