VisActor / VisActor/VChart

[Bug] 缩放父元素会导致图表执行了多次

Open
#3,832 6 comments 0 reactions 1 assignee View on GitHub

@xiaoluoHe is already working on this.

Since Mar 24, 2025.

bug
Dominant language
TypeScript
Stars
1.8k
Forks
221
Avg merge
1d 6h
Merged PRs (30d)
26

Description

Version

1.13.7

Link to Minimal Reproduction

缩放父元素并不会导致RecentlyVisited组件重新渲染,但是图表却执行了多次

Steps to Reproduce

import { useEffect, useRef } from "react";
import { Card } from "antd";
import { AreaChart, type VChartCore, type ISpec } from "@visactor/react-vchart";

import type { RecentlyVisiteData } from "./types";

const data: RecentlyVisiteData[] = [
{ date: "2024-10-01", value: 3 },
{ date: "2024-10-02", value: 4 },
{ date: "2024-10-03", value: 100 },
{ date: "2024-10-04", value: 5 },
{ date: "2024-10-05", value: 60 },
{ date: "2024-10-06", value: 6 },
{ date: "2024-10-07", value: 7 },
{ date: "2024-10-08", value: 2 },
{ date: "2024-10-09", value: 113 },
];

const spec = {
type: "area",
data: {
id: "recentlyVisite",
values: [],
},
xField: "date",
yField: "value",
line: {
style: {
curveType: "monotone",
},
},
} as ISpec;

// 最近访问
export default function RecentlyVisited() {
const chartRef = useRef(null);
useEffect(() => {
const timer = setTimeout(() => {
chartRef.current?.updateData("recentlyVisite", data, undefined, { reAnimate: true });
}, 500);
const chartInstance = chartRef.current;
return () => {
chartInstance?.release();
clearTimeout(timer);
};
}, []);

return (



);
}
缩放父元素并不会导致RecentlyVisited组件重新渲染,但是图表却执行了多次

Image

Current Behavior

缩放父元素并不会导致RecentlyVisited组件重新渲染,但是图表却执行了多次

Expected Behavior

缩放父元素并不会导致RecentlyVisited组件重新渲染,但是图表却执行了多次

Environment
- OS:
- Browser:
- Framework:
Any additional comments?

缩放父元素并不会导致RecentlyVisited组件重新渲染,但是图表却执行了多次

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.