Récupérer les données de la dataView
Bonjour tout le monde.
Je ne suis pas certain que le titre soit très bien adapté.
Toujours dans mon problème de dataView, mais cette fois-çi, j'essaye de gérer le contentToOption en récupérant des informations qui ont été créées dans le optionToContent, mais je ne comprends pas car ça reste "undefined".
C'est la fin de la journée, donc je dois surement passer à côté d'un truc tout bête, mais là, je ne vois pas ce qui va sans doute vous sauter aux yeux :)
WLigTab reste désespérément à "undefined".
Code:
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
|
dataView: {
show: true, // Affiche ou non l'icône pour afficher les données utilisées.
readOnly: false,
backgroundColor: '#88ABD9',
title: 'Données',
lang: ['Données utilisées pour le graphique...', 'Retour', 'Export CSV'],
optionToContent: function(opt) {
if (P_Plateforme == "LFPO")
{
$('#Info_lfpo_hg').css('display','none'); // Effacement de la DIV Info_lfpo_hg
}
if (P_Plateforme == "LFPG")
{
$('#Info_lfpg_hg').css('display','none'); // Effacement de la DIV Info_lfpo_hg
}
if (P_Plateforme == "LFPB")
{
$('#Info_lfpb_hg').css('display','none'); // Effacement de la DIV Info_lfpo_hg
}
var axisData = opt.xAxis[0].data;
var series = opt.series;
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:120px">Tranches Horaires</th>'
WTable01 = WTable01 + '<th class="text-center" style="width:120px">Intervales</th>'
WTable01 = WTable01 + '<th class="text-center">' + series[1].name + '</th>';
WTable01 = WTable01 + '<th class="text-center">' + series[2].name + '</th>';
WTable01 = WTable01 + '<th class="text-center">' + series[0].name + '</th>';
WTable01 = WTable01 + '</tr></thead>';
WTable01 = WTable01 + '<tbody class="table-hover">';
for (var i = 0, l = axisData.length; i < l; i++) {
WTable01 += '<tr>'
+ '<td class="text-center">' + TranchesHoraires_X[i] + '</td>'
+ '<td class="text-center">' + Interv[parseInt(i)] + '</td>'
+ '<td class="text-center">' + series[1].data[i] + '</td>'
+ '<td class="text-center">' + series[2].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 = "HeuresGlissantes_" + P_dayInit;
var Ext = ".CSV";
var FicPDF = "";
var WLigTab = $("#ID_Table_Data").length;
var WLigneCSV = "TRANCHES HORAIRES;INTERVALES;NB DEPART;NB ARRIVEE;TOTAL" + "\n";
// for (var i = 0, l = WLigTab; i < WLigTab; i++) {
// WLigneCSV = WLigneCSV + TranchesHoraires_X[i] + ";" + Interv[parseInt(i)] + ";"
// WLigneCSV = WLigneCSV + series[1].data[i] + ";" + series[2].data[i] + ";" + series[0].data[i]
// WLigneCSV = WLigneCSV + "\n";
// }
console.log("WLigTab="+WLigTab);
console.log("WLigneCSV="+WLigneCSV);
}
} |