0

i am currently using [highchart js lib][1] to create a stacked column chart for my project.

here is my exact code:

$(function () {
        $('#container').highcharts({
            yAxis: {
                min: 0,
                title: {
                    text: 'Total fruit consumption'
                },
                stackLabels: {
                    enabled: true,
                    style: {
                        fontWeight: 'bold',
                        color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
                    }
                }
            },
            legend: {
                align: 'right',
                x: -70,
                verticalAlign: 'top',
                y: 20,
                floating: true,
                backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
                borderColor: '#CCC',
                borderWidth: 1,
                shadow: false
            },
            tooltip: {
                formatter: function() {
                    return '<b>'+ this.x +'</b><br/>'+
                        this.series.name +': '+ this.y +'<br/>'+
                        'Total: '+ this.point.stackTotal;
                }
            },
            plotOptions: {
                column: {
                    stacking: 'normal',
                    dataLabels: {
                        enabled: true,
                        color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                        style: {
                            textShadow: '0 0 3px black, 0 0 3px black'
                        }
                    }
                }
            }
        });
    });

so the extremely small value shows up in extra label .

i am not even sure highchart lib can do that or not,

please suggest with some code example. cheers

sefirosu
  • 2,558
  • 7
  • 44
  • 69

1 Answers1

0

Unfortunately this is not defaulty supported, but you can try adapt solution, which detect conflicts between labels.

load: function() {
                    StaggerDataLabels(this.series);
                },
                redraw: function() {
                    var series = this.series;
                    setTimeout(function() {
                        StaggerDataLabels(series);
                    }, 1000);
                }

http://jsfiddle.net/menXU/6/

Sebastian Bochan
  • 37,348
  • 3
  • 49
  • 75