简体   繁体   中英

HighCharts : display label only on line combine chart

I use HighChart to display chart. I've done a combine chart with bar and line. It works well but I want to display label only on line and not on bar , but I don't manage.

Here my code to display label :

 plotOptions: {
       series: {
         dataLabels: {
                        enabled: true
                    }
           }
  },

With "series" option I have labels on every type of chart (bar and line).

 plotOptions: {
       line: {
         dataLabels: {
                        enabled: true
                    }
           }
  },

With "line" option I have no labels.

So, is there a possibility to display label only on one type of chart ?

Thanks for your help !

This doesn't work for you? See fiddle . I am guessing one of your other config options is hiding the labels (or moving them somewhere where they can't be seen, or setting their font color to the same as the background...etc.)

 $(function () {
    $('#container').highcharts({

        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                }
            }
        },
        series: [{
            type:'line',
            data: [29.9, 71.5, 106.4, 129.2]
        }, {
            type: 'bar',
            data: [22.9, 55.5, 134.4]
        }]

    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM