jquery - highcharts column charts show sum single 0 when entire column data total is 0 -
i creating column charts using highchart displaying 0 if of fields 0. want display single 0 per category if data in particular category 0 (i.e., total 0) please refer http://jsfiddle.net/rutup/6hxpu/18/
function createbarchart(source, title, placeholderid, sidetext, xcolumnvalue) { $('#' + placeholderid).highcharts({ credits: { enabled: false }, chart: { type: 'column' }, exporting: { enabled: false }, title: { text: false }, xaxis: { categories: xcolumnvalue }, legend: { layout: 'vertical', align: 'right', verticalalign: 'top', y: 20, borderwidth: 0, enabled: true }, yaxis: { min: 0, minrange: 0, linewidth: 0, gridlinewidth: 0, title: { text: sidetext }, labels: { enabled: false } }, stacklabels: { enabled: true, style: { fontweight: 'bold', color: 'gray' }, formatter: function () { return calcantilog(this.y) == null ? 0 : calcantilog(this.y); } }, tooltip: { formatter: function () { return '<b>' + this.x + '</b><br/>' + this.series.name + ': ' + (calcantilog(this.y) == null ? 0 : calcantilog(this.y)); } }, plotoptions: { column: { datalabels: { enabled: true , formatter: function () { return calcantilog(this.y) == null ? 0 : calcantilog(this.y); } } } }, series: source }); }
if enough pick middle column, , show 0 above, trick: http://jsfiddle.net/6hxpu/20/
of course if have number of columns, 0 won't centered. case think best can find put zero, based on column heights , draw directly highcharts.renderer()
.
Comments
Post a Comment