Search code examples
iosobjective-cchartsshinobi

Shinobi Charts iOS - Rotate Pie Chart by code


I am displaying pie chart and drawing labels outside of chart itself. Sometimes I must display odd data, that one point takes up 90% of chart so the rest must "mash up" into remaining 10% of the chart. Everything is okay, but the labels (slice names) are also "mashing up". So I implemented mechanism that "sorts out" those labels not to collide with each other. Now I have a "word cloud" above my chart, since the biggest slice is always facing down, leaving all other slices facing up. That is my problem: I want to rotate the chart so that the biggest value data point would be facing left (leaving me right side of chart for labels).

So my question is:
How I could rotate pie chart around its center by code?

And rotating whole chart view is not an option since labels must remain horizontal.


Solution

  • So i found the solution myself:

    you can use this code:

    [(SChartDonutSeries*)[[chart series] firstObject] setRotation:-1.570];
    

    To rotate first (the only in my case) DonutSerie by approx -90 degrees with this line of code. I use it in this delegate method:

    sChartRenderFinished