Crosshair with custom behaviour, custom Tick on xAxis, drawing elements on the chart


#1

HI,
Currently I am trying out the ShinobiCharts. I am hoping that they will meet the requirements for the App the company I work at is making.
In this app there has to be the possibility to track the curves in the chart. I have some questions:

  1. Can i add a custom tick on the xAxis that marks the selected point onto it( something like the line from the crosshair but with a label with the value on the axis)? I recall a chart made with ShinobiCharts online somewhere with that functionality but just can’t find it in the API (EDIT: Found it in your ShinobiPlay App -> ShinobiExpierience -> on the “impress” view on the Y axis - right to it is the value in a black tag and there is a line also - how can this TAG be achieved?).

  2. The crosshair seems to draw a handy “target circle”. Can I draw those circles on demand at a given chart point?

  3. The crosshair seems to be a thing we want… well almoust. It should draw those targets on a couple of the curves and track them along the drawn series (not just one). Can that be done?

  4. Amongst that can the crosshair behaviour be overrided - so that it will be movable only when te first long tap is made and after that the chart is pannable again. The crosshair can be then dragged again after another long tap.

Will be grateful for any help.
Thanks in advance.


#2

Hi okipol!

Thanks for asking - there’s a few ways for custom tick labels - the best place to look would be under SChartAnnotation - you can add annotations to the chart at data positions, and set clipToBounds to NO, which should let them move onto the axes.

For drawing circles at arbitrary points, you could again use annotations, overriding their drawRect method in a subclass and drawing a circle using CoreGraphics. Our crosshair draws using a similar technique.

For your third question, we currently only support tracking a single series with the crosshair, so if you wanted to draw circle targets on multiple curves, you would have to do this manually in a crosshair subclass, I’m afraid. This is a feature we have on our roadmap, however I can’t give you any solid dates for this yet.

And finally, yes - you can override the -crosshairShouldKeepTracking method on SChartCrosshair and return false. This will prevent the crosshair from tracking once you start panning.

I hope this helps! Let me know if you have any other questions.

Best regards,

Rob