Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to make a line chart in wpf

$
0
0

Hi All,

I am working on a WPF project based on .Net 3.5, there is a line chart in this project as the follow:

I find WPF Toolkit is a free control for chart in wpf, so I write code as the follow:

xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" 
             xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10" Grid.Column="1" Grid.Row="0"><charting:Chart x:Name="waitingtasks" BorderBrush="Transparent" BorderThickness="0" VerticalAlignment="Stretch" Title="Waiting Tasks"><charting:Chart.TitleStyle><Style TargetType="datavis:Title"><Setter Property="HorizontalAlignment" Value="Left"/><Setter Property="Foreground" Value="White"/></Style></charting:Chart.TitleStyle><charting:Chart.LegendStyle><Style TargetType="datavis:Legend"><Setter Property="Width" Value="0" /></Style></charting:Chart.LegendStyle><charting:Chart.Axes><charting:LinearAxis Orientation="X" Title="Time" Interval="20" ShowGridLines="False"/><charting:LinearAxis Title="Number of Waiting Tasks" Orientation="Y" Interval="5" ShowGridLines="False"/></charting:Chart.Axes><charting:LineSeries DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding}" IsSelectionEnabled="True" 
                                    AnimationSequence="FirstToLast"/></charting:Chart>

But I get an error:

Could not load file or assembly 'WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

It's very wired. Nothing to do with WPFToolkit assembly. 

Any idea? or Is there other free controls for chart in wpf?

Thanks.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>