C# 如何使用MSChart优化Invalidate()调用?

C# 如何使用MSChart优化Invalidate()调用?,c#,.net,optimization,mschart,C#,.net,Optimization,Mschart,我有3种不同的图形显示,它们利用了C#的MSChart库。我正在用实时可用的数据更新图表。更新显示器的功能大约每40毫秒运行一次,如下所示: private void UpdateDisplay() { // Process data for graph 1 // (Graph 1 has 2 Line graphs, and 1 Candlestick) // Get the series Charting.Series lineGraph1 = graph1

我有3种不同的图形显示,它们利用了C#的MSChart库。我正在用实时可用的数据更新图表。更新显示器的功能大约每40毫秒运行一次,如下所示:

private void UpdateDisplay()
{
    // Process data for graph 1
    // (Graph 1 has 2 Line graphs, and 1 Candlestick)

    // Get the series
    Charting.Series lineGraph1 = graph1.Series[0];

    // ....process some data and generate new data....

    // Update the data
    for (int i = 0; i < displayedSamples; i++)
    {
        lineGraph1.Points[i].YValues[0] = newData[i];
        // ....update other series' data....
    }       

    // Redraw the graph
    graph_1.Invalidate();
    graph_1.Update();

    // Process data for graph 2
    // (Graph 2 has 1 bar graph)
    // ...
    graph_2.Invalidate();
    graph_2.Update();

    // Process data for graph 3 and update points
    // (Graph 3 has 2 column graphs)
    // ...
    graph_3.Invalidate();
    graph_3.Update();
}
private void UpdateDisplay()
{
//图1的过程数据
//(图1有2个线条图和1个烛台)
//获取系列
制图.系列线图1=图1.系列[0];
//..处理一些数据并生成新数据。。。。
//更新数据
对于(int i=0;i
运行应用程序会导致应用程序的CPU使用量猛增。如果我只删除“Invalidate()”调用,那么应用程序的CPU使用率接近0%

序列中的点集保持一致。生成序列时添加所有点,然后更新点的值

我试图通过仅使显示序列中的点无效(即graph_3.series[0].points.Invalidate())来提高性能,但这没有产生明显的效果


我可以选择哪些选项来提高性能?

如果我记得的话,也许你可以在这个系列中使用Suspendupdate和ResumeUpdate,这可能会更快。我用更多的代码编辑了这个问题,说明了我是如何更新数据的。我将把SuspendUpdate和ResumeUpdate放在哪里?我认为这些方法只在添加/清除/删除点时有用。