Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

How do you replace a series data points for redrawing on the chart?

$
0
0

I have a web service with a chart control which grabs an array of data and makes a line chart, then makes a moving average with the data according to a number you input. I want to be able to replace the moving data line while still keeping the original line underneath, just replacing the moving data information.  I tried the following:

if (MyChart.Series.IndexOf("Series 2") != -1)
            {
                MyChart.Series["Series 2"].Points.Clear();
                foreach (localhost.GraphData data in graph2)
                {
                    S2.Points.AddXY(data.Date, data.Value);
                }
            }
            else
            {
                MyChart.Series.Add(S2);

                // A Series object contains DataPoint objects. The AddXY method adds a new DataPoint
                // to the Points collection (a DataPointCollection object).
                foreach (localhost.GraphData data in graph2)
                {
                    S2.Points.AddXY(data.Date, data.Value);
                }
            }


010010111000100011100111100010101010




Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>