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
615
Line Chart Fill Scene Graph
posted

I am trying to draw a line at y = 20, using some sample code I saw for a bar chart, however, e.Grid["X"] is always null. 

How do I solve this?

void DrawLimitLines(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)

{

//gets the X and Y axis

IAdvanceAxis x = (IAdvanceAxis)e.Grid["X"];

IAdvanceAxis y = (IAdvanceAxis)e.Grid["Y"];

//checks if axis exist

if (x != null)

{

//figures out the coordinate to draw

//a line at y=100

int target = 20;

int yVal = (int)y.Map(target);

int xStart = (int)x.Map(0);

int xEnd = (int)x.Map(50);

Line l = new Line(new Point(xStart, yVal), new Point(xEnd, yVal));l.PE.Stroke = Color.Red;

e.SceneGraph.Add(l);

}

}

#endregion

Parents
  • 28496
    Offline posted

     if you're using a Composite Chart, you might need to reference the axes using an expression like

    this.ultraChart1.CompositeChart.ChartLayers[0].ChartLayer.Grid["X"]

Reply Children