如何在 WPF Toolkit 折线图中交换轴?
如何交换 WPF 工具包折线图中的轴?我有以下 xaml:
<chartingToolkit:Chart Name="lineChart" Title="Line Series Demo" Margin="0,0,0,0">
<chartingToolkit:LineSeries DependentValuePath="Key" IndependentValuePath="Value" ItemsSource="{Binding}" IsSelectionEnabled="True" />
</chartingToolkit:Chart>
从属值始终显示为 Y 轴。我需要它们作为 X 轴。这可以通过 WPF Toolkit 图表实现吗?如果我无法使用 WPF Toolkit 执行此操作,是否可以使用其他免费的 WPF 图表库?我所需要的只是能够处理 X 轴上的时间和 Y 轴上的字符串的多个系列的折线图。
How does one swap the axes in a WPF Toolkit line chart? I have the following xaml:
<chartingToolkit:Chart Name="lineChart" Title="Line Series Demo" Margin="0,0,0,0">
<chartingToolkit:LineSeries DependentValuePath="Key" IndependentValuePath="Value" ItemsSource="{Binding}" IsSelectionEnabled="True" />
</chartingToolkit:Chart>
The dependent values always appear as the Y-axis. I need them as the X-axis. Is this possible with WPF Toolkit charts? If I can't do this with WPF Toolkit, are there other free WPF charting libraries I can use instead? All I need is line chart that can handle multiple series with time on X-Axis and Strings on Y-Axis.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在尝试使用原始 WPF 工具包找到问题的答案失败后,我决定自己编辑图表工具包源代码。以下是我为了使其正常工作而所做的更改:(
显示源代码更改,要查看原始源代码,请在编辑之前查看原始帖子)
获取源代码。我正在使用 VS2010,因为一些组件
从WPF Toolkit已经成为.NET4的一部分,我不得不修改WPF
工具包解决方案。值得庆幸的是,这些跑腿工作已经为我完成了。
此处获取源代码
将 LineSeries.cs:115 更改为
将 LineAreaBaseSeries.cs:243 更改为
LineAreaBaseSeries.cs:298 更改为
在这些更改之后,您可以使用依赖的字符串源。
干杯!
After unsuccessfully trying to find an answer to my problem with the original WPF Toolkit, I decided to edit the Charting toolkit source myself. Here are the changes that I did in order to get it working:
(Showing source code changes, to see original source, look at the original post prior to edit)
Get the source. I am using VS2010 and since some of the components
from WPF Toolkit have become a part of .NET4, I had to modify WPF
Toolkit solution. Thankfully, that legwork was already done for me.
Get the source here
Change LineSeries.cs:115 To
Change LineAreaBaseSeries.cs:243 To
Change LineAreaBaseSeries.cs:298 To
After these changes you can use a dependent source of strings.
Cheers!