Search code examples
c#winformsgraphchartsoxyplot

Oxyplot C# Win Forms - Spreading out data on x axis


I'm plotting relatively large amounts of data (~ 1 million points). The plot is working fine, but it seems that it is forcing all of the points within the viewable window despite default scrolling being enabled.

Any way to make it more readable? E.g. to spread the points out on the x axis. Perhaps zooming? I've looked a while and am rather lost.


Solution

  • You can add the following lines to enable the zooming function.

    chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
    chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
    chart1.ChartAreas[0].CursorY.IsUserEnabled = true;
    chart1.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
    

    You can certainly choose to zoom only one of the axis.

    chart1.ChartAreas[0].AxisX.ScaleView.Zoom(0d, 200d);