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
|
dataView: {
show: true, // Affiche ou non l'icône pour afficher les données utilisées.
readOnly: false,
backgroundColor: '#88ABD9',
title: 'Export\nCSV',
lang: ['Données utilisées pour le graphique...', 'Retour', 'Export CSV'],
// var WLigneCSV = "PLTF;ANNEE REF.;DATES N;NB MOUV. N;DATE N-1;NB MOUV. N-1;DATE N-2;NB MOUV N-2" + "\n";
optionToContent: function (opt) {
var axisData = opt.xAxis[0].data;
var series = opt.series;
console.log("opt.xAxis[0].data="+opt.xAxis[0].data);
var WTable01 = '<div id="ID_Table_Data">';
WTable01 = WTable01 + '<table class="table-fill">';
WTable01 = WTable01 + '<thead><tr>';
WTable01 = WTable01 + '<th class="text-center" style="width:200px">Pltf</th>'
WTable01 = WTable01 + '<th class="text-center" style="width:20%">' + series[2].name + '</th>';
WTable01 = WTable01 + '<th class="text-center" style="width:20%">' + series[1].name + '</th>';
WTable01 = WTable01 + '<th class="text-center" style="width:20%">' + series[0].name + '</th>';
WTable01 = WTable01 + '</tr></thead>';
WTable01 = WTable01 + '<tbody class="table-hover">';
for (var i = 0, l = axisData.length; i < l; i++) {
console.log("series[0].data[i]="+series[0].data[i]);
console.log("series[1].data[i]="+series[1].data[i]);
console.log("series[2].data[i]="+series[2].data[i]);
// WLigneCSV = WLigneCSV + DateMouv[i] + ";" + series[2].data[i] + ";";
// WLigneCSV = WLigneCSV + series[1].data[i] + ";" + series[0].data[i];
// WLigneCSV = WLigneCSV + "\n";
// WTable01 += '<tr>' +
// '<td class="text-center" >' + DateMouv[i] + '</td>' +
// '<td class="text-center" >' + series[2].data[i] + '</td>' +
// '<td class="text-center" >' + series[1].data[i] + '</td>' +
// '<td class="text-center" >' + series[0].data[i] + '</td>' +
// '</tr>';
}
// WTable01 += '</div></tbody></table>';
// return WTable01;
},
contentToOption: function (opt) { // Va permetrtre de gérer l'exportation en CSV
var NomCSV = "TraficJournalier_" + P_Annee;
var Ext = ".CSV";
var FicCSV = NomCSV + Ext;
// Ecrire le contenu de la variable WLigneCSV dans un fichier
download(FicCSV, WLigneCSV);
}
} |
Partager