我正在尝试将点动态添加到 a LineSeries
,但在使绘图无效后它不会显示。使用直接来自 NuGet 的最新 OxyPlot 版本 2014.1.301.1。如果我将 设置ItemSource
为新列表,它会起作用,但编辑 Items 属性什么也不做。
XAML:
<Window x:Class="SparrowTesting.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sparrow="http://sparrowtoolkit.codeplex.com/wpf"
xmlns:oxy="http://oxyplot.codeplex.com"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<oxy:Plot Title="OxyTest" x:Name="chart">
<oxy:Plot.Series>
<oxy:LineSeries></oxy:LineSeries>
</oxy:Plot.Series>
</oxy:Plot>
<Button Grid.Row="1" x:Name="button1" Click="button1_Click">
<TextBlock>GO</TextBlock>
</Button>
</Grid>
</Window>
代码:
chart.Series[0].Items.Add(new DataPoint(1, 2));
chart.InvalidatePlot(true);//Does nothing