Annotations! Y-axis!


#1

Hello.
We want do to annotation like this on the picture. There is link on example http://iwantmyreal.name/blog/2013/01/11/building-a-range-selector-with-shinobi-charts-part-i-linking-2-charts/
But the final result is:

So, the question is - is it possible to do annotation like on 1-st picture? And if YES - how can we do it?
We need annotation left on the Y-axis, not on the graph view 
Thank you.


#2

Hi Artsiom,

Yes it is possible!

That marker isn’t actually a part of the ShinobiChart. It’s a simple UIView thats been styled and positioned above the Y-axis and updates its position when the chart is panning or zooming. 

To position the marker correctly you need to know the SChartDataPoint you want the marker’s to show and your charts Y-axis X-position.

Once you have theSChartDataPoint you want to show, you can convert that datapoint’s Y-axis value to a Y-position value to place your marker using the following SChartAxis method:

- (double)mapPixelValueForDataValue:(double)dataValue usingSeries:(SChartSeries *)series;

To get the X-position for your marker you can use your charts frame. If your axis is on the right of the chart (as seen in the impress chart) use the following code:

double xPixelValue = chart.canvas.glView.frame.origin.x + chart.canvas.glView.frame.size.width;

If the Y-axis is on the left side of your chart you can just use your charts glView frame X value and subtract the width of your marker view.

That should give you the information you need to place a UIView on top of your Y-axis.

Kind Regards,
Andrew Polkinghorn