iOS Chart Labels


#1

I have been trying out scenarios for complex charting using Shinobi. Its amazing to work with.

Currently am working on Column and Line Series where the labels are really making me scream!!! :frowning:

Lets say I have like 15 points for the space of iPhone, And I want to show all the labels. I have used range from -1 to 16. [The only way the labels wont be cut is when I add 1 unit on either sides]. Thus achieving some of the labels on my Range showing up. But the last number (16) though not in my range is always cut. This is worse in terms of DateTimeAxis. I have reduced my time to HH:mm but it doesnt always show all the data points on x-axis and 99% of the time the minimum and maximum value of the range is not shown. If you force it to show, its cut.

Please give me some insight on to figure this out.

Thanks,

Ish.


#2

Hi Ish,

Glad you are enjoying ShinobiCharts, but hope that you haven’t felt the need to scream just yet. :slight_smile:

Part of the issue is that our axes ensure that no tick labels ever overlap. There are a few things you can attempt to try and alleviate this:

  1. Take a look at the tickLabelClippingModeHigh/Low properties on SChartAxis. These can help you control when the axis decides to clip tick labels at its edges.
  2. The properties rangePaddingHigh/Low on SChartAxis help to control how much padding you would like in terms of data. This should allow you to adjust range padding without having to actually change your data to include larger/smaller values.
  3. Try reducing the font size of the labels. Smaller font size will result in smaller labels, which should reduce the chances that our axes will need to stop tick label overlap. Setting axis.style.majorTickStyle.labelFont should allow you to try this.
  4. If all else fails, the SChartDatasource method sChart:majorTickValuesForAxis: will allow you to specify exactly what values you would like displayed on your axes.

I hope one or a combination of these suggestions proves to be useful for your usecase.

Thanks

Ryan