Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set X-Axis value Fix for X-Y line chart

Tags:

c#

charts

I can set the chart into the Excel but when I draw a chart using c# the X-Axis value is not have perfect gap.

like if i set

serie1.Points.AddXY(0.003247884, 16808.99);
serie1.Points.AddXY(0.006495768, 16794.35);
serie1.Points.AddXY(0.009743652, 16783.6);
serie1.Points.AddXY(0.012991540, 16767.22);
serie1.Points.AddXY(0.016239420, 16760.1);
serie1.Points.AddXY(0.019487300, 16748.68);
serie1.Points.AddXY(0.022735190, 16729.46);

I want X-serices 1.00000 , 2.00000 , 3.00000 , an so on...

in Excel the chart is enter image description here

but in C# desktop application

enter image description here

like image 346
ujjaval Avatar asked Feb 01 '26 04:02

ujjaval


1 Answers

To set the interval:

 chart1.ChartAreas[0].AxisX.Minimum = 0;
 chart1.ChartAreas[0].AxisX.Interval = 0.01; // Whatever you like

To "ignore" the X-Values and make them 1,2,3,4,etc.:

chart1.Series[0].IsXValueIndexed = true;
like image 144
DasKrümelmonster Avatar answered Feb 02 '26 17:02

DasKrümelmonster