Use images in charts as xAxis labels - Javascript highcharts

Javascript examples for highcharts:Chart Label

Description

Use images in charts as xAxis labels

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Stock Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/highcharts-more.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
var img_path = 'https://www.java2s.com/style/demo/Google-Chrome.png'
Highcharts.chart('container', {
    chart: {//from w  w  w.j a v a2  s . co  m
        polar: true,
        type: 'column'
    },
    xAxis:{
        labels: {
            formatter: function() {
                return '<img src="' + img_path + '" style="width:45px;height:45px;" />';
            },
            useHTML: true,
            align: 'center'
        }
    },
    series:[{
        data: [{x:1, y:4}, {x:2, y:7}, {x:3, y:2}, {x:4, y:5}, {x:5, y:8}]
    }]
});

      </script>  
   </body>
</html>

Related Tutorials