-Displayed as a line graph with C #, Series is about 10 items, Points is more than 20000
・ Points are added every 100ms
The following two under the situation of
① Smoothly zoom in and out with the mouse wheel
(2) Move the vertical line cursor at the click position with the "button to move the cursor to the left" and the "button to move the cursor to the right"
I want to realize.

Problems i am experiencing

① can be scaled up and down, but the overall operation becomes very heavy when the number of data (Points) exceeds 5000.
I'm currently adding data with Points.AddXY. Is there a factor that increases the way the data is held?

Chart.Series [0] .Points.AddXY (cnt, double.Parse (data [0]));
Chart.Series [1] .Points.AddXY (cnt, double.Parse (data [1]));

Chart.Series [N] .Points.AddXY (cnt, double.Parse (data [N]));


②, you can set the vertical line cursor at the click position, but I do not know how to move the vertical line cursor with the left and right keys.
When you click the mouse, you can set the vertical line cursor as follows. However, you can see the setting of the information corresponding to the following mousePoint in the click event of the "button to move the cursor to the left" or "button to move the cursor to the right". There is no situation.

Point mousePoint = New Point (e.X, e.Y);
Chart1.ChartAreas (0) .CursorX.SetCursorPixelPosition (mousePoint, True);

Can you give me advice?

  • Answer # 1

    ・ About speed
    Instead of adding all the data with AddXY, it is improved if you pass the data that is thinned out moderately. Even if a graph with more than 1000 points is displayed, it is meaningless because it cannot be seen when considering the screen resolution.
    5000 * 8 * 2 = 80KB is enough to fit in the CPU L1 cache. It is natural that if data of this size is scanned frequently and drawing processing is performed, it will be slow. Eventually, 320KB and data that does not fit in the L2 cache are targeted, so it will be significantly slower unless it is thinned out to a reasonable extent.

  • Answer # 2

    It is better to keep the Parseed data than to Parse every time.
    How about using Chart.DataSource?