简体   繁体   中英

how to plot a values from x axis value =0 in chart control?


how to plot a values from x=0 in chart control ?


In my chart control, values are plotting from x=1 , but I need to plot it from x=0
I am using visual studio 2010 and .net 4.0 version

chartArea1.AxisX.IsMarginVisible = false; 
chartArea1.AxisX.Minimum = 0D; 
chartArea1.InnerPlotPosition.Auto = false; 
chartArea1.InnerPlotPosition.Height = 72F; 
chartArea1.InnerPlotPosition.Width = 74F; 
chartArea1.InnerPlotPosition.X = 14F; 
chartArea1.InnerPlotPosition.Y = 7F; 
chartArea1.Name = "ChartArea1"; 
chartArea1.Position.Auto = false; 
chartArea1.Position.Height = 45F; 
chartArea1.Position.Width = 45F; 
chartArea1.Position.X = 1F; 
chartArea1.Position.Y = 10F; 

chart1.Series["x1"].ChartType = SeriesChartType.Point;

            for (int x = 0; x <= 15; x++)
            {
                chart1.Series["x1].Points.AddXY(x,l_oxvalues[x]);
            }
            chart1.Series["x1"].ChartArea = "ChartArea1";

the above code is plotting the values from x=1 , not starting from 0

Solved , the below line give us the solution
myChart.ChartAreas[0].AxisX.Minimum = 0;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM