Tooltip label attributed text


I would like the tooltip to display quite a bit of information. Currently it looks like;

"Tooltip 1

blah blah blah"

But I would like it to look like;

" Tooltip 1

blah blah blah"

I have trided to accomplish this by composing a NSAttributed string that has the correct formatting. However, even if I use the code below the text in the label comes up with default values. In fact, non of the attributed text formatting (fonts, colors, sizes) shows up. Does anyone know how I can do this?

label.text = attibutedString;
label.attributedText = attributedString;
[label setAttributedText:attributedString];


Can I ask where you are setting this attributed string? Every time the crosshair’s position is updated, the crosshair’s tooltip is updated to reflect this new positon. The method -sChart:crosshairMovedToXValue:andYValue: notifies you whenever your crosshair has changed position, so you could implement this method & change your text appropriately.

Another option, which offers a bit more encapsulation would be to subclass SChartToolTip and assign your subclass to your crosshair when you create your chart:

chart.crosshair.tooltip = [MyTooltipClass new];

You can find out about which methods you need to override in your subclass by reading the documentation for SChartTooltip and this blog post about tool tip customisation.

I hope the above helps.



Thanks for the reply Jan, sorry for getting back to this so late. I am using a custom tooltip and in the method

- (void)setDataPoint:(id<SChartData>)dataPoint fromSeries:(SChartSeries *)series fromChart:(ShinobiChart *)chart {

I am creating an attributed string and then setting label.text = myattributedstring.


Let me know if that should theoretically work, there may be something wrong with my implementation.


Hi Victor,

I also tried setting an attributed string in the -setDataPoint:fromSeries:fromChart: method and couldn’t get the attributed string to change. I’ve raised a task with our charts development team to look into this issue.

In the meanwhile, try setting your attributed string in the -setPosition: onCanvas: method, this worked for me.  :grin: