Skip to content

SP4: Need a good way to determine the latest dimensions #3002

@swharden

Description

@swharden

When resizing a ScottPlot 4 control, axis dimensions like Plot.XAxis.Dims reflect old data. This can be observed by quickly resizing a control and noting that the reported dimensions are always one render out of date.

This issue was originally noted by @dhgigisoave in #3000

Here's the code I'm using to test this

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();

        WpfPlot1.Plot.AddSignal(ScottPlot.DataGen.Sin(51));
        WpfPlot1.Plot.AddSignal(ScottPlot.DataGen.Cos(51));

        WpfPlot1.Refresh();
        WpfPlot1.Refresh();

        WpfPlot1.SizeChanged += (s, e) =>
        {
            Title = $"Actual={WpfPlot1.ActualWidth}, Reported={WpfPlot1.Plot.XAxis.Dims.FigureSizePx}";
        };
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions