Chart title positioning bug


#1

I have a line chart inside a UITableViewCell. The chart gets reused with the cells as I scroll through the table view. This results in a very weird positioning of the chart title label after couple of redraws, as demonstrated on the following screenshots:

http://postimg.org/image/j3hui2bf1/ - this is the correct position at the beginning

http://postimg.org/image/60lr9kfcl/

http://postimg.org/image/j7ljcv1b5/

http://postimg.org/image/6gjjm2xdv/

I set the chart.title in sChart:dataPointsForSeriesAtIndex:. As a side-note, I tried doing it in tableView:cellForRowAtIndexPath: and the result is even worse. Besides this I don’t do anything to chart.title or chart.titleLabel.

Any idea what’s going on and how to fix it?


#2

Problem solved. I was adding the chart as a subview multiple times in layoutSubviews.