Hello,
I have a SciChartSurface with multiple StackedColumnRenderableSeries. The goal is to create a column style “Stacked Graph”.
The StackedColumnRenderableSeries are created this way:
private StackedColumnRenderableSeries[] m_layers = new StackedColumnRenderableSeries[0]; ------- while (num > m_layers.Length) { StackedColumnRenderableSeries layer = new StackedColumnRenderableSeries() { DataPointWidth = 0.9, Fill = new SolidColorBrush(DefaultMainColorOfCurrentSetting), Stroke = Colors.Black, ShowLabel = false }; layer.DataSeries = new XyDataSeries<double, double>(); layer.DataSeries.AcceptsUnsortedData = true; m_sciChartSurface.RenderableSeries.Add(layer); List<StackedColumnRenderableSeries> temp = m_layers.ToList(); temp.Add(layer); m_layers = temp.ToArray(); }
Later, they are fed data with this function:
void addBar(double[] layerValues) { using (m_sciChartSurface.SuspendUpdates()) { for (int i = 0; i < m_layers.Length; i++) { XyDataSeries<double, double> data = (XyDataSeries<double, double>)m_layers[i].DataSeries; data.Append(m_currentTimepoint, layerValues[i]); } } m_currentTimepoint++; } private int m_currentTimepoint = 1;
If I use this function within the class constructor, everything works as expected (see attached image).
However, sometimes, I receive the error message “”System.ArgumentException” in SciChart.Charting.dll The StackedColumnRenderableSeries type requires that all stacked stacked series with the same StackedGroupId have the same XValues.”
I fail to see the meaning of this message, since, the x-Value is the same for each part of the new column. Its “m_currentTimepoint”.
Additional Information:
This visualization is part of a medical monitoring software we are currently developing. If we use test data to call the addBar-Function (directly from the constructor, for example), the error does not appear. However, if we use data from our medical sensors, it appears. In both cases, the addBar-Function receives valid data (no NaN´s or such things)
The function is not called often, about once every 10 seconds.
Thank you
- Marc Vahldieck asked 2 months ago
- last edited 2 months ago
- You must login to post comments
Hi Marc
The error you’re getting should be self-explanatory: the StackedColumnRenderableSeries requires that all columns in the Stacked Group have the same number & values for X-values
If this is impossible – and you receive data with missing values, you can include Y=NaN to enter a ‘null’ or zero point
Also, unsorted data for Stacked column is probably not a good idea. A column series is always rendered as a time-series and if your data stream arrives out of order in X, then it’s worth to sort it before inserting into the StackedColumnRenderableSeries.
If you’re still stuck after making changes, send over a minimal code sample to reproduce any issue and we will investigate.
Best regards,
Andrew
- Andrew Burnett-Thompson answered 2 months ago
- You must login to post comments
Please login first to submit.