@osimatic/helpers-js 1.0.91 → 1.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/google_charts.js +16 -15
  2. package/package.json +1 -1
package/google_charts.js CHANGED
@@ -13,7 +13,7 @@ class GoogleCharts {
13
13
  // on supprime du tableau la liste des graphiques dont l'id div n'a pas été trouvé (le graphique ne pourra pas être généré)
14
14
  chartsList = chartsList.filter(chartData => typeof chartData.div_id != 'undefined' && $('#'+chartData.div_id).length);
15
15
 
16
- var nbChartsCompleted = 0;
16
+ let nbChartsCompleted = 0;
17
17
  chartsList.forEach(chartData => {
18
18
  //console.log(chartData);
19
19
  GoogleCharts.draw(
@@ -41,17 +41,18 @@ class GoogleCharts {
41
41
 
42
42
  static draw(div, typeGraph, titre, libelleAbs, tabDataAbsParam, listeLibelleOrd, listeTabDataOrd, tabColor, formatData, height, width, onComplete) {
43
43
  if (typeof div == 'undefined' || !div.length) {
44
+ console.error('div not found');
44
45
  return;
45
46
  }
46
47
 
47
48
  height = height || null;
48
49
  width = width || null;
49
50
 
50
- var htmlDomDiv = div[0];
51
+ let htmlDomDiv = div[0];
51
52
 
52
- var afficherLibelleOrd = false;
53
+ let afficherLibelleOrd = false;
53
54
 
54
- var isStacked = false;
55
+ let isStacked = false;
55
56
  if (typeGraph === 'stacked_bar_chart') {
56
57
  typeGraph = 'bar_chart';
57
58
  isStacked = true;
@@ -65,7 +66,7 @@ class GoogleCharts {
65
66
  isStacked = true;
66
67
  }
67
68
 
68
- var isDualChart = false;
69
+ let isDualChart = false;
69
70
  if (typeGraph === 'dual_column_chart') {
70
71
  typeGraph = 'column_chart';
71
72
  isDualChart = true;
@@ -75,7 +76,7 @@ class GoogleCharts {
75
76
  isDualChart = true;
76
77
  }
77
78
 
78
- var data = null;
79
+ let data = null;
79
80
  if (typeGraph === 'pie_chart') {
80
81
  //data = google.visualization.arrayToDataTable(tabDataAbsParam);
81
82
 
@@ -83,7 +84,7 @@ class GoogleCharts {
83
84
  data.addColumn('string', libelleAbs);
84
85
  data.addColumn('number', '');
85
86
 
86
- var numRow = 0;
87
+ let numRow = 0;
87
88
  $.each(tabDataAbsParam, function(idx, value) {
88
89
  data.addRows(1);
89
90
  data.setCell(numRow, 0, idx);
@@ -100,8 +101,8 @@ class GoogleCharts {
100
101
  });
101
102
 
102
103
  // Remplissage des données
103
- var nbCells = 0;
104
- var numRow = 0;
104
+ let nbCells = 0;
105
+ let numRow = 0;
105
106
  $.each(tabDataAbsParam, function(idx, dataAbs) {
106
107
  // dataOrd = tabDataOrd[idx];
107
108
  // data.addRow([dataAbs, dataOrd]);
@@ -109,7 +110,7 @@ class GoogleCharts {
109
110
 
110
111
  data.setCell(numRow, 0, dataAbs);
111
112
 
112
- var numCell = 1;
113
+ let numCell = 1;
113
114
  $.each(listeTabDataOrd, function(idx2, tabDataOrd) {
114
115
  data.setCell(numRow, numCell, tabDataOrd[idx]);
115
116
  //data.setCell(numRow, numCell, Math.round(tabDataOrd[idx], 2));
@@ -126,7 +127,7 @@ class GoogleCharts {
126
127
  // console.log('drawGraph : '+div+' ; type : '+typeGraph);
127
128
 
128
129
  // Options générales
129
- var options = {
130
+ let options = {
130
131
  colors: tabColor,
131
132
  fontName: 'Trebuchet MS',
132
133
  fontSize: 12,
@@ -221,7 +222,7 @@ class GoogleCharts {
221
222
  // console.log(idx);
222
223
  if (idx <= 1) {
223
224
  // key = 'series_'+idx;
224
- var key = idx;
225
+ let key = idx;
225
226
  // options.series[idx] = {axis: key, targetAxisIndex: key};
226
227
  options.series[idx] = {axis: key, targetAxisIndex: idx};
227
228
  if (typeGraph === 'column_chart') {
@@ -278,7 +279,7 @@ class GoogleCharts {
278
279
  // console.log(options);
279
280
 
280
281
  // Création du graphique
281
- var chart = null;
282
+ let chart = null;
282
283
  if (typeGraph === 'column_chart') {
283
284
  // chart = new google.visualization.ColumnChart(htmlDomDiv);
284
285
  chart = new google.charts.Bar(htmlDomDiv);
@@ -301,7 +302,7 @@ class GoogleCharts {
301
302
  div.removeClass('loading');
302
303
 
303
304
  if (chart === null) {
304
- console.log('erreur graphique');
305
+ console.error('error during creating chart');
305
306
  div.addClass('graphique_error');
306
307
  htmlDomDiv.innerHTML = 'Une erreur s\'est produite lors du chargement du graphique.';
307
308
  return;
@@ -317,7 +318,7 @@ class GoogleCharts {
317
318
  tabPaneDiv = div.closest('.tab-pane');
318
319
  }
319
320
 
320
- var hasClassActive = tabPaneDiv.hasClass('active');
321
+ let hasClassActive = tabPaneDiv.hasClass('active');
321
322
  if (!hasClassActive) {
322
323
  tabPaneDiv.addClass('active');
323
324
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.0.91",
3
+ "version": "1.0.92",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"