Bonjour
Je suis débutant en .net et c'est mon premier essai en C#.
Ce code permet de tracer 2 courbes en temps réel, ces 2 courbes sont linéaires.
SVP, qui peut m'aider a obtenir comme résultat 2 courbes sinusoïdales.

Code : 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Drawing;
using ZedGraph;
 
namespace zedGraph
{
 
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
 
        int TickStart, intMode = 1;
        private void Form1_Load(Object sender, EventArgs e)
        {
            GraphPane myPane = zed.GraphPane;
            myPane.Title.Text = "Motor Position";
            myPane.XAxis.Title.Text = "Time , Seconds";
            myPane.YAxis.Title.Text = "Angle , Deg";
 
            RollingPointPairList list = new RollingPointPairList(60000);
            RollingPointPairList list1 = new RollingPointPairList(60000);
 
 
            LineItem curve = myPane.AddCurve("Set Value", list, Color.Red, SymbolType.None);
            LineItem curve1 = myPane.AddCurve("Current Value", list1, Color.Blue, SymbolType.None);
 
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 30;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MajorStep = 5;
 
 
            zed.AxisChange();
 
            TickStart = Environment.TickCount;
 
        }
 
 
        private void PbMode_Click(object sender, EventArgs e)
        {
 
            if (PbMode.Text == "SROLL")
            {
                intMode = 1;
                PbMode.Text = "COMPACT";
            }
 
            else
            {
                intMode = 0;
                PbMode.Text = "SROLL";
            }
        }
 
 
        private void Draw(String setPoint, String current)
        {
            double intsetpoint;
            double intcurrent;
            double.TryParse(setPoint, out intsetpoint);
            double.TryParse(current, out intcurrent);
 
            if (zed.GraphPane.CurveList.Count <= 0)
                return;
            LineItem curve = zed.GraphPane.CurveList[0] as LineItem;
            LineItem curve1 = zed.GraphPane.CurveList[1] as LineItem;
 
            if (curve == null)
                return;
            if (curve1 == null)
                return;
 
            IPointListEdit list = curve.Points as IPointListEdit;
            IPointListEdit list1 = curve1.Points as IPointListEdit;
 
            if (list == null)
                return;
            if (list1 == null)
                return;
 
            double time = (Environment.TickCount - TickStart) / 1000;
 
            list.Add(time, intsetpoint);
            list1.Add(time, intcurrent);
 
            Scale xScale = zed.GraphPane.XAxis.Scale;
            if (time > xScale.Max - xScale.MajorStep)
            {
                if (intMode == 1)
                {
                    xScale.Max = time + xScale.MajorStep;
                    xScale.Min = xScale.Max - 30.0;
                }
 
                else
                {
                    xScale.Max = time + xScale.MajorStep;
                    xScale.Min = 0;
                }
 
            }
 
 
            zed.AxisChange();
            zed.Invalidate();
 
        }
 
        private void PbExit_Click(Object sender, EventArgs e)
        {
            Close();
        }
 
        private void timer1_Tick(Object sender, EventArgs e)
        {
            Draw("100", "200");
        }
 
 
    }
}
Merci