Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF chart control exists by default or I have to do an external download?

I've been going through previous posts here and also some tutorial videos. It seems like the toolbox option has the chart control option since 4.0 and doesn't need any extra downloads.

But in my case, the tool box starts with Pointer, followed by some common WPF controls and then all the WPF controls such as button, canvas and so on. I don't see the chart control.

Read up that I may be missing an assembly reference. The reference seemed to be:

System.Windows.Control.dataVisualization.toolkit.dll

When I look up the list, I don't even have such a reference available to import. The closest I had was:

System.Web.DataVisualization

I imported it and it doesn't work too.

Please advice what am I missing. I am looking for chart control to start off and do some simple chart works on my current application. Thank you.

like image 608
kar Avatar asked Feb 20 '14 19:02

kar


1 Answers

I think this is what you are looking for : http://www.nuget.org/packages/WPFToolkit.DataVisualization/

<Window x:Class="drawtextonbitmap.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <chartingToolkit:Chart />
    </Grid>
</Window>

If you want it to appear in the ToolBox :

  • right click ToolBox -> Choose Items
  • click Browse
  • go to your project folder
  • open \packages\WPFToolkit.DataVisualization.3.5.50211.1\lib\System.Windows.Controls.DataVisualization.Toolkit.dll
  • press Ok
  • it will be on 'Common WPF controls' section

Make sure to install mentioned package before using the Package Manager Console : http://docs.nuget.org/docs/start-here/using-the-package-manager-console

PM> Install-Package WPFToolkit.DataVisualization
like image 113
aybe Avatar answered Sep 19 '22 00:09

aybe