Chart in winform displaying wrong Point

后端 未结 2 1657
孤独总比滥情好
孤独总比滥情好 2021-01-21 17:27

I have the following code. I have hardcoded the x and y values to test. And for some reason for the point (0,-0.5) it plots (1,-0.5) For the life of me I do not know what is goi

2条回答
  •  我在风中等你
    2021-01-21 18:17

    This is really weird! Looks like a very hard to believe bug. I played around but can only confirm that there seems to be no way to set a single Point to position 0 in a Series.

    Here is a silly workaround:

    S1.ChartType = SeriesChartType.Point;
    
    for (int i=0; i < 2; i++)
    {
        DataPoint point = new DataPoint();
        point.SetValueXY(i, -0.5);
        if (i > 0) point.Color = Color.Transparent;
        S1.Points.Add(point);
    }
    

    I wish I knew what this is about - Chart is so ill-documented there might still be some system to the madness..

    Update: When you add a Timer and let its Tick remove the transparent 2nd Point, you can see how the 1st Point jumps from 0 to 1. So weird..

提交回复
热议问题