2

For reasons that are not relevant, I am trying to display a series on a line plot where the X-Axis values are individual days. I am using an X-Axis of type SChartAxisTypeNumber in conjunction with a custom axis formatter to convert the day number (number of days from a fixed point in time) to a date string (11/9, 11/11, etc).

The behavior I am seeing is that the major tick labels are being sized based on the numeric value of the point rather than the string outputted by the formatter. This is resulting in my labels being truncated, i.e. the value for a point may be a single digit: 5 (for the fifth day) and results in a very narrow label that will not accommodate the date: 11/7.

This seems like a Shinobi bug, but I'm not sure if there is a workaround.

nickbona
  • 1,374
  • 1
  • 11
  • 23

1 Answers1

2

The SChartDelegate method sChart:longestLabelStringOnAxis: should be used to assist the chart in calculating tick label lengths. This is useful when you provide an implementation for sChart:alterTickMark:beforeAddingToAxis:

// Assist the chart in calculating tick label lengths
- (NSString *)sChart:(ShinobiChart *)chart longestLabelStringOnAxis:(SChartAxis *)axis {
    return @"#####";
}

For example, if you lengthen the tick label strings in alterTickMark, you should hint to the axis that extra room will be required by implementing this method.

cbartel
  • 1,298
  • 1
  • 11
  • 18