Bonjour à tous

je voudrais contrôlé une graphe créé avec la libraire highcharts par Jquery UI Slider http://jqueryui.com/slider/


voici le script :

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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
 
jQuery(function () {
    var chart;
    jQuery(document).ready(function() {
        //definir les options
        var options = {
 
				chart: {
					renderTo: 'container',
					borderColor: '#EBBA95',
					borderWidth: 2,
					type: 'line'
				},
 
				title: {
					text: 'Mon Graphes'
				},
 
				subtitle: {
					text: 'Source: Source'
				},
				//On supprime les "crédits"
				credits : {
					text: ''
				},
 
				xAxis: {
					type: 'datetime',
					//L'intervalle d'affichage des dates sur l'axe des X
					tickInterval: 4 * 7 * 24 * 3600 * 1000, // one week
					//tickWidth: 2,
					lineWidth: 2,
					lineColor: '#000000',
					//On commence la graphe avec le premier point trouvé
					startOnTick: true,
					//showFirstLabel: true,
					//Format de la date sur l'axe des X
					labels: {
							formatter: function() {
								return Highcharts.dateFormat('%m/%Y', this.value);
							}
					}
				},
 
				//Quels données pour les Y
				yAxis: {
					//A combien commenceront les Y
					min: 90,
					//min: null, // Will for min and max to adjust when you zoom                      
                    //max: null, //
					//Quel libellé sur l'axe des Y
					title: {
						text: "",
					},
					lineWidth: 2,
					lineColor: '#000000',
				},
			    //Affichage de la legende au centre
			    legend: {
					//Quel alignement ?
					align: 'center',
					//En haut, en bas ?
					verticalAlign: 'bottom',
					//Quelle couleur ?
					backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white',
					//Quelles couleur de bordure ?
					borderColor: '#CCC',
					//Quelle épaisseur ?
					borderWidth: 2,
					shadow: true
				 },
 
				//Au survol de la barre, que faut-il afficher ?
				tooltip: {
				   formatter: function() {
					   return '<b>'+ this.series.name +'</b><br/>'+
				               Highcharts.dateFormat('%d/%m/%Y', this.x) +'<br/>'+ 
					           this.y;
				   }
				},
				series: [{
					  }, {
				}]
        };
 
        parts = [],
        indices = [];
        var dateop = new Array();
		var euromts = new Array();
		var euromtsjoin;
		var vl = new Array();
		var vljoin;
 
		var part = '';
		var typeVL = '';
		var indice = '';
 
		var namepart = "";
		var nameindice = "";
 
		var vlBasePart = '';
		var vlBaseIndice = '';
		var resultatVlPart = new Array();
		var resultatIndice = new Array();
 
		jQuery('#notification').html('Loading data ....');
 
        jQuery.ajax({
				url: "getdatatodisplay",
				datatype: "json",
				success: function(data) {
						data = jQuery.parseJSON(data)
						//alert(data.length);
						if(data.length != 0) {
						jQuery.each(data, function(i, item) {
 
								//Les valeurs de base du VL
								vlBasePart = data[0].field_vl_value;
								vlBaseIndice = data[0].euromts;
								dateop.push(data[i].field_date_operation_value);
								resultatVlPart[i] = data[i].field_vl_value * 100 / vlBasePart;
								resultatIndice[i] = data[i].euromts * 100 / vlBaseIndice;
								indices.push([
									 data[i].field_date_operation_value,
									 parseInt(Math.round(resultatIndice[i]),10)
								 ]);
								 parts.push([
									 data[i].field_date_operation_value,
									 parseInt(Math.round(resultatVlPart[i]), 10)
								 ]);
						});
						namepart = 'A'
						nameindice = 'B';
						options.series[0].data = indices;
						options.series[0].name = nameindice;
 
 
                        options.series[1].data = parts;
						options.series[1].name = namepart;                  
                        chart = new Highcharts.Chart(options);
						}else{
						     options.series[0].showInLegend = false;
							 options.series[1].showInLegend = false;
							 chart = new Highcharts.Chart(options);
						     chart.showLoading('No data to display');
						}
				},
				complete: function() {
						jQuery('#notification').html();
				}
		});
 
 
 
 
        jQuery( "#slider" ).slider({
            value:0,
            min: 0,
            max: 500,
            step: 100,
            slide: function( event, ui ) {
                jQuery( "#amount" ).val( ui.value );
 
			    jQuery.ajax({
						type: "POST",
						url: "getdatatodisplay",
						data: "part="+ui.value,
						success: function(data) {
						        alert(ui.value);
								data = jQuery.parseJSON(data);
								if(data.length != 0) 
								{
										        jQuery.each(data, function(i, item) {
												vlBasePart = data[0].field_vl_value;
												vlBaseIndice = data[0].euromts;
												resultatVlPart[i] = data[i].field_vl_value * 100 / vlBasePart;
												resultatIndice[i] = data[i].euromts * 100 / vlBaseIndice;
 
												indices.push([
													 data[i].field_date_operation_value,
													 parseInt(Math.round(resultatIndice[i]),10)
												 ]);
 
												 parts.push([
													 data[i].field_date_operation_value,
													 parseInt(Math.round(resultatVlPart[i]), 10)
												 ]);
										     });
 
												namepart = 'A'
 
												nameindice = 'B';
 
											options.series[0].data = indices;
											options.series[0].name = nameindice;
											options.series[1].data = parts;
											options.series[1].name = namepart;
											chart1 = new Highcharts.Chart(options);
 
						}else{
						     options.series[0].showInLegend = false;
							 options.series[1].showInLegend = false;
 
							 chart1 = new Highcharts.Chart(options);
						     chart1.showLoading('No data to display');
						}
					}
				});
            }
        });
        jQuery( "#amount" ).val( "$" + jQuery( "#slider" ).slider( "value" ) );
Avec cette script j'arrive bien à afficher les graphes et afficher aussi le slider par contre je suis bloqué sur le comme puis -je passé les valeurs récupérées depuis le slider au script permettant de charger la graphe et de mettre à jour la graphe en fonction des valeurs récupérées

J'ai tenté avec chart.destroy ou chart.redraw mais aucun résultat

sur cette parti , on peut récupérer les valeurs sélectionnées sur le slider par ui.value
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
 jQuery( "#slider" ).slider({
            value:0,
            min: 0,
            max: 500,
            step: 100,
            slide: function( event, ui ) {
            }
});
et j'aimerai passé les valeurs au premiers appel ajax puis mettre à jour les courbes car là j'appelle deux fois l'ajax qui ralentisse mon script et aussi j'arrive pas à mettre à jour les courbes en fonction des nouvelles valeurs reçues du slider


je vous remercie pour votre aide et suggestion