javascript - Hide Numbers when category is null -
kindly take @ following fiddle in tried remove categories on removing categories placing numbers instead of default , showing numbers in tooltip.
all trying categories or numbers doesnot display on chart or on tooltip , stackedbar appears on chart , kindly let me know how can .thanks,
$(function () { var data = [ { name: 'year 2008', data: [0, 914, 4054, 732, 34] }]; data = $.grep(data, function (category) { return $.grep(category.data, function (item) { return item > 0; }).length > 0; }); $('#container').highcharts({ chart: { type: 'bar' }, title: { text: 'historic world population region' }, subtitle: { text: 'source: wikipedia.org' }, xaxis: { title: { text: null } }, yaxis: { min: 0, title: { text: 'population (millions)', align: 'high' }, labels: { overflow: 'justify' } }, tooltip: { valuesuffix: ' millions' }, plotoptions: { bar: { datalabels: { enabled: true } } }, legend: { layout: 'vertical', align: 'right', verticalalign: 'top', x: -100, y: 100, floating: true, borderwidth: 1, backgroundcolor: '#ffffff', shadow: true }, credits: { enabled: false }, series: data }); });
i'm not 100% sure of asking for. but, turn off xaxis or yaxis labels, juse labels : {enabled:false} , change tooltips use tooltip:{formatter: function() {...}}
see fiddle: http://jsfiddle.net/6ypq4/
xaxis: { title: { text: null }, labels : { enabled: false } }, yaxis: { min: 0, title: { text: 'population (millions)', align: 'high' }, labels: { overflow: 'justify', enabled: false } }, tooltip: { formatter: function() { return this.y + ' millions'; } },
Comments
Post a Comment