Put data labels legend inside columns in column chart - Javascript highcharts

Javascript examples for highcharts:Column Chart

Description

Put data labels legend inside columns in column chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.js"></script> 
      <script type="text/javascript">
$(function () {/*from w  w  w  . j a va2 s.  com*/
    Highcharts.chart('container', {
        chart: {
            type: 'column',
            backgroundColor:'rgba(255, 255, 255, 0.1)'
        },
        plotOptions: {
            series: {
                pointPadding: 0.01,
                groupPadding: 0,
            }
        },
        title: {
            text: ''
        },
        colors: [
           '#ffffff'
        ],
        credits: {
               enabled: false
           },
        xAxis: {
            type: 'category',
            labels: {
                rotation: -45,
                style: {
                    fontSize: '13px',
                    fontFamily: 'Verdana, sans-serif'
                }
            }
        },
        exporting: {
            buttons: {
                contextButton: {
                    enabled: false
                }
            }
        },
        yAxis: {
              gridLineWidth: 0,
            minorGridLineWidth: 0,
            min: 0,
            labels: {
               enabled: false
            },
            title: {
                text: ''
            }
        },
        series: [{
              showInLegend: false,
            name: 'Ordered subscriptions',
            data: [
                ['October', 20],
                ['November', 19],
                ['December', 10]
            ],
            dataLabels: {
                  inside: true,
                enabled: true,
                color: '#376fbb',
                align: 'center',
                verticalAlign:'bottom',
                formatter: function() {
                    return  this.y + ' ' + this.point.name;
                },
                y: 10,
                style: {
                    width:100,
                    fontSize: '12px',
                    fontFamily: 'Avenir'
                }
            }
        }]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 300px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials