Bonsoir,
J'ai trouvé un OCX appellé "SpeedGraph" qui pourrait me convenir,
Es-tu sûr d'avoir posté dans la bonne section ? (peut-être est-ce du vb6 ?)
Sinon, pourquoi ne pas le créer toi même ce graphique ?
Voici un exemple que j'ai proposé il y a un moment.
L'optimisation du code est à revoir mais peut déjà te donner une idée sur la façon de procéder :
Option Strict On
Public Class Form1
Private p As clsCourbeTemperature
Private rd As Random = New Random
Private WithEvents tmr As New System.Windows.Forms.Timer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'c'est ici qu'on instancie la classe en fournissant des paramètres
p = New clsCourbeTemperature(Me, Color.GreenYellow, Color.Black, 1000, 20, 12, "0°C", "100°C")
tmr.Interval = 1000
tmr.Start()
End Sub
Private Sub tmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmr.Tick
'simulation d'une température entre 0 et 100 degrés
'tu peux fournir à la classe, des valeurs issues d'un capteur par exemple.
p.Temperature = rd.Next(0, 100)
End Sub
Public Class clsCourbeTemperature
Inherits PictureBox
Dim m_EcartEntrePoints, m_NombrePointsMax As Integer
Dim m_NombreHautEchelle, m_NombreBasEchelle As String
Dim m_CouleurFond, m_CouleurTrait As Color
Dim m_Temperature As Double
Dim m_col As New List(Of Integer)
Dim b As Bitmap
Dim g As Graphics
Dim ft As New Font("Arial", 13, FontStyle.Regular, GraphicsUnit.Pixel)
Public Sub New(ByVal ParentForm As Form, _
ByVal CouleurTrait As Color, _
ByVal CouleurFond As Color, _
ByVal TempsRafraichissement As Double, _
ByVal EcartEntrePoints As Integer, _
ByVal NombrePointsMax As Integer, _
ByVal NombreBasEchelle As String, _
ByVal NombreHautEchelle As String)
Me.Width = ParentForm.ClientRectangle.Width
Me.Height = ParentForm.ClientRectangle.Height
Me.Parent = ParentForm
m_EcartEntrePoints = EcartEntrePoints
m_NombrePointsMax = NombrePointsMax
m_CouleurFond = CouleurFond
m_CouleurTrait = CouleurTrait
m_NombreHautEchelle = NombreHautEchelle
m_NombreBasEchelle = NombreBasEchelle
b = New Bitmap(Me.Width, Me.Height)
g = Graphics.FromImage(b)
End Sub
Public WriteOnly Property Temperature() As Double
Set(ByVal value As Double)
m_Temperature = value
If m_col.Count - 1 >= m_NombrePointsMax Then m_col.RemoveAt(0)
m_col.Add(Convert.ToInt32(((100 - m_Temperature) / 100) * Me.Height))
g.FillRectangle(New SolidBrush(m_CouleurFond), New Rectangle(0, 0, b.Width, b.Height))
g.DrawString(m_NombreBasEchelle, ft, New SolidBrush(Color.White), 5, Me.Height - 20)
g.DrawString(m_NombreHautEchelle, ft, New SolidBrush(Color.White), 5, 5)
For x = 0 To Me.Height - 1
If x Mod Convert.ToInt32((Me.Height / 4)) = 0 Then
g.DrawLine(New Pen(Color.FromArgb(70, 0, 220, 0)), 0, x, Me.Width, x)
End If
Next
For x = 1 To m_col.Count - 1
g.DrawLine(New Pen(m_CouleurTrait, 2), _
New Point(x * m_EcartEntrePoints, m_col.Item(x - 1)), _
New Point((x * m_EcartEntrePoints) + m_EcartEntrePoints, m_col.Item(x)))
If x = m_col.Count - 1 Then
g.DrawString(m_Temperature.ToString & " °C", _
ft, _
New SolidBrush(Color.Orange), _
(x * m_EcartEntrePoints) + m_EcartEntrePoints, _
m_col.Item(x))
End If
Next
Me.Image = CType(b.Clone, Image)
End Set
End Property
End Class
End Class