Removing Data out of my time frame


I have data displayed in different time range, for example 1 month, 3 month, 6 months.

I’m using the below lines of code to not allow access to data out side of time range.

self.xAxis.allowPanningOutOfMaxRange = NO;
self.xAxis.allowPanningOutOfDefaultRange = NO;

Is it possible to completely remove the data outside of the range, that is data should not be visible outside of the range.
For ex: if i select 3 months, i should view 3 months data, and all other data points and data other than that should not be visible/ present.
Whereas now i have the data, but user cannot pann to the data outside of range.



Hi skr,

I’m not quite sure what you’re asking here. I presume this is related to How to Display a particular time period in my chart? and you’re using a segmented control to select the date range. What is the issue with the chart as it is now?

The alternative to changing the date range with the segmented control would be to alter your datasource so that it provides different data depending on the currently selected item. You would then need to call reloadData on the chart when the control’s selected value changed.

Kind regards,



I can explain that clearly in the images below.
I’ve added comments on the image to explain more clearly. First 2 images are my project, next 2 images are the one that i’ve taken as reference,

I’m looking to implement the graph as below.

I hope i could explain clearly what my issue is.
I’m able to display all the data perfectly, my issue is i want to hide/remove the data out of the time range making it not visible to the user, for better appearance.



Hi skr,

Do you want the user to be able to zoom in within the currently selected range? If so then you’ll need to do as I suggested above:

If you don’t want the user to be able to zoom in, then you could just disable panning and zooming on both axes.

I hope that helps.



I’m able to zoom in now, every thing is working fine with the data but i want the data out of my time span not to be present, when a particular time span is selected