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
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!
Please login first to submit.