Multiple series diagrams with WPFtoolkit

Do any of you know how to create multiple series diagrams using wpftoolkit? In short, what I want is to have more dependent values โ€‹โ€‹for the same independent value. So far, I have not been able to find any comprehensive mechanism to make this work. Any help is greatly appreciated.

+8
c # wpf silverlight-toolkit wpftoolkit
source share
4 answers

You might want to consider alternatives, from past experience, the charting components in the WPF Toolkit are extremely rigid and difficult to expand. I also had numerous problems with errors in the toolbox, and the active development seems to have completely stopped. There is a very good free alternative worth considering.

+6
source share

If you need a chart with two LineSeries

enter image description here

You can have two different lists in a .cs file with data:

 List<KeyValuePair<DateTime, int>> llistaGastats = new List<KeyValuePair<DateTime, int>>(); List<KeyValuePair<DateTime, int>> llistaPreu = new List<KeyValuePair<DateTime, int>>(); 

Then you need to create another list to group these two lists:

 var dataSourceList = new List<List<KeyValuePair<DateTime, int>>>(); dataSourceList.Add(llistaGastats); dataSourceList.Add(llistaPreu); 

And assign it a DataContext

 lineChart.DataContext = dataSourceList; 

In your .xaml file, you must create a Chart with two LineSeries and get the value of each line using the ItemSource field.

Here is the .xaml:

 <chartingToolkit:Chart Name="lineChart" Title="Consum KW" VerticalAlignment="Top" Margin="0,58,58,0" Height="382" Grid.Column="1"> <chartingToolkit:LineSeries Name="KWG" Title="KW Gastats" DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding [0]}" IsSelectionEnabled="True"/> <chartingToolkit:LineSeries Name="KWP" Title="Preu KW" DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding [1]}" IsSelectionEnabled="True" /> </chartingToolkit:Chart> 

ItemsSource="{Binding [0]}" Binds the first element of the list assigned by the DataContext. ItemsSource="{Binding [1]}" Binds the second

+20
source share

Beat Kiener has an excellent article on linking to Multi-Series Charts . In it, he implements his own MultiChart class derived from Chart .

It may be too late for you, but at least it can help others.

+2
source share

create a datatable with a column for each series, add five columns to the table (in the case of a bar chart and five series), with DependentValueBinding for each column name, set the ItemsSource to datatable (ItemsSource is the same for each column in the series).

Let me know if you want me to add the code.

+1
source share

All Articles