Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5 性能问题:1w+ 数据出现较长时间卡顿,cpu占有率一度达到100%,具体实现如下 #4846

Closed
4 tasks
tiehongji opened this issue Mar 28, 2023 · 3 comments

Comments

@tiehongji
Copy link

tiehongji commented Mar 28, 2023

import React, { useCallback, useEffect, useRef } from 'react';
import { useChartData } from './hooks';
import dayjs from 'dayjs';
import { Chart } from '@antv/g2';
const Home = () => {
  const chartDom = useRef(null);
  const chart = useRef(null);
  const [data, getData] = useChartData(10000);
  const initChart = useCallback(() => {
    if (chart?.current) {
      chart.current.changeData(data);
    } else {
      chart.current = new Chart({
        container: 'main',
        theme: 'classic',
      });
      chart.current
        .line() // 创建一个 Interval 标记
        .data(data) // 绑定数据
        .encode('x', 'xField') // 编码 x 通道
        .encode('y', 'value'); // 编码 y 通道
      chart.current
        .point() // 创建一个 Interval 标记
        .data(data) // 绑定数据
        .encode('x', 'xField') // 编码 x 通道
        .encode('y', 'value');
      // 渲染可视化
      chart.current.render();
    }
  }, [data]);
  useEffect(() => {
    initChart();
  }, [initChart]);
  return (
    <div>
      <div ref={chartDom} id="main" style={{ height: 500, width: '100%' }}></div>
    </div>
  );
};

export default Home;

Checklist
  • npm test passes
  • benchmarks are included
  • commit message follows commit guidelines
  • documents are updated
Description of change
@Aarebecca
Copy link
Contributor

你好,能给给到一个复现 demo 吗

@hustcc
Copy link
Member

hustcc commented Aug 22, 2023

我们做一个性能报告出来,看看具体的性能极限在哪里,以及一些可行的解决方案。

@hustcc hustcc changed the title 1w+ 数据出现较长时间卡顿,cpu占有率一度达到100%,具体实现如下 v5 性能问题:1w+ 数据出现较长时间卡顿,cpu占有率一度达到100%,具体实现如下 Aug 25, 2023
@pearmini
Copy link
Member

长时间没有回应,关闭了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants