get categories values and spacing in label - Javascript highcharts

Javascript examples for highcharts:Chart Label

Description

get categories values and spacing in label

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function() {/* ww  w . jav  a  2  s  .co  m*/
  $('#container').highcharts({
    chart: {
      type: 'column',
      inverted: true
    },
    credits: {
      enabled: false
    },
    title: null,
    subtitle: null,
    xAxis: {
      categories: ["Cluster 5", "Cluster 4", "Cluster 3", "Cluster 2", "Cluster 1"],
      labels: {
        enabled: true,
        useHTML: true,
        formatter: function() {
          return '<div style="margin-left: 120px,width: 100px; background-color: #fa1;"><input type="radio"  style="margin-right: 100px"/>' + this.value + '</div>';
        }
      },
      tickWidth: 0
    },
    yAxis: {
      min: 0,
      max: 250,
      title: {
        useHTML: true,
        formatter: function() {
          return '<div class="ao-assortment-title"><span class="shape" style="width: 40px;height:40px;bacground:green">&nbsp;</span>Sales</div>'
        }
      }
    },
    legend: {
      enabled: false,
    },
    plotOptions: {
      series: {
        allowPointSelect: false,
        paddingLeft: "50px",
        pointInterval: 50,
        dataLabels: {
          align: 'top',
          verticalAlign: "middle",
          enabled: true,
          useHTML: true,
          formatter: function() {
            return "$ " + this.y
          },
          style: {
            fontWeight: "normal",
            textAlign: "center",
            color: "#000"
          }
        }
      },
      styles: {
        minHeight: "200px"
      },
    },
    series: [{
      data: [
        ["1 clusters",0, 51.5],
        ["2 clusters",1, 31.5],
        ["3 clusters",2, 21.5],
        ["4 clusters",3, 71.5],
        ["5 clusters",4, 198]
      ],
      keys: ['name','x','y'],
      color: "#60B3D1"
    }]
  });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div>  
   </body>
</html>

Related Tutorials