bonjour tous le mande,

je vien d'essayer d'utiliser mancoChart For wpf, et voila le code que j ai fais

Code C# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Manco.Chart;
using Manco.Chart.Data;

namespace WpfMancoChart
{
    public partial class Page1 : Page
    {
        public Page1()
        {
            
                InitializeComponent();
           
        }
        public ChartControl m_ChartControl;
        private void button1_Click(object sender, RoutedEventArgs e)
        {       
            int liCategoryCount = 2;    // Set desirable number of the categories
            int liSeriesCount = 2;        // Set desirable number of the series

            // Declare array of doubles
            double[,] ldaData = new double[liCategoryCount, liSeriesCount];

            double ldMin = 0;
            double ldMax = 40;
            // Fill array with data here
            Random rnd = new Random();
            for (int i = 0; i < liCategoryCount; i++)
            {
                for (int j = 0; j < liSeriesCount; j++)
                {
                    ldaData[i, j] = ldMin + (ldMax - ldMin) * rnd.NextDouble();
                    if (j != 3)
                    {
                        // Data with regular scale [0...40]
                        ldaData[i, j] = ldMin + (ldMax - ldMin) * rnd.NextDouble();
                    }
                    else
                    {
                        // Data with scale different from the regular ([900...1040] series #3)
                        ldaData[i, j] = 900 + (1040 - 900) * rnd.NextDouble();
                    }
                }
            }

            // Create IChartDataSource object
            IChartDataSource loDataSource = new ArrayDataSource(ldaData, DataOrientation.CategoryInColumn);

            // Load data to the chart
            
                m_ChartControl.Charts[5].LoadData(loDataSource, false, true);
            
            // Load theme to decorate chart or assign chart layout settings using API here
               // m_ChartControl.LoadTheme("BaseTheme.xml");

                // Make third series use own Y-axis (second Y-axis) with own scale.
                m_ChartControl.Charts[0].Layout.SeriesList[3].ChartType = Manco.Chart.Layouts.ChartType.Line;
                m_ChartControl.Charts[0].Layout.SeriesList[3].ShowSecondYAxis = true;
                m_ChartControl.Charts[0].Layout.SeriesList[3].Fill.ShowShadow = false;

                //m_ChartControl.Charts[0].Layout.SeriesList[0].Title = "Series #1";

                // Set category titles
                for (int i = 0; i < liCategoryCount; i++)
                {
                    m_ChartControl.Charts[0].Layout.Categories[i].Title = i.ToString();

                    if (i % 1 == 0)
                    {
                        m_ChartControl.Charts[0].Layout.Categories[i].ShowLabel = true;
                    }
                    else
                    {
                        m_ChartControl.Charts[0].Layout.Categories[i].ShowLabel = false;
                    }
                }

                // Show data points on the line chart
                m_ChartControl.Charts[0].Layout.ChartSpecific.Line.ShowDataPoints = true;

                // Make data points transparent
                m_ChartControl.Charts[0].Layout.ChartSpecific.Line.TransparentDataPoints = false;

                // Pay attention. To make datapoints invisible the border around elements should not exist
                m_ChartControl.Charts[0].Layout.Element.Border.Width = 0;

                // Change scale settings for the second Y-axis (if you'd like - uncomment it)
                // Automatic scale for the second Y-axis will be 0...1200
                m_ChartControl.Charts[0].Layout.SecondYAxis.ScaleAndGrid.Scale.Min = 900;
                m_ChartControl.Charts[0].Layout.SecondYAxis.ScaleAndGrid.Scale.Max = 1040;

                // Resume chart layout
                m_ChartControl.ResumeChartLayout(false);

            // Draw chart
           m_ChartControl.Draw();
        }
    }
  }

et cote XAML j ai ça

Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
<Page x:Class="WpfMancoChart.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:my="clr-namespace:Manco.Chart;assembly=Manco.Chart"
    Title="Page1">
    <Grid>
        <Button Height="23" HorizontalAlignment="Left" Margin="5,9,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click">Button</Button>
    </Grid>
</Page>

le probleme et quand je clique sur le bouton il m affiche l'erreur suivate:La référence d'objet n'est pas définie à une instance d'un objet. au 2 endroit selectionner desus.

merci