The alterTickMark:
method on SChartDelegate
allows you to modify a tickMark
(and its corresponding tickLabel
) before they are added to the axis.
You could potentially check the axisRange
in this step, and decide if the range.span
is small enough that you could display labels truncated or in full.
E.g.
-(void)sChart:(ShinobiChart *)chart alterTickMark:(SChartTickMark *)tickMark beforeAddingToAxis:(SChartAxis *)axis
{
if (!axis.isXAxis)
return;
if ([axis.axisRange.span doubleValue] > 5)
{
NSString *shortText = [tickMark.tickLabel.text substringToIndex:3];
tickMark.tickLabel.text = [NSString stringWithFormat:@"%@...", shortText];
//Resize, but maintain centering
CGPoint center = tickMark.tickLabel.center;
[tickMark.tickLabel sizeToFit];
tickMark.tickLabel.center = center;
}
}
As full disclosure, I work for ShinobiControls.