Click here to Skip to main content
15,436,928 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My chart is updated frequently but when chart is use chart1.Series[MultipleGraphSignals[i]].Points.RemoveAt(0);
the remove is shown but new point is not showing.
ChOnline is name of Chart Control
where MultipleGraphSignals[i] is Series name String array
and MaximumWidth=100
Before point count 100 chart is working fine but after 100 it is erase from left side but current value is not updated/shown in chart

What I have tried:

public void Update_Graph(double[] MultipleSignalsVAlue)
        {
           try
            {
                for (int i = 0; i < SignalsCntr; i++)
                {
                    DataPoint dp2 = new DataPoint(Cntr, MultipleSignalsVAlue[i]);
                    if (chart1.Series[MultipleGraphSignals[i]].Points.Count > MaximumWidth)
                        chart1.Series[MultipleGraphSignals[i]].Points.RemoveAt(0);
                    chart1.Series[MultipleGraphSignals[i]].Points.Add(dp2);               
                Cntr++;
                if (Cntr > 1000)
                    Cntr = 1;
            }
            catch(Exception ex) { }
            chart1.AlignDataPointsByAxisLabel();
        }
Posted
Updated 4-Sep-20 2:18am
v3
Comments
Gerry Schmitz 3-Sep-20 9:00am    
You got some weird calculations that no one knows the point of. Better step through with the debugger because no one else can.

1 solution

Without your data and your chart actually running, we can't really tell, but at a guess it's the X axis that is giving the problem - I suspect it isn't moving to reflect the data change.

To be honest, the MS chart isn't really meant for real-time display of rolling data, you would be better off using something that is. Have a look at this: Live Charts[^] - it's free, and the source is available on GitHub if you need to customise it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900