SChartAxis method axisFrame returns the frame for the entire graph


#1

SChartAxis method axisFrame returns the frame for the entire graph and not just the axis. Steps to reproduce.

  1. fun the AppendData example from the 2.6 release of shinobi charts for ios

  2. set a breakpoint in the view controller line 55

  3. in lldb type po [self.chart.yAxis axisFrame]

4. hit run a few times, you’ll see the same result.  origin=(x=0, y=0) size=(width=728, height=954)

the y axis does not have a width of 728, it’s clearly much smaller.


#2

Hi foobar,

Thanks for this! We hadn’t seen this before, but we’ve filed a bug about it, and will update this thread when its fixed.


#3

It may just be a case that the API documentation here needs updating; the axis draws things like the grid lines and grid stripes across the entire chart, which would be within the bounds of axisFrame. The documentation just needs to mention these.


#4

Thanks tkelly. Can you recommend a way to know when a user has touched the axis (not the entire grid and gridlines, but the visible axis) ? For my product, they’d like to be able to touch the axis on the left to select one series or the axis on the right to select the second series.


#5

Hello TKelly,

just following up to see if there is a way to select an axis by touching it.


#6

Hi foobar,

You will need to implement your own UITapGestureRecognizer, and attach it to the chart, then decide if the tap was on the left or right side.

The space given on either side of the chart is:

(axis.style.lineWidth + axis.titleLabel.width + axis.style.majorTickStyle.lineLength + axis.style.majorTickStyle.tickGap + largest label width)

If you have some features turned off (such as axis titles, or tickmarks), then you won’t need to add these values.

Hope that helps!