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
How to access Axes from FillSceneGraph(SceneGraph Scene)


I have a composite chart containing serveral barcharts. I want to add a vertical line at a certain position of the x-axis. It should be possible to add/remove this line with a button. Since I also want to display/hide other primitives, I figured the best way would be to implement a custom layer that implements the ILayer interface.

My problem is now, that I cannot access the x-axis from within the FillSceneGraph event, since I don't get the FillSceneGraphEventArgs in this event handler. I would like to use the map function of the axis to get the position at which to draw the line.

Is there any way to access the axis or is there another way to do this?

Any help is appreciated!


  • 110

    I alredy tried:

    IAdvanceAxis AxisX = this.Grid["X"] as IAdvanceAxis;


    ILayer GridLayer = _ChartCore.GetGridLayer();
    IAdvanceAxis AxisX = GridLayer.Grid["X"] as IAdvanceAxis;

    but both ways did not work, any ideas??

  • 26458
    Verified Answer
    Offline posted

    You're better off handling FillSceneGraph event of the chart control. This event eliminated the need to implement ILayer. When dealing with composite charts, you need to get the Grid hashtable directly from the composite layer, like this:

    Hashtable grid = ultraChart1.CompositeChart.ChartLayers[index].ChartLayer.Grid

    You'll see that the grid contains two axes used by the layer. Then, you can cast them as IAdvanceAxis and use the mapping functions. With the ILayer, you don't get the reference to your chart control, but you can easily supply that reference, since it's your own custom class.

    Hope this makes sense.