Problème sur l'échelle quand c'est des dates !!
:yaisse2:
c'est bon ça marche !!!!
voici le code pour ceux que ça intéresse :
Code:
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
| Public Function graph_capteur_change(id_capteur As Long, erreur As String) As Boolean
On Error GoTo ErrHandler
Dim strquery As String
Dim myrec As Recordset
Dim str_graph As String
Dim str_graph1 As String
Dim str_graph2 As String
Dim sensibilite As Double
Dim linearite As Double
Dim date_etal As Date
Dim isgraph As Boolean
Dim AxeY2 As Object
'initialisation
Form_frm_information_capteur.graph_capteur.RowSource = ""
isgraph = False
str_graph = "Date d'étalonnage;Sensibilité à 25°C;Erreur de linéarité (en %)"
' On sélectionne la sensibilite à 25°C, la linearite et la date de relevee selon le capteur sélectionné à l'arrivée
strquery = "SELECT date_arrivee, sensibilite_25, linearite FROM tbl_209_capteur " & _
"WHERE id_capteur = " & id_capteur & ";"
If Not mod_sql.sql_open_recordset_v1(strquery, myrec, erreur) Then Err.Raise 513, , erreur
While Not (myrec.EOF)
' On les ajoute dans le graphe
sensibilite = myrec.Fields(1)
linearite = myrec.Fields(2)
date_etal = myrec.Fields(0)
' Chaîne de construction du graphe
str_graph = str_graph & ";" & date_etal & ";" & sensibilite & ";" & linearite
myrec.MoveNext
'construction du graph
graph_capteur.RowSource = str_graph
graph_capteur.Object.Application.PlotBy = 1
graph_capteur.Object.Application.PlotBy = 2
isgraph = True
Wend
' On sélectionne les sensibilites à 25°C, les linearites et les dates de relevees selon le capteur sélectionné lors des étalonnages
strquery = "SELECT date_calib, sensibilite_25, linearite FROM tbl_209_calib_capteur " & _
"WHERE idx_capteur = " & id_capteur & " " & _
"ORDER BY date_calib ;"
If Not mod_sql.sql_open_recordset_v1(strquery, myrec, erreur) Then Err.Raise 513, , erreur
While Not (myrec.EOF)
' On les ajoute dans le graphe
sensibilite = myrec.Fields(1)
linearite = myrec.Fields(2)
date_etal = myrec.Fields(0)
' Chaîne de construction du graphe
str_graph = str_graph & ";" & date_etal & ";" & sensibilite & ";" & linearite
myrec.MoveNext
'construction du graph
graph_capteur.RowSource = str_graph
graph_capteur.Object.Application.PlotBy = 1
graph_capteur.Object.Application.PlotBy = 2
isgraph = True
Wend
'type du graphique
graph_capteur.ChartType = xlXYScatterLines
'création du deuxième axe
graph_capteur.SeriesCollection(2).AxisGroup = 2
Set AxeY2 = graph_capteur.Object.Application.Chart.Axes(2, xlSecondary)
graph_capteur.Refresh
graph_capteur_change = True
Exit Function
ErrHandler:
graph_capteur_change = False
erreur = "graph_capteur_change : " & Err.Number & " : " & Err.Description
End Function |
J'ai mis le nom de l'axe manuellement et il a l'air de le conserver.
Mon problème maintenant concerne l'échelle de l'abcsisse.
En effet, ce sont des dates. Le problème survient quand je n'est qu'une donnée sur mon graph, l'échelle commence au 00/01/1900.
Quand je suis allée dans les propriétés de l'axe pour modifier l'échelle, je me suis rendue compte que les dates sont transformées en nombre et je ne vois pas à quoi ça correspond !!!!
Quelqu'un peut-il m'aider ???