IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Presentation Foundation Discussion :

utilisation de mancoChart pour wpf


Sujet :

Windows Presentation Foundation

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    40
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 40
    Par défaut utilisation de mancoChart pour wpf
    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

  2. #2
    Membre Expert
    Profil pro
    Inscrit en
    Décembre 2004
    Messages
    2 210
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2004
    Messages : 2 210
    Par défaut
    Et en ajoutant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    public ChartControl m_ChartControl = new ChartControl();
    En résumé m_ChartControl ne doit pas être initialisé.

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    40
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 40
    Par défaut
    merci pour ton aide, mais j ai toujours le meme probleme
    et quand je fais public ChartControl m_ChartControl= new ChartControl();
    il me genere l'erreur Suivante :Le type 'Manco.Chart.ChartControl' dans l'assembly 'Manco.Chart, Version=5.3.0.0, Culture=neutral, PublicKeyToken=2719141fd4ba67ae' n'est pas marqué comme sérialisable. en execution

  4. #4
    Membre Expert
    Profil pro
    Inscrit en
    Décembre 2004
    Messages
    2 210
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2004
    Messages : 2 210
    Par défaut
    Je sais pas trop quoi dire, là ?

    As-tu essayé de voir si l'exemple fourni sur la page du site fonctionne ?
    http://www.mancosoftware.com/chart/HowTo.htm
    Il y a même une FAQ.

    Il pourra peut-être t'aider sur comment l'utiliser, moi je ne le connais pas (encore )...

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    40
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 40
    Par défaut
    meme cet exemple j arive pas a l'ouvrir, il me renere cette exception:
    Impossible de créer une instance de « ChartControl » définie dans l’assembly « Manco.Chart, Version=5.3.0.0, Culture=neutral, PublicKeyToken=2719141fd4ba67ae ». Une exception a été levée par la cible d'un appel. Erreur à l’objet « System.Windows.Controls.DockPanel » dans le fichier de balisage « SimpleWpfApplication;component/window1.xaml » ligne 22 position 4.

    merci pour ton aide binoo

  6. #6
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    40
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 40
    Par défaut
    il ma gerer cette exception :SerialisationException
    Le type 'Manco.Chart.ChartControl' dans l'assembly 'Manco.Chart, Version=5.3.0.0, Culture=neutral, PublicKeyToken=2719141fd4ba67ae' n'est pas marqué comme sérialisable.

Discussions similaires

  1. Modifier les touches utilisées par défaut pour naviguer dans des RadioButton [WPF] [VB]
    Par Jayme65 dans le forum Windows Presentation Foundation
    Réponses: 1
    Dernier message: 11/05/2011, 00h43
  2. Utilisation de CASCADE pour mise à jour
    Par fuelcontact dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 16/08/2004, 08h49
  3. utilisation du mid pour tester le début d'un champ
    Par PrinceMaster77 dans le forum ASP
    Réponses: 4
    Dernier message: 09/07/2004, 13h10
  4. Réponses: 36
    Dernier message: 13/05/2004, 18h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo