Skip to content

User Controls: MultiPlot implementation issue prevents rendering (bug introduced in 5.0.48) #4666

@zygfrydw

Description

@zygfrydw

Issue: (Describe the bug here)
The interactions do not work for WPF plots. I have tried it with the WPF demo sample and I cannot use any interaction (Open context menu, drag itp)
ScottPlot Version: 5.0.48

The version I used to debug the problem
Step 1. Edit ScottPlot5\ScottPlot5 Demos\ScottPlot5 WPF Demo\DemoWindows\Quickstart.xaml.cs

    public Quickstart()
    {
        InitializeComponent();

        WpfPlot1.Plot.Add.Signal(ScottPlot.Generate.Sin());
        WpfPlot1.Plot.Add.Signal(ScottPlot.Generate.Cos());

        WpfPlot1.UserInputProcessor.Reset();

        WpfPlot1.Menu?.Reset();
        WpfPlot1.Menu?.Add("Option", control => { });
        WpfPlot1.UserInputProcessor.UserActionResponses.Clear();
        WpfPlot1.UserInputProcessor.UserActionResponses.Add(
            new SingleClickContextMenu(StandardMouseButtons.Right));
    }

When I attached the debugger I noticed that the SingleClickResponse.Execute method is exiting because Plot? plot = plotControl.GetPlotAtPixel(buttonAction.Pixel); is null
image

and the plot is null because the LastRenderRect for Multiplot.cs is NaN
image

The LastRenderRect is NaN because the only place where I have found LastRenderRect assignment is Render method
image

And there is only Render invocation in FormsPlot.cs, the WpfPlotBase does not call render function and it seams to be rendering plots in a different way.
image

I am unfamiliar with ScottPlot code base, so I don't know the correct solution for this problem. Should the Render method be also called for Wpf library?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions