简体   繁体   English

在C#中没有上限和下限的情况下绘制折线图

[英]Drawing line chart without lower and upper bound in c#

For example, I added xy points in Series1 with this code. 例如,我用此代码在Series1中添加了xy点。

   //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. 简而言之,我的代码从x = 1到x = 9加了9点。 Problem is the graph also shows x=0 and x=10 which I don't want. 问题是该图还显示了x = 0和x = 10,这是我不想要的。 Anyone know how to fix this? 有人知道怎么修这个东西吗? 例

Found it myself. 我自己找到了。 For anyone who has same problem. 对于有同样问题的任何人。

In properties, Select ChartAreas , Select Axes . 在属性中,选择ChartAreas然后选择“ 轴” In Scale , set IsMarginVisible to false. Scale中 ,将IsMarginVisible设置为false。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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