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
875
Keeping X-axis aligned with Y-Axis' 0
posted

I have a scatter chart that has several points on the negative side of the Y-Axis.  The X-axis shows up (like it always does for other charts) at the bottom of the chart (in this case aligned with the -100 value).  Is there a way to make the X-Axis appear aligned with 0 along the Y-Axis?  In this case, my Y-axis range goes from 80 to -100, so 0 is just above half-way up the Y axis. 

Parents
No Data
Reply
  • 7305
    Suggested Answer
    posted

    There is a way to display horizontal line on zero coordinate when you have the x axis on a different range; however; that line will not be considerred as an axis, because it simply is a line segment. Her is how you can draw a horizontal line segment on a zero coordinate using FillSceneGraph event (C#).

    private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
            {
                IAdvanceAxis x = (IAdvanceAxis)e.Grid["X"];
                IAdvanceAxis y = (IAdvanceAxis)e.Grid["Y"];
                if (x != null)
                {
                    int target = 0;
                    int yTarget = (int)y.Map(target);
                    int xStart = (int)x.Map(0);
                    int xEnd = (int)x.Map(5);
                    Line line = new Line(new Point(xStart, yTarget), new Point(xEnd, yTarget));
                    line.PE.Stroke = Color.Red;
                    line.PE.StrokeWidth = 3;
                    e.SceneGraph.Add(line);
                }
            }

Children
No Data