一些后我的图表变慢了 [英] My chart is slow down after some

查看:80
本文介绍了一些后我的图表变慢了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图表在应用程序启动一段时间后变慢。



我尝试了什么:



my chart is slow down after sometime of application starting.

What I have tried:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace chart
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        double a,b,c = 0;
        private void Form1_Load(object sender, EventArgs e)
        {

        }
        
        private void timer1_Tick(object sender, EventArgs e)
        {
            a = a + 1;
            b = b + 3;
            timervaluee.Text=a.ToString()+ "," + b.ToString()+ "," + c.ToString();
            chart1.Series[0].Points.AddXY(a, b);
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
                timer1.Start();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            chart1.Series[0].Points.Clear();           
        }

        private void button3_Click(object sender, EventArgs e)
        {
            timer1.Stop();
        }
    }
}

推荐答案

是的。您定期向图表添加点,从而为其提供更多工作。当要绘制的数据量比两个刻度之间可用的处理时间更长时,一切都将开始变慢。



首先考虑一下您正在绘制的数据量,如何绘制数据,是否可以引入任何数据减少,或者看一下商业图书馆或专门为该数据类型和卷编写自己的文件。
Well yes. You are adding points to the chart at regular intervals, giving it more work to do. When the amount of data to plot takes more time to process than is available between two Ticks, everything will start to slow down.

Start by thinking about the volume of data you are plotting, how you are plotting it, if there are any data reductions you can introduce, and perhaps either look at a commercial library or writing your own specifically for that data type and volume.


这篇关于一些后我的图表变慢了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