Exemplo n.º 1
0
        public void deleteGraphe(string nomParam)
        {
            int i = 0;

            foreach (LineSeries A in Chart.Series)
            {
                if (A.Title == nomParam)
                {
                    break;
                }
                i++;
            }
            if (Chart.Series.Count > 1)
            {
                if (i > 0)
                {
                    Chart.Series.RemoveAt(i);
                    Chart.AxisY.RemoveAt(i);
                    for (int j = i; j < Chart.Series.Count; j++)
                    {
                        Chart.Series.ElementAt(j).ScalesYAt = Chart.Series.ElementAt(j).ScalesYAt - 1;
                    }
                }
                else
                if (i == 0)
                {
                    Y.Title          = Chart.AxisY.ElementAt(1).Title;
                    Y.LabelFormatter = Chart.AxisY.ElementAt(1).LabelFormatter;
                    X.Title          = Chart.Series.ElementAt(1).Title;
                    X.Values         = Chart.Series.ElementAt(1).Values;
                    var converter = new BrushConverter();
                    var brush     = (Brush)converter.ConvertFromString(GetColor(X.Title));
                    X.Stroke    = brush;
                    X.ScalesYAt = 0;
                    Chart.Series.RemoveAt(1);
                    Chart.AxisY.RemoveAt(1);
                    for (int j = 1; j < Chart.Series.Count; j++)
                    {
                        Chart.Series.ElementAt(j).ScalesYAt = Chart.Series.ElementAt(j).ScalesYAt - 1;
                    }
                }
                titre.Text = GetTitle();
            }
            else        //Il reste un seule graphe
            {
                firstgraph = true;
                X.Title    = "";
                X.Values   = new ChartValues <double> {
                };
                DataGraphClass Nothing = new DataGraphClass();
                Y.Title          = "";
                Y.LabelFormatter = Nothing.Formatter;
                titre.Text       = "";
            }
        }
