Second xAxis not scrolling with graph


#1

I want my graph to display x values along the top and bottom. I added a second xAxis to my graph with the same datarange as my first xAxis.


axis2.axisPosition = SChartAxisPositionReverse;
chart.xAxis = axis1;
[chart addAxis:axis2];
…The problem is that when I pan the graph, only axis1 moves. Axis2 looks like it moves but snaps back to its original position as soon as I let go.
What am I missing?

Thank you


#2

so what I’m trying to accomplish is to have one data series and duplicate x-axis on the top and bottom.  They should both scroll according to the touch input but it seems only the primary x-axis gets scrolled.

The developers should know about this issue. or at least be able to answer?


#3

I have the same issue. Anyone?


#4

so a developer cannot answer this?  not even to say it’s a bug?
great impression for customer support.


#5

Hello miscuser,

Sorry for the delay in response - due to the grids release we have been quite busy and have been helping Care Plus support customers as a priority. 

Axes size themselves automatically when a data-series is added to them. Since you are not adding the data-series to your secondary axis its default range is not calculated the same as the primary axis, which is why you are seeing your secondary axis bounce but not scroll. There are two ways to get the effect you are looking for:

  1. You can add the same data-series to your chart’s secondary axis, and set the series’ hidden property to YES. This will give the seconday series the same scrolling behaviour as the primary series. There is the obvious trade-off, in that you have twice the amount of data, but I wouldn’t worry about this unless you have huge amounts of data.

  2. If you do have huge amounts of data, and plotting two series of the same data is causing performance problems for you, you add a series to your seconday axis which consists of two points. These first data-point would be your primary axis’ minimum X and Y values, and the second data-point would be its maximum X and Y values. This works in the same way that method 1) does, but requires less data points on your chart.

  3. You can handle the panning manually in your chart’s delegate. When your primary axis is panned or zoomed, you can update the range on your chart’s seconday axis manually by setting the range then calling a [chart redrawChart]. As the chart’s redraw is lighting fast, this method may sound CPU heavy, but infact works very well.

Hopefully, you find one of the three methods stated above suited to your needs. Please let me know how you get on.

Thanks,
Jan


#6

YES!  Jan, thank you for your help! I really appreciate it!