Bonjour à tous,

je ne sais pas si je poste mon message au bon endroit mais je me lance.

voila alors j'ai un projet en cours dans lequel je dois afficher des données ( que je recupere dans les fichiers .csv) via highchart et plus particulierement sur un master detail chart.

jusque la tout va bien, je recupere tout parfaitement et tout s'affiche niquel. Le probleme est que je recupere des "date de livraisons, qui se caracterise par des "traits" dans le master chart a une date donnée et je voudrais , que lorsque l'on selectionne dans le detail chart une section avec une date de livraison, que celle ci s'affiche dans le detail chart. ce que je n'arrive pas à faire.

ceci est un lien vers Highcharts ( pour avoir une idéee de ce qu'est un master detail chart ) : http://www.highcharts.com/demo/dynamic-master-detail

donc je vous mets mon code highcharts:

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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
 
var masterChart, detailChart, masterSeries = new Array();
	$(document).ready(function() {
	var options = {
		chart: {
		renderTo: 'master-container',
			 defaultSeriesType: 'area',
			 zoomType: 'x',
			marginLeft: 70,
			marginRight: 20,
			height : 150,
			 events: {
			// listen to the selection event on the master chart to update the 
			// extremes of the detail chart
				selection: function(event) {
					var extremesObject = event.xAxis[0],
					min = extremesObject.min,
					max = extremesObject.max,
 
					xAxis = this.xAxis[0];
 
					// reverse engineer the last part of the data
					jQuery.each(this.series, function(i, series) {
						var detailData = [];
						jQuery.each(series.data, function(j, point) {
							if (point.x > min && point.x < max) {
								detailData.push({
									x: point.x,
									y: point.y
								});
							}
						});
						detailChart.series[i].setData(detailData);
					});
 
					// move the plot bands to reflect the new detail span
					xAxis.removePlotBand('mask-before');
					xAxis.addPlotBand({
						id: 'mask-before',
						from: Date.UTC(2006, 0, 1),
						to: min,
						color: 'rgba(0, 0, 0, 0.2)'
					});
 
					xAxis.removePlotBand('mask-after');
					xAxis.addPlotBand({
						id: 'mask-after',
						from: max,
						to: Date.UTC(2008, 11, 31),
						color: 'rgba(0, 0, 0, 0.2)'
					});
 
					return false;
				}
			}
		},
		title: {
			text: null
		},
		exporting: {
			enabled: false
		},
		xAxis: {
			type: 'datetime',
			labels: {
				formatter: function() {
					return Highcharts.dateFormat('%e %b %y', this.value);                  
				}        
			},
			plotLines: []
		},
		yAxis: [
		{
			gridLineWidth: 0,
			labels: {
				enabled: false
			},
			title: {
				text: null
			},
			min: 0.6,
			showFirstLabel: false,
		 }],
		plotOptions: {
			 area: {
				//stacking: 'normal',
				lineWidth: 0.5,
				marker: {
					enabled : false
				}
			 },
			 spline: {
				zIndex: 100
			}
		},
		legend: {
			backgroundColor: '#FFFFFF',
			align: 'center',
			verticalAlign: 'bottom',
			shadow: true
		},
		tooltip: {
 
			formatter: null
			/* function() {
			return 'On <b>' +  Highcharts.dateFormat('%e. %b %y', this.x) +'<b>: <br/>'+ this.y +
			 Defects <br/>for <b>' + this.series.name +'</b> state';
			}*/
 
		},
		series: []
	};
	function createMaster() {
	// -----------------------------------------
	// Parcours du fichier contenant les données
	// -----------------------------------------
		$.get(\"$csvfilename\", function(data) {
			// Split the lines
			var lines = data.split('\\n');
			var datesArr = new Array();
			$.each(lines, function(lineNo, line) {
				var items = line.split(';');
				// header line containes date mm/dd/yy
				if (lineNo == 0) {
					$.each(items, function(itemNo, item) {
						if (itemNo > 0) {
							datesArr.push(Date.parse(item));
						}
					});
					// the rest of the lines contain data with their name in the first position
				} else {
					var aSerie = { 
						data: []
					};
					aSerie.type = 'area';
					if (lineNo == 1) {
						aSerie.color = '".$colors['Opened']."';
						aSerie.legendIndex = 1;
					} else if (lineNo == 2) {
						aSerie.color = '".$colors['Corrected']."';
						aSerie.legendIndex = 2;
					} else if (lineNo ==3) {
						aSerie.color = '".$colors['Validated']."';
						aSerie.legendIndex = 3;
					} else if (lineNo == 4) {
						aSerie.color = '".$colors['Rejected']."';
						aSerie.legendIndex = 4;
					}
					$.each(items, function(itemNo, item) {
						if (itemNo == 0) {
							aSerie.name = item;
						} else {
							aSerie.data.push([datesArr[itemNo-1], parseFloat(item)]);
						}
					});
					options.series.push(aSerie);
					masterSeries.push(aSerie.data);
				}
			});
 
			masterChart = new Highcharts.Chart(options);
			// -----------------------------------------------------
			// Parcours du fichier contenant les dates de livraison
			// -----------------------------------------------------
			$.get(\"$csvfilename_delivery\", function(data) {
				var plotline = {
					color: '#000000',
					width: 2,
					zindex:1,
					label: {
						text: '',
						align: 'center',
						verticalAlign: 'middle',
						rotation: 90
					},
					zIndex : 100
				};
				// Split the lines
				var lines = data.split('\\n');
				$.each(lines, function(lineNo, line) {
					var items = line.split(';');
					plotline.value = Date.parse(items[0]);
					plotline.label.text = items[1];
					masterChart.xAxis[0].addPlotLine(plotline);
				});
			});
		});
	}
 
	function createDetail(masterChart) {
		var detailData = [],
		detailStart = Date.UTC(2010, 7, 1);
 
		// reverse engineer the last part of the data
		/*
		jQuery.each(masterChart.series, function(i, series) {
			var detailData = [];
			jQuery.each(series.data, function(j, point) {
				if (point.x > detailStart) {
					detailData.push({
						x: point.x,
						y: point.y
					});
				}
			});
			detailChart.series[i].setData(detailData);
		});*/
		var optionsDetail = {
			chart: {
				// marginBottom: 120,
				renderTo: 'detail-container',
				defaultSeriesType: 'area',
				//renderTo: 'container',
				reflow: false,
				marginLeft: 50,
				zoomType: 'xy',
 
				marginRight: 20,
				// style: {
					// position: 'absolute'
				// }
			},
			credits: {
				enabled: false
			},
			subtitle: {
				text: 'Select an area by dragging across the lower chart'
			},
			title: {
				text: '$title'
			},
			xAxis: {
				type: 'datetime',
				labels: {
					formatter: function() {
					return Highcharts.dateFormat('%e %b %y', this.value);                  
				}        
			},
			plotLines: []
		},
 
 
		yAxis: [
		{ 
			labels: {
			style: {
				color: '#89A54E'
			}
		},
		title: {
			text: 'Defects nb',
			style: {
				color: '#89A54E'
			}
 		}
	}],
 
 
	plotOptions: {
		area: {
			//stacking: 'normal',
			lineWidth: 0.5,
			marker: {
				enabled : false
			}
		},
		spline: {
			zIndex: 100
		}
	},
 
	legend: {
		backgroundColor: '#FFFFFF',
		align: 'left',
		verticalAlign: 'top',
		shadow: true
	},
	tooltip: {
		formatter: function() {
				return 'On <b>' +  Highcharts.dateFormat('%e. %b %y', this.x) +'<b>: <br/>'+ this.y +
				' Defects <br/>for <b>' + this.series.name +'</b> state';
		},
		shared: true
	},
 
	series: [{
		name : 'Open',
		color: '".$colors['Opened']."',
		data: detailData,
	}, {
		name : 'Corrected or Validated',
		color: '".$colors['Corrected']."',
		data: detailData,
	}, {
		name : 'Closed',
		color: '".$colors['Validated']."',
		data: detailData,
	}, {
		name : 'Rejected',
		color: '".$colors['Rejected']."',
		data: detailData,
	}],
};
// create a detail chart referenced by a global variable
detailChart = new Highcharts.Chart(optionsDetail);
 
// make the container smaller and add a second container for the master chart
	var \$container = $('#container')
	.css('position', 'relative');
 
	var \$detailContainer = $('<div id=\"detail-container\">')
	.css({ borderLeft: '20px', height: '80%', width: '100%' })
	.appendTo(\$container);
 
	var \$masterContainer = $('<div id=\"master-container\">')
	.css({ borderLeft: '20px', height: '20%', width: '100%' })
	.appendTo(\$container); 
 
	createMaster();
	createDetail(masterChart);
});

desolée si l'indentation est horrible ^^

donc voila un apercu de ce que ca donne:

http://cjoint.com/?BHgkZUtjifz

voila j'espere que j'ai bien expliquer mon probleme

merci de votre aide