none
winform chart x轴怎么从起点显示标签 RRS feed

全部回复

  • Hi,

    欢迎在MSDN论坛发帖。

    我这边使用下面的代码,x轴 不是从零起点开始的,你可以参考一下。

       chart1.Series[0].XValueType = ChartValueType.DateTime;
    
                DateTime x = new DateTime(2008, 11, 21);
                List<DateTime> dts = new List<DateTime>();
                for (int i = 0; i < 5; i++)
                {
                    dts.Add(x.AddDays(i));
                    chart1.Series[0].Points.AddXY(dts[i], i + 10);
                }   

    Best  Regards,

    Hart


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2018年2月5日 6:50
    版主
  • Hi,

    感谢你在MSDN论坛发帖。

    如果你的问题解决了,请及时标记有用的回复作为答案,这样会帮助遇到相同问题的人。

    Best Regards,

    Hart



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2018年3月2日 7:10
    版主