Set column chart labels for column chart - Javascript highcharts

Javascript examples for highcharts:Column Chart

Description

Set column chart labels for column chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
      <script type="text/javascript">
$(function () {/*from ww w .  j  a  va2  s.com*/
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: 'Prevalence of Peformance Enhancing Drug Use By Sport'
        },
        subtitle: {
            text: 'Source: <a href="http://www.samuelwbennett.com">getfast</a>'
        },
        xAxis: {
            type: 'category',
            labels: {
                rotation: -45,
                style: {
                    fontSize: '13px',
                    fontFamily: 'Verdana, sans-serif'
                }
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Prevalence (%)'
            }
        },
        legend: {
            enabled: false
        },
        tooltip: {
            pointFormat: 'PED Prevalence: <b>{point.y:.1f} %</b>'
        },
        series: [{
            name: 'Prevalence',
            data: [
                ['WADA All Pros', 2],
                ['Child Athletes', 4],
                ['HS Football', 6.3],
                ['HS Seniors All Sports', 6.6],
                ['Amatuer Weight-lifters', 8.2],
                ['American Football', 9],
                ['Baseball', 9.4],
                ['Research Estimate All Pros', 10.2],
                ['Top 100 Sprinters (running)', 40],
                ['Professional Bodybuilders', 54],
                ['Tour de France Winners', 79],
            ],
            dataLabels: {
                enabled: true,
                rotation: -90,
                color: '#FFFFFF',
                align: 'right',
                x: 4,
                y: -15,
                style: {
                    fontSize: '13px',
                    fontFamily: 'Verdana, sans-serif',
                    textShadow: '0 0 3px black'
                }
            }
        }]
    });
});

      </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: 500px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials