Zooming to change Scale



I am using LineSeries Chart to display some data, Data is distributed over time period of around 3-4 years I want to implement a feature to change the scale for example,

Currenly I am displaying 1 years data if user zoomout I have to change scale from 1 year to to year and if user zoomin I have to change the scale from 1 year to 6 momtns.



Hi Lakshaya,

Our API has all the building blocks you need to get this to work, you just need to put them together. There are a number of ways you could do this, here’s one:

  1. Set your chart’s autoCalculateAxisRanges property to NO. This will stop your chart resetting the axis ranges to perfectly fit the new data.
  2. Hook into your chart’s zooming delegate methods and call reloadData and redrawChart when the chart has reached your desired zoom level.

Instead of reloading data into your chart, you might find that it’s easier to load all of the data into your chart in the form of two seperate series, and use the delegate methods as described above to show and hide the series using the SChartSeries’ hidden property:

// Set the first series in the chart as hidden.
[self.chart.series[0] setHidden:YES];

// Redraw the chart to take effect.
[self.chart redrawChart];


I hope the above has given you enough information to get started!

Best regards,
Jan Akerman