Chayanin
Chayanin

Reputation: 311

Drawing line chart without lower and upper bound in c#

For example, I added xy points in Series1 with this code.

   //mock graph
   chart1.Series[0].Points.Clear();
   for (int i = 1; i < 10; i++)
   {
       chart1.Series[0].Points.AddXY(i, i);
   }
   chart1.Invalidate();

In short, my code adds 9 points from x=1 to x=9. Problem is the graph also shows x=0 and x=10 which I don't want. Anyone know how to fix this? Example

Upvotes: 0

Views: 109

Answers (1)

Chayanin
Chayanin

Reputation: 311

Found it myself. For anyone who has same problem.

In properties, select ChartAreas, select Axes. In Scale, set IsMarginVisible to false.

enter image description here

Upvotes: 2

Related Questions