示例#1
0
 private void Courbe1Form_Load(object sender, EventArgs e)
 {
     dataGridCourb1.DataSource = DAL.Dal_Courbe1.GetAll();
     refreshDTgv();
     PanelAdd.Hide();
     panelCourbe.Hide();
 }
示例#2
0
        private void btnCourbe1_Click(object sender, EventArgs e)
        {
            List <float> listUVoltValues = new List <float>();
            List <float> listUAmpValues  = new List <float>();

            List <Courbe1_Model> list = new List <Courbe1_Model>();

            list = Dal_Courbe1.GetAll();
            CourbeChart.ChartAreas[0].BackColor      = Color.LightGray;
            CourbeChart.ChartAreas[0].AxisY.Maximum  = 4;
            CourbeChart.ChartAreas[0].AxisY.Minimum  = 0.00;
            CourbeChart.ChartAreas[0].AxisY.Interval = 0.5;

            CourbeChart.ChartAreas[0].AxisX.Maximum      = 11;
            CourbeChart.ChartAreas[0].AxisX.Minimum      = 0.00;
            CourbeChart.ChartAreas[0].AxisX.Interval     = 1;
            CourbeChart.ChartAreas[0].CursorX.AutoScroll = true;

            // let's zoom to [0,blockSize] (e.g. [0,100])
            CourbeChart.ChartAreas[0].AxisY.ScaleView.Zoomable = true;

            CourbeChart.ChartAreas[0].CursorY.AutoScroll = true;

            // let's zoom to [0,blockSize] (e.g. [0,100])
            CourbeChart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
            CourbeChart.ChartAreas[0].AxisX.Interval           = 1;
            CourbeChart.ChartAreas[0].AxisY.Title = "mA";

            CourbeChart.ChartAreas[0].AxisX.Title = "Temps";

            var serie = new Series("U");

            serie.Color       = Color.Blue;
            serie.ChartType   = SeriesChartType.Line;
            serie.MarkerStyle = MarkerStyle.Diamond;



            //serie.Points.DataBindXY(listUVoltValues.ToArray(),listUAmpertalues.ToArray());

            var serie1 = new Series("V");

            serie1.Color       = Color.HotPink;
            serie1.ChartType   = SeriesChartType.Line;
            serie1.MarkerStyle = MarkerStyle.Square;

            var serie2 = new Series("W");

            serie2.Color       = Color.Yellow;
            serie2.ChartType   = SeriesChartType.Line;
            serie2.MarkerStyle = MarkerStyle.Triangle;
            foreach (var mesure in list)
            {
                if (mesure.Type == "U")
                {
                    serie.Points.AddXY(mesure.Temps, mesure.Volt);
                }
                else
                if (mesure.Type == "V")
                {
                    serie1.Points.AddXY(mesure.Temps, mesure.Volt);
                }
                else
                if (mesure.Type == "W")
                {
                    serie2.Points.AddXY(mesure.Temps, mesure.Volt);
                }
            }
            CourbeChart.Series.Add(serie);
            CourbeChart.Series.Add(serie1);
            CourbeChart.Series.Add(serie2);
            CourbeChart.Legends.Add(new Legend("Automatiser des mésures"));
            PanelAdd.Hide();
            panelCourbe.Show();
        }