LineSeries in Cartesian plot does not redraw correctly.

Aug 16, 2013 at 10:57 PM
This is a strange drawing issue with Cartesian type plots that I don't see with regular XY types.
Steps to reproduce,

1) Set the PlotType to Cartesian,
2) Re-size the main Window of your application to a very small horizontal width.
3) Now click on the top-right corner of your window to make it full-screen.

Result: The line series does not redraw in the plot area, and retains the previous small size.

This issue can also be seen in your ExampleBrowser application in the Cartesian axes examples. Any idea what might be causing this?

Thanks in advance for your help.
Aug 17, 2013 at 7:45 PM
I think the root of the problem is the requirement of being at the same scale, the X and Y axes. When you reduce the width, the X remains the same but the Y axis range is going up. When the width of the plot is zero the Y range should be infinity and there I think is the problem. This happens not only when you Maximize the window but even if you just resize manually.

To solve this you could associate the Window State Changed to a method that resets the axes.
void ResetAxes()
{
foreach (var axis in plotter.Axes)
{
axis.Reset();
}
}
Good luck
Oct 8, 2013 at 8:24 PM
Thanks for the response. I ended up resetting the axes, as you described ( my code is below). I do wish there was a way to detect the size change at the Model level though (that feels like a more reusable and maintainable solution).
<oxy:Plot Name="MyPlot" Model="{Binding MyPlot.Model}" SizeChanged="MyPlot_SizeChanged" />

private void MyPlot_SizeChanged(object sender, SizeChangedEventArgs e)
{
    var plotter = sender as Plot;
    var model = plotter.Model;
    if (!ReferenceEquals(model, null) && model.PlotType == PlotType.Cartesian)
        plotter.ResetAllAxes();
}
Dec 12, 2013 at 12:45 PM
If you don't mind modifying the OxyPlot source code, I have a fix for this problem. Go to the Issues section of this site and look for an issue entitled "Cartesian axes zoom in one direction only"
Coordinator
Dec 12, 2013 at 8:27 PM
thomasdr: thanks for the contribution! but I agree with you that it is a bit quick&dirty, so I am waiting for a simple&clean solution before merging this into the main branch!
The best solution would be to solve the 'cartesian axes' in a more general way, as described in https://oxyplot.codeplex.com/workitem/10095