How to set zoom level and x axis data


I have more than 2000 records and when i am binding with datasource its plotting  very close to each other .Thus  all x axis label over riding each other.

How to set zoom and slide according.

Does anyone knows whoc to do that?



Have you tried setting the majorTickFrequency on your X axis? This should give you control over exactly how often your tick marks are placed. Set them to be less frequent to stop them overlapping.




many thnx jan but seems it is not working.

just tell me how to do this using range selector.

i need each and every step, i am getting date  in unix timestamp and values in flot.

Please do the needfull help asap.


I dont quite understand what you mean when you say ‘using range selector’, are your lables still overlapping?

Perhaps a picture of what you have, and a picture/sketch of what you want, will help me see the problem.


ok please add me on skype or gmail.

Skype Name:-nirmit.pathak

SO we can talk and see what i am facing exactly.


Hi Nirmit,

We don’t directly contact customers who are posting questions on the forum. It would be better if we could get to the root of your problem here so other forum user’s can benefit from any solutions anyone has to contribute :smile:.



Hi guys, I would like to know how this problem solved.

I have same problem with x axes.

And another question is - whenever I call redrawchart, I loose the current zooming, how can I avoid such behaviour (i.e not loose zooming) ?

Thanks in advance.



Hi guys, I would like to know how this problem solved.

I have same problem with x axes.

And another question is - whenever I call redrawchart, I loose the current zooming, how can I avoid such behaviour (i.e not loose zooming) ?

Thanks in advance.

I’m also interested in this. Did anybody find a convenient solution?


Hi Guysm

I’m not sure exactly what problem you’re all having. It seems as though you’re having problems with your tick labels overlapping? Tick labels have their frequency (spacing) automatically calculated so that they don’t overlap (except category axes). If you want to modify the tick frequency (spacing) then you need to set a different majorTickFrequency on your axis.

If I’m misunderstanding your problem then could you please respond with a little more information?

With regards to your redrawing question, setting autoCalculateAxisRanges to NO will cause the axes to keep the same range after a reload & redraw.



I have a similar question. I want to be able to set the zoom level. I have a large data set and I dont want the user to see all of it at once. I would like to be able to set the zoom level and allow the user to pan through the data.


Thx Jan for your explanation concerning the zoom level. My x axis is a DateTimeAxis. For instance, you have a range about 10 years and you want to plot week-sized bins. So you have to draw 480 bins with their ticks. Suppose I set the majorTickFrequency to one month to bi aligned to the number of bins, the ticks on the screen are so close to each other that it looks like one huge horizontal line.

@ryanb have also a look at


Hi Mahatma_Fatal_error:

I suppose I’m not fully clear on what you mean by bins? If you set your tick frequency to an interval of 1 month over a 10 year time span, you’re going to have 120 tick marks displayed (1 month * 10 years). Obviously there’s not really a way to stop the tick marks overlapping with that set up. Instead, you’d want to set your tick frequency to be less frequent, once per year perhaps?

I think I’m misunderstanding what you mean by ‘bins’ and the ticks being ‘bi-aligned to the number of bins’. If you could elaborate on that a little bit more, perhaps by posting a screenshot?

Hi ryanb:
Would you mind starting a new forum thread with your question and adding a little more information about your use case? This one thread has already diverged a little bit from the original topic!  :laughing:



Hi Jan,

sorry I’m not a native speaker. With bin I mean a bar in a bar chart. In Shinobi speak a data point in a SChartColumnSeries. 

The root cause of the problem is that I want to limit the number of majorticks to the number of bars plotted in the canvas.

I have year sized bars on a datetime x axis. Depending on the overall range some bars have a majortick. For example in a 20 year range every 5th year has a majortick. When I zoom in horizontally so that the range is 5 years every bar has a tickmark. When I now zoom in even further shinobi draws more majorticks so that every bar has several majorticks which makes logically no sense. How can I avoid that behavior that the auto-tick-calculation draws more ticks than bars (in shinobi speak data points) when I zoom in? 

This is what I meant with tick frequency to be aligned with the number of bars. More technically the constraint I need is that every data point has exactly one or no corresponding majortick, depending on the zoom level. But each bar must not have more than one tick.

Is it possible to give the auto-tick-calculation algorithm that kind of constraint? 


Hi Mahatma_

I think I understand your requirement. Take a look at the SChartDelegate method sChart:setMajorTickFrequency:andMinorTickFrequency:onGeneratingTickMarksforAxis:. This method is called before we calculate the tick frequency for each individual zoom level, and it’s here that you want to implement your algorithm. Essentially what you’re looking to do is take your axis range and calculate a sensible major tick frequency that’s never results in more ticks that the number of bars

I hope that helps!



Hi Jan,

thanks for your help. I have overwritten this delegate method in my code. Unfortunately I’m not sure about the responsibilty of this delegate method. Is it possible to only manipulate the x axis tick frequency and let the y axis frequency untouched so that the auto calculation works as usual at least for the y axis? In my case I only want to set the constraint mentioned above on the x axis and leave the y axis calculation as it is.

Or do I need to calculate the frequency in this method all by myself ?

In particular I want to check if the auto-calculated x-axis-tick-frequency contains months when the bars only contain years. (I already know this information about the temporal bar size) If this is the case, I want to set month of the date frequency to 0.

Does this make sense in your eyes?


Hi Mahatma,

Off the top of my head, I think implementing that delegate method gives you full control of you axes tick marks, for both axes. (You could try returning nil for one axis to see if the chart still auto-calculates.) You do have some more options though:

  • You can implement the sChart:MajorTickValuesForAxis: which gives you another way to provide specific tick marks for an axis. I’m pretty sure returning nil from this method causes the tick marks to still be auto-calculated, but I haven’t looked into it deeply.
  • You could use an SChartCategoryAxis rather than a date time axis. If you’re showing regular intervals, like years, etc, then having a date time axis doesn’t really add much meaning to your chart. Using a category axis means that your chart will always display a tick mark for each category, so you could then implement the alterTicks: delegate method to hide tick marks if they get too close together.

I hope the above makes sense.

Jan Akerman


Did this query get resolved ? I too have a requirement where  I want to slide through my x-axis so that the entire x-axis is not displayed within a single screen


Hi Sim777,

I think this forum thread was aimed at answering questions relating to tick mark frequency & overlapping, although the thread title is a little misleading. It would probably be better to start a new thread explaining your problem in detail, and maybe providing some screen shots.



Hi Jan,

I have created a new topic -

Basically its a very simple requirement but I am unable to narrow down to a documentation that would help me out. Hope to hear from you soon


Awesome - thanks. I’ve taken a look and responded. Hope it helps.