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
35
Chart Axis margins problem
posted

Zero margins

This is how my chart looks when I use "chart.Axis.X.Margin.Near.Value = 0;". I want to have a little space between the Y axis and the data column, so I put in "chart.Axis.X.Margin.Near.Value = 3;". Now my chart looks like this:

Borders = 3

I get the space between  the column and the Y-axis, but there is an undesirable gap in the X-axis.

 

Any suggestions for a resolution?

 

  • 28496
    Offline posted

             private void Chart_FillSceneGraph(object sender, FillSceneGraphEventArgs e)
            {
                Axis yAxis = e.Grid["Y"] as Axis;
                foreach (Primitive currentPrimitive in e.SceneGraph)
                {
                    Line l = currentPrimitive as Line;
                    if (l != null && l.p1.Y == l.p2.Y)
                    {
                        // this should be the x axis line
                        l.p1.X = yAxis.startPoint.X;
                    }

                }
            }

  • 739
    Offline posted

    I have the same problem.  In general I would like my columns to have the labels centered under them, and to have some space to the left of the first column.