bonjour,
voilà j'essaye d'utiliser un outil pour la mise en forme de graphique en jquerry mais comme je n'y connais presque rien en javascript j'utilise du php pour alimenter mon graphique.
Normalement pour que le graphique marche parfaitement il faut que les choses soient comme cela :
Code:
1
2
3
4 data: { x: [new Date("10/21/2010"), new Date("10/22/2010"), new Date("10/23/2010"), new Date("10/24/2010"), new Date("10/25/2010"), new Date("10/26/2010"), new Date("10/27/2010"), new Date("10/28/2010"), new Date("10/29/2010")], y: [12, 30, 6, 22, 14, 25, 41, 14, 3] }
C'est à dire que les datas soient dans un tableau et que chaque données soient séparées par une virgule :
data: {
x:[xdata1,xdata2,xdata3]
y: [ydata1,ydata2,ydata3]
Mais quand je rempli ces datas avec mon php voici comment cela affiche :
Voici aussi mon code complet :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 data: { x: [0h], y: [5347] x: [1h], y: [3121] x: [2h], y: [2362] x: [3h], y: [1591] x: [4h], y: [1692] x: [5h], y: [2206] x: [6h], y: [4684] x: [7h], y: [10821] x: [8h], y: [19478] x: [9h], y: [22051] }
Avez vous une idée ? pour que les datas se remplissent correctement ? MerciCode:
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 <script id="scriptInit" type="text/javascript"> $(document).ready(function () { $("#wijareachart").wijlinechart({ type: "area", showChartLabels: false, header: { text: "Audience" }, hint: { content: function () { return this.y; }, offsetY: -10 }, seriesList: [ { label: "Aujourd'hui", fitType: "spline", legendEntry: true, data: { <?php $sxml = simplexml_load_file('graph.xml'); foreach ($sxml->Row as $row) { ?> x: [<?php echo $row["Dim1"];?>], y: [<?php echo $row["Metric1"];?>] <?php } ?> } } ], seriesStyles: [{ stroke: "#00a6dd", "stroke-width": 5, opacity: 0.8 }], seriesHoverStyles: [{ "stroke-width": 8, opacity: 1 }] }); }); </script>