Bonjour,
Je m'excuse mais ma question est relativement simple.

Je n'arrive pas à comprendre pourquoi je n'arrive pas à mesure la profondeur d'un objet

Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
function config(data) {
 
    console.log("Config Data",data);
    console.log("Config Data len: ", data.length);
}

Les console.log m'affiche
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
{
  "1": {
    "labels": [
      "2020-11-05 00:50:06",
      "2020-11-05 00:50:13",
      "2020-11-05 00:50:26",
      "2020-11-05 00:50:42",
      "2020-11-05 00:50:58",
      "2020-11-05 00:51:14",
      "2020-11-05 00:51:30",
      "2020-11-05 00:51:46"
    ],
    "datasets": {
      "data": {
        "0": 18,
        "1": 0.1,
        "2": 18,
        "3": 0.1,
        "4": 18,
        "5": 0.1,
        "6": 18,
        "7": 0.1,
        "8": 18,
        "10": 18,
        "12": 18,
        "14": 18
      },
      "label": "Température du sol [C]",
      "yAxisID": "y-axis-0",
      "type": "line",
      "borderWidth": 1,
      "borderColor": "rgba(255, 99, 132, 1)",
      "backgroundColor": "rgba(255, 99, 132, 1)",
      "pointRadius": 1,
      "pointHoverRadius": 13,
      "showLine": 1,
      "pointStyle": "triangle",
      "fill": false
    },
    "unit": "C",
    "station_longname": "Station 1",
    "station_name": "st-1",
    "id_sensor": 1,
    "chartContainer": "te"
  },
  "4": {
    "labels": [
      "2020-11-05 00:50:06",
      "2020-11-05 00:50:13",
      "2020-11-05 00:50:26",
      "2020-11-05 00:50:42",
      "2020-11-05 00:50:58",
      "2020-11-05 00:51:14",
      "2020-11-05 00:51:30",
      "2020-11-05 00:51:46"
    ],
    "datasets": {
      "data": {
        "0": 18,
        "1": 0.1,
        "2": 18,
        "3": 0.1,
        "4": 18,
        "5": 0.1,
        "6": 18,
        "7": 0.1,
        "8": 18,
        "10": 26,
        "12": 29,
        "14": 28
      },
      "label": "Température haut [C]",
      "yAxisID": "y-axis-0",
      "type": "line",
      "borderWidth": 1,
      "borderColor": "rgba(75, 192, 192, 1)",
      "backgroundColor": "rgba(75, 192, 192, 1)",
      "pointRadius": 1,
      "pointHoverRadius": 13,
      "showLine": 1,
      "pointStyle": "cicle",
      "fill": false
    },
    "unit": "C",
    "station_longname": "Station 1",
    "station_name": "st-1",
    "id_sensor": 4,
    "chartContainer": "te"
  }
}
Config Data len: undefined
Pourquoi le length m'affiche indéfini. Il devrait m'afficher 2!!!

Ou est-ce que cette erreur est du fait que me sindex ne commence pas par 0 (zéro)?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
{
  "1": {
  },
  "4": {
 
}