Subclassing SChartTickMark


#1

I’d like to be able to subclass SChartTickMark so that I can customize the label more performantly without Shinobi setting the font initially then me having to set it again in the delegate callback, -sChart:alterTickMark:beforeAddingToAxis:. It seems like the class is built for subclassing, yet I don’t see a way of being able to change which class is instantiated during automatic tick mark creation.

Is this possible?

Edit: I’ve just put things in a category and disabled the default tick labels for now. This seems to work okay, except for the fact that it seems like I can’t customize the height of the tick mark. Any way around this?


#2

Hi jwilling,

That’s a cool idea - I’m afraid we currently don’t support subclassing of SChartTickMark as we create instances of it internally, however it could prove a nice alternative to delegation.

Regarding tick mark height - this is currently calculated from the tick label font’s maximum height. You could override -sizeTickLabels on an axis like so:

- (CGSize)sizeTickLabels
{
	CGSize defaultSz = [super sizeTickLabels];
	defaultSz.height = yourHeight;
	return defaultSz;
}

Hope this helps!

Rob