skip to Main Content

I have downloaded the Charting with Data Visualization Toolkit from Nuget, DotNetProjects.WpfToolkit.DataVisualization in Visual Studio 2019 Pro.

The articles that I have found instruct loading the System.Windows.Controls.DataVisualization reference.Cant not find it???

I can find DotNetProjects.Controls.DataVisualization.Toolkit, but any example adding Charts to my XAML code fail.This is what I am trying, unsuccessfully however….

xmlns:dvc="clr-namespace:DotNetProjects.DataVisualization.Toolkit;assembly=DotNetProjects.DataVisualization.Toolkit"

        <TabItem Header=" Chart">
            <dvc:Chart Name="MyChart" Width="400" Height="250" Background="YellowGreen">
            </dvc:Chart>
        </TabItem >

2

Answers


  1. Chosen as BEST ANSWER
        xmlns:lrm="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=DotNetProjects.DataVisualization.Toolkit"
    

    <lrm:Chart x:Name="myChart" Width="500" Height=" 500" Title="Gary"/>


  2.    PointCollection pc = new PointCollection();
    
        for (int i = 0; i < 100; i++)
        {
            pc.Add(new System.Windows.Point { X = i, Y = i * 2 });
        }
    
        LineSeries series1 = new LineSeries();
        series1.DependentValuePath = "Y";
        series1.IndependentValuePath = "X";
        series1.ItemsSource = pc;
        chart1.Series.Add(series1);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search