Exemplo n.º 2
0
 public DataGraphClass(string parametre, ChartValues <double> Valeurs)
 {
     if (parametre == "Température")
     {
         Values      = Valeurs;
         Formatter   = Values => Values + "°C";
         DataContext = this;
     }
     else
     {
         if (parametre == "Humidité")
         {
             Values      = Valeurs;
             Formatter   = Values => Values + "%";
             DataContext = this;
         }
         else
         {
             if (parametre == "Vitesse du vent")
             {
                 Values      = Valeurs;
                 Formatter   = Values => Values + "km/h";
                 DataContext = this;
             }
             else
             {
                 if (parametre == "Précipitation")
                 {
                     Values      = Valeurs;
                     Formatter   = Values => Values + "mm";
                     DataContext = this;
                 }
                 else
                 {
                     if (parametre == "Direction du vent")
                     {
                         Values      = Valeurs;
                         Formatter   = Values => Values + "°";
                         DataContext = this;
                     }
                     else
                     {
                         if (parametre == "Pression")
                         {
                             Values      = Valeurs;
                             Formatter   = Values => Values + "%";
                             DataContext = this;
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
        public void addGraphe(string nomParam)
        {
            string attr = config.getWilaya(WilayaName).getAttr(nomParam);
            ChartValues <double> Values = GetValues(attr);
            List <string>        Labels = GetLAbels();
            DataGraphClass       T      = new DataGraphClass(nomParam, Values);

            if (T.Values.Count != 0)
            {
                this.axisX.Labels = Labels;
                var converter = new BrushConverter();
                var brush     = (Brush)converter.ConvertFromString(GetColor(nomParam));

                if (this.firstgraph)
                {
                    X.Values         = T.Values;        // Xrepresente le premier Series
                    X.ScalesYAt      = 0;               // Y represente le premier AxisY
                    X.Title          = nomParam;
                    Y.Title          = nomParam;
                    Y.LabelFormatter = T.Formatter;
                    Y.Foreground     = X.Stroke = brush;
                    firstgraph       = false;
                    titre.Text       = GetTitle();
                }
                else
                {
                    Chart.AxisY.Add(new Axis {
                        Title = nomParam, LabelFormatter = T.Formatter, Foreground = brush
                    });
                    Chart.Series.Add(new LineSeries
                    {
                        Title             = nomParam,
                        ScalesYAt         = Chart.AxisY.Count - 1,
                        Values            = T.Values,
                        Stroke            = brush,
                        Fill              = Brushes.Transparent,
                        LineSmoothness    = 1,
                        PointGeometrySize = 5
                    });   /////////////////////////////je dois midfier partout
                    firstgraph = false;
                    titre.Text = GetTitle();
                }
            }
            else
            {
                new MessageBoxWindow("Le Dataset ne contient aucune valeur sur " + nomParam + " entre le " +
                                     date1.SelectedDate.ToString().Substring(0, 11) +
                                     " et le " + date2.SelectedDate.ToString().Substring(0, 11),
                                     false).Show();
            }
        }
Exemplo n.º 4
0
        public void addGraphe(string nomParam)
        {
            //On recipere les donnes des deux Wilaya
            string attr = config.getWilaya(WilayaName).getAttr(nomParam);
            ChartValues <double> Values  = GetValues(attr);
            ChartValues <double> Values2 = GetValues2(attr);

            if (Values.Count == 0)
            {
                new MessageBoxWindow("Données introuvables entre les dates entrées", false).ShowDialog();
                Uncheked("");
            }
            else
            {
                if (Values2.Count == 0)
                {
                    new MessageBoxWindow("Données introuvables entre les dates entrées", false).ShowDialog();
                    Uncheked("");
                }
                else
                {
                    Uncheked(nomParam);
                    DataGraphClass Wilaya1 = new DataGraphClass(nomParam, Values);
                    DataGraphClass Wilaya2 = new DataGraphClass(nomParam, Values2);
                    ///On affecte les valeurs
                    X1.Values = Wilaya1.Values;
                    X2.Values = Wilaya2.Values;

                    Y.LabelFormatter = Wilaya1.Formatter;
                    //On affecte les titres
                    X1.Title         = WilayaName;
                    X2.Title         = GetWilaya2();
                    axisX.Labels     = GetLabels();
                    Y.Title          = nomParam;
                    Y.LabelFormatter = Wilaya1.Formatter;
                    titre.Text       = GetTitle();
                }
            }
        }
Exemplo n.º 5
0
        private void Uncheked(string param)    //Elle permet de supprimer les deux graphes des deux Wilayas
        {
            switch (param)
            {
            case "Température":
                this.HumiditeCheckbox.IsChecked = this.VitesseVentCheckbox.IsChecked = this.DirectionVentCheckbox.IsChecked = this.PrecipitationCheckbox.IsChecked
                                                                                                                                  = this.PressionCheckbox.IsChecked = false;
                break;

            case "Humidité":
                this.TemperatureCheckbox.IsChecked = this.VitesseVentCheckbox.IsChecked = this.DirectionVentCheckbox.IsChecked = this.PrecipitationCheckbox.IsChecked
                                                                                                                                     = this.PressionCheckbox.IsChecked = false; break;

            case "Vitesse du vent":
                this.TemperatureCheckbox.IsChecked = this.HumiditeCheckbox.IsChecked = this.DirectionVentCheckbox.IsChecked = this.PrecipitationCheckbox.IsChecked
                                                                                                                                  = this.PressionCheckbox.IsChecked = false; break;

            case "Direction du vent":
                this.TemperatureCheckbox.IsChecked = this.VitesseVentCheckbox.IsChecked = this.HumiditeCheckbox.IsChecked = this.PrecipitationCheckbox.IsChecked
                                                                                                                                = this.PressionCheckbox.IsChecked = false; break;

            case "Précipitation":
                this.TemperatureCheckbox.IsChecked = this.VitesseVentCheckbox.IsChecked = this.DirectionVentCheckbox.IsChecked = this.HumiditeCheckbox.IsChecked
                                                                                                                                     = this.PressionCheckbox.IsChecked = false; break;

            case "Pression":
                this.TemperatureCheckbox.IsChecked = this.VitesseVentCheckbox.IsChecked = this.DirectionVentCheckbox.IsChecked = this.PrecipitationCheckbox.IsChecked
                                                                                                                                     = this.HumiditeCheckbox.IsChecked = false; break;

            default: break;
            }
            DataGraphClass Nothing = new DataGraphClass();

            X1.Values         = X2.Values = Nothing.Values;
            X1.Title          = X2.Title = Y.Title = "";
            titre.Text        = "";
            Y.LabelFormatter  = Nothing.Formatter;
            this.axisX.Labels = new List <String>();
        }