ujjaval
ujjaval

Reputation: 1533

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

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

Upvotes: 3

Views: 11124

Answers (2)

Sunil Urs
Sunil Urs

Reputation: 358

Did you mean the axis intervals should increment by 1?.. Set the AxisX interval to 1

chart1.ChartAreas[0].AxisX.Minimum = 0;    
chart1.ChartAreas[0].AxisX.Interval = 1;

Upvotes: 0

DasKrümelmonster
DasKrümelmonster

Reputation: 6060

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;

Upvotes: 2

Related Questions