-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
Description
Issue: I displayed 11 charts with 7 milion points each. Every chart has shared x axis and locked y left axis. When I zoom charts, performance is increasing but when I zoom too much it's starting to decrease and memory usage starts to grow.
Reproducing:
Here is example code:
MainWindow.xaml.cs
namespace WpfApp2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
ShowCharts();
}
private void ShowCharts()
{
var list = new List<WpfPlotGL>();
for (int i = 0; i < 11; i++)
{
var values = Generate.RandomWalk(7016960);
var floatvalues = new float[values.Length];
for (var j = 0; j < values.Length; j++)
floatvalues[j] = (float)values[j];
var plot = new WpfPlotGL();
plot.Plot.Add.Signal(floatvalues, 256);
list.Add(plot);
}
foreach (var chart in list)
{
chart.Height = 200;
int controlNumber = 0;
while (controlNumber < list.Count)
{
int i = controlNumber;
if (chart != list[i])
{
chart.Plot.RenderManager.AxisLimitsChanged += (s, e) => { ApplyLayoutToOtherPlot(chart, list[i]); };
}
controlNumber++;
}
LockedVertical rule = new LockedVertical(chart.Plot.Axes.Left);
chart.Plot.Axes.Rules.Clear();
chart.Plot.Axes.Rules.Add(rule);
chart.Refresh();
this.charts.Children.Add(chart);
}
}
private void ApplyLayoutToOtherPlot(IPlotControl source, IPlotControl dest)
{
AxisLimits axesBefore = dest.Plot.Axes.GetLimits();
dest.Plot.Axes.SetLimitsX(source.Plot.Axes.GetLimits());
AxisLimits axesAfter = dest.Plot.Axes.GetLimits();
if (axesBefore != axesAfter)
{
dest.Refresh();
}
}
}
}MainWindow.xaml
<Window x:Class="WpfApp2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp2"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<ScrollViewer Grid.Column="0" Grid.Row="0" Grid.RowSpan="2">
<StackPanel x:Name="charts">
</StackPanel>
</ScrollViewer>
</Grid>
</Window>System Details
ScottPlot Version: 5.0.14-beta
Operating System: Windows 11
Application Type: WPF
.NET Version: .NET 7.0
Reactions are currently unavailable