Control the x-axis last major tick label padding


#1

Hi,

I have just started to use shinobi chart control for iOS.

How do I control the x-axis last major tick label padding.

I my chart,  on x-axis the last tick label gets truncated, so instead of “400” only “4” is displayed. 

Any help will be appreciated.

Thanks

Prem


#2

Hi Prem - do you think you could provide a picture of your issue?

It sounds like you might want to change your tickLabelClippingModeHigh property:

chart.xAxis.tickLabelClippingModeHigh = SChartTickLabelClippingModeTicksAndLabelsPersist;

Check out the  documentation of that property for more details.

Jan


#3

Hello,

Thank you very much for your reponse. I have embedded the screen shot image.

Already I have set tickLabelClippingModeHigh property as specified by you. But still the label extends to another region. How to specifiy sort of padding at the end for x-axis?

I have few more questions regarding the chart,

  1. How do I disable bouncing out of data range. In the current example data range is from 1-80. But when x-axis gesture panning is enabled, x-axis displays values outside the range, even though I have set  xAxis.allowPanningOutOfDefaultRange = FALSE.

2.How to make y-axis display from 0.

Thanks & regards

Prem


#4

Hi Prem,

To disable bouncing out of the data range, you can set the animationEdgeBouncing property on the axis to NO.

I’m just taking a look at the other issues you raised, I’ll get back to you on those.

Many thanks,

Dan


#5

In order to make the y-axis display from 0, the best approach is probably to implement one of the chart delegate methods. If you implement the sChartDidFinishLoadingData: method, as below, you will set the correct range on the chart once it has loaded its data:

- (void)sChartDidFinishLoadingData:(ShinobiChart *)chart {
    [chart.yAxis setRangeWithMinimum:@0 andMaximum:chart.yAxis.axisRange.maximum];
}

One case where this approach could fall down is if you have set double taps on the chart to reset the zoom. In that case, the chart will reset its zoom to cover just the data range. If this is the case for you, let me know, and we can look at the best approach to take in this case.

We’re just looking at the axis padding issue now.

Many thanks,

Dan


#6

Already I have set tickLabelClippingModeHigh property as specified by you. But still the label extends to another region. How to specifiy sort of padding at the end for x-axis

Setting tickLabelClippingModeHigh works for me on our sample app, are you setting it after you have created and assigned the axis? To make more space for the labels you could use the rangePaddingHigh. 

If you could post the code where you set the properties I can take a look what the issue might be.