Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
Reversing an axis
posted

I actually replied to this post:

http://forums.infragistics.com/forums/t/5073.aspx

 but I think the support team probably won't open that post.

 

Questions for David:  (Of course, answers from anyone are welcome.)

[Infragistics] David Negley:

"that is correct.  however, in WinForms and ASP.NET you could implement a custom solution for this using a custom layer or the FillSceneGraph event.  it would be tricky, but basically you can redo the labels on one axis, and resize/reposition the data in the chart layer.

another way to approach this would be to modify the data (multiply all the values by -1) and just use IRenderLabel to change the axis labels so it appears values on a reverse scale are being plotted."

====================================== 

Hi David,

 Great idea. I've implemented the second approach successfully.

My first thought was to reverse the x-axis RangeMin and RangeMax in FillSceneGraph event handler like this:

                            IAdvanceAxis xx = (IAdvanceAxis)ultraChart1.CompositeChart.ChartLayers[0].ChartLayer.Grid["X"];
                            double minPos = xx.MapMinimum - 10; //give more space to start/end of axis to avoid Icon trimming
                            double maxPos = xx.MapMaximum + 5;

                            //spatialTrendsChart.XAxis.RangeMin = (double)xx.MapInverse(minPos);
                            //spatialTrendsChart.XAxis.RangeMax = (double)xx.MapInverse(maxPos);
                            spatialTrendsChart.XAxis.RangeMin = (double)xx.MapInverse(maxPos);
                            spatialTrendsChart.XAxis.RangeMax = (double)xx.MapInverse(minPos);
                            spatialTrendsChart.XAxis.RangeType = AxisRangeType.Custom;

This does work for the chart: everything is horizontally mirrored. However, the axis labels are gone (not displayed).

  • What's actually causing this behavior?
  •  And if you don't mind, I'd appreciate if you could elaborate a bit on your first approach as well.

Cheers,

Jason