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.
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!