I am using WPF SciChart version 1.3.1.1107 under the MVVM pattern.
I’ve included some sample code from a couple of my view models for reference purposes but it identical to sample code I copied from your examples.
My problem is that the data values arrive in a non sorted date time order and as a result my chart line does not connect the points based on the xaxis datetime value, but instead connects the points based on when the codes adds the points to the data series.
Do you have a feature that will allow me to plot a line based on a date time values?
IDataSeries dataSeries = ChartDataSeriesSet.AddSeries(); private IDataSeriesSet _chartDataSeriesSet = new DataSeriesSet(); public IDataSeriesSet ChartDataSeriesSet { get { return _chartDataSeriesSet; } set { _chartDataSeriesSet = value; NotifyPropertyChanged("ChartDataSeriesSet"); } } private IDataSeries _dataValues = null; public IDataSeries DataValues { get { return _dataValues; } set { _dataValues = value; NotifyPropertyChanged("DataValues"); } }
- sdemooy asked 12 years ago
- You must login to post comments
SciChart Expects Sorted X-Data
One of the underlying principles of SciChart is that data should be sorted in ascending order on the X-Axis. The reason for this is many of our users are rendering millions of points, and by far the most time is spent transforming data-points prior to render. Sorting in the X-Direction helps with this, as we can then use efficient binary search algorithms to find indices to data-points and can make several assumptions when resampling.
-
Versions 1.x and 2.x of Scichart will render and behave incorrectly
(bad rendering, glitches) if data is unsorted. -
Version 3.x will render correctly, but performance is greatly
enhanced if data is sorted in X.
Must Data always be sorted?
Actually, no. As of SciChart 3.0 you can have unsorted data in an XyDataSeries. SciChart will automatically detect the distribution of your data (Sorted, Unsorted, Evenly Spaced, Unevely Spaced, Scatter, Line) and apply the correct algorithms, meaning it should render correctly in all circumstances.
However, you will still get massive performance improvements if your data is sorted in the X direction.
What should you do if data arrives out of order?
That doesn’t help you if your data is arriving out of order you can’t append it to the end of the data series. Then, we have the ability to Update, Remove, Insert data via the XyDataSeries class.
DataSeries API Methods include:
You can also directly manipulate the data if you wish to trigger a redraw yourself. Note this does not recalculate flags such as what is the distribution of your data so be careful what you do!
Hope this helps!
- Andrew Burnett-Thompson answered 12 years ago
- last edited 10 years ago
- You must login to post comments
Please login first to submit.