Skip to content

Commit 0bc1e5f

Browse files
author
Maxime AILLOUD
committed
Added 'data-graph-datalabels-formatter' option
1 parent a29c209 commit 0bc1e5f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

jquery.highchartTable.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@
143143
var series = [];
144144
$(columns).each(function(indexColumn, column) {
145145
if(indexColumn!=0 && !column.skip) {
146-
series.push({
146+
147+
var serieConfig = {
147148
name: column.libelle + (column.unit ? ' (' + column.unit + ')' : ''),
148149
data: [],
149150
type: column.graphType,
@@ -161,7 +162,17 @@
161162
color: column.dataLabelsColor,
162163
align: $table.data('graph-datalabels-align') || 'center'
163164
}
164-
});
165+
};
166+
167+
if(column.dataLabelsEnabled) {
168+
var callableSerieDataLabelsFormatter = getCallable(table, 'graph-datalabels-formatter');
169+
if (callableSerieDataLabelsFormatter) {
170+
serieConfig.dataLabels.formatter = function () {
171+
return callableSerieDataLabelsFormatter(this.y);
172+
};
173+
}
174+
}
175+
series.push(serieConfig);
165176
}
166177
});
167178

@@ -463,4 +474,4 @@
463474
return new Date(parseInt(dateInfos[0], 10), parseInt(dateInfos[1], 10)-1, parseInt(dateInfos[2], 10));
464475
};
465476

466-
})(jQuery);
477+
})(jQuery);

0 commit comments

Comments
 (0)