Accumulate values ​​in a series of diagrams - WPF DevExpress

I am creating several lines to control the diagram in DevExpress at runtime. A series must be created at runtime, as the number of series can vary from the data request that I do. This is how I create the series:

foreach (var item in lstSPCPrintID) { string seriesName = Convert.ToString(item); LineSeries2D series = new LineSeries2D(); dxcSPCDiagram.Series.Add(series); series.DisplayName = seriesName; var meas = from x in lstSPCChart where x.intSPCPrintID == item select new { x.intSPCMeas }; foreach (var item2 in meas) { series.Points.Add(new SeriesPoint(item2.intSPCMeas)); } } 

This happens inside the completed backgroundworker event, and all the necessary data is in the corresponding lists. In the test instance, I run 6 episodes.

Each series consists of some test measurements that I need along the x axis. These measurements can be of the same value (and in many cases the same). Then I want the y axis to contain the number of attempts, for example, -21. This will eventually create a curve.

I am currently creating a sequence point for each dimension, but I do not know how to handle the argument ArgumentDataMember / ValueDataMember in this particular scenario. Is there a way for the chart to automatically calculate or do I need to do it manually? Can someone help me get back on track?

+5
source share
1 answer

In the end, I made a distinct amount of measurements before adding points to the series.

 foreach (var item in lstSPCPrintID) { string seriesName = String.Format("Position: {0}", Convert.ToString(item)); LineStackedSeries2D series = new LineStackedSeries2D(); series.ArgumentScaleType = ScaleType.Numerical; series.DisplayName = seriesName; series.SeriesAnimation = new Line2DUnwindAnimation(); var meas = from x in lstSPCChart where x.intSPCPrintID == item select new { x.dblSPCMeas }; var measDistinctCount = meas.GroupBy(x => x.dblSPCMeas).Select(group => new { Meas = group.Key, Count = group.Count() }).OrderBy(y => y.Meas); foreach (var item2 in measDistinctCount) { series.Points.Add(new SeriesPoint(item2.Meas, item2.Count)); } dxcSPCDiagram.Series.Add(series); series.Animate(); } 
+1
source

Source: https://habr.com/ru/post/1204315/


All Articles