Exemple #1
0
 /// <summary>
 /// Supprimer une courbe
 /// </summary>
 /// <param name="curveName">Nom de la courbe à supprimer</param>
 public void DeleteCurve(String curveName)
 {
     if (CurvesData.ContainsKey(curveName))
     {
         CurvesData.Remove(curveName);
         CurvesFilled.Remove(curveName);
         CurvesPen.Remove(curveName);
     }
     if (CurvesDisplayed.ContainsKey(curveName))
     {
         CurvesDisplayed.Remove(curveName);
     }
 }
Exemple #2
0
        /// <summary>
        /// Ajouter un point à la courbe spécifiée
        /// Ajoute la courbe si elle n'existe pas encore
        /// </summary>
        /// <param name="curveName">Nom de la courbe auquel ajouter un point</param>
        /// <param name="value">Valeur à ajouter à la courbe</param>
        /// <param name="col">Couleur à associer à la courbe (null pour ne pas changer la couleur)</param>
        public void AddPoint(String curveName, double value, Color?col = null, bool fill = false)
        {
            lock (CurvesData)
            {
                List <double> data;

                if (CurvesData.ContainsKey(curveName))
                {
                    data = CurvesData[curveName];
                    if (col != null)
                    {
                        CurvesPen[curveName] = new Pen(col.Value);
                    }

                    CurvesFilled[curveName] = fill;
                }
                else
                {
                    data = new List <double>();
                    CurvesData.Add(curveName, data);
                    CurvesDisplayed.Add(curveName, true);
                    if (col != null)
                    {
                        CurvesPen.Add(curveName, new Pen(col.Value));
                    }
                    else
                    {
                        CurvesPen.Add(curveName, new Pen(Color.Black));
                    }

                    CurvesFilled.Add(curveName, fill);
                }

                data.Add(value);

                while (data.Count > pictureBox.Width)
                {
                    data.RemoveAt(0);
                }
            }
        }