Pre loader

Getting estimated Chart Date from CategoryDateAxis to load historical data

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

2
1

I am implementing a feature to load more historical data when users pan to the left side on a CategoryDateAxis.
To load more, i need to have 2 Date which is the earliest data point i have and the Date that is shown on the X-Axis

For the earliest data point, i can get via IXyDataSeries#getXMin()
But for the other Date, i’m not sure how to get it. I can listen to range changes via IAxisCore#VisibleRangeChangeListener, but the range returns Double. I cant figure out to convert it into a Date

Version
1.2.0
Images
  • You must to post comments
1
0

Hi there,

We have an API to convert between Index and Date on the CategoryDateTimeAxis.

So the Axis itself has visiblerange which is an IndexRange. Take the min of this to get the min index.

Next, use code similar to this documentation article to do the conversion.

IAxis xAxis = new CategoryDateAxis(getActivity());

// get ICategoryLabelProvider to convert Date values to Indexes and vice versa
ICategoryLabelProvider categoryLabelProvider = (ICategoryLabelProvider)xAxis.getLabelProvider();

java.util.Date startDate = categoryLabelProvider.transformIndexToData(xAxis.getVisibleRange().getMin());

Let me know if that helps!

Best regards,
Andrew

  • Tang Chanrith
    Hi Andrew, How can I prepend history date to dataseries? every time I add data to data series it tell me “Data has been changed to a DataSeries which is unsorted in the X-Direction. Unsorted data can have severe performance implications in SciChart.”
  • Andrew Burnett-Thompson
    Hi Tang, if you use dataSeries.Insert you can pre-pend data to a dataseries. It is also possible to Append data unsorted. Simply set the dataSeries.setAcceptsUnsortedData(true). However, this comes with a performance warning.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.