2.9.x SChartCategoryAxis - Any way to set panning to the end of datapoints?


#1

Hello,

I have a year worth of data, of which I am setting the X-Axis with a Category chart displaying a range that contains a year of data from the current date, back a year. The chart renders fine but I wish to begin the chart at the end, which would be the current month. Then allow the user to scroll back to the beginning. Current behavior in version 2.9.x is such that you start at the beginning of the year of data then have to scroll forward to the end - which is the current month/time.

I found references to a “panTo”, isPanning, and others that are deprecated.

Thank you.


#2

Hi kball,

On all our axes you can set a defaultRange property, which is the initial range shown on an axis when the chart is initially been drawn or told to redraw. This can be set like so:

SChartNumberRange *range = [[SChartNumberRange alloc] initWithMinimum:min maximum:max]; xAxis.defaultRange = range;

Our SChartCategoryAxis is an SChartNumberAxis under the hood with specific features implemented (for example, tick marks always appear for each x-value it displays).

So you can still set the defaultRange but the min and max values you need to use are the indices of categories you wish to display from the SChartCategoryAxis’ categories array.

For example, if you have a category for each month of a year and want to display only the data between January to March your min value will be 0 and max value will be 2 (assuming January is your first data point and March is your third).

I would recommend switching your X-axis from SChartCategoryAxis to our SChartDataTimeAxis to display dates. As your feature request would be easier as you don’t need to think about indices and just provide the a min & max date you want your initial range to be.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.