gpt4 book ai didi

c# - 在列表框中显示Oxyplot图表的动态列表

转载 作者:行者123 更新时间:2023-12-03 10:44:49 24 4
gpt4 key购买 nike

在wpf应用程序中使用oxyplot显示图表时:

<oxy:PlotView Title="My Chart" Model="{Binding SomePlotModel}"></oxy:PlotView>

将显示图表。

但是,如果要在列表框中显示多个图表
<ListBox >
<ListBoxItem>
<oxy:PlotView Title="My Chart1" Model="{Binding SomePlotModel1}"></oxy:PlotView>
</ListBoxItem>
<ListBoxItem>
<oxy:PlotView Title="My Chart2" Model="{Binding SomePlotModel2}"></oxy:PlotView>
</ListBoxItem>
</ListBox>

图表将不会显示。为什么?如何使用Oxyplot显示动态图表列表?

最佳答案

宽度和高度! PlotBase的Oxyplot线583

((IPlotModel)this.ActualModel).Render(this.renderContext, this.canvas.ActualWidth, this.canvas.ActualHeight);

如果将图转储到ListBox中,则除非设置,否则图的 Canvas 的宽度和高度为零。
这在我的示例中有效:
<ListBox >
<ListBoxItem>
<oxy:PlotView Title="My Chart1" Model="{Binding SomePlotModel1}" Width="200" Height="200"></oxy:PlotView>
</ListBoxItem>
<ListBoxItem>
<oxy:PlotView Title="My Chart2" Model="{Binding SomePlotModel2}" Width="200" Height="200"></oxy:PlotView>
</ListBoxItem>

关于c# - 在列表框中显示Oxyplot图表的动态列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31460277/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com