Create Nested labels in line chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

Create Nested labels in line chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Grouped categories 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" src="https://blacklabel.github.io/grouped_categories/grouped-categories.js"></script> 
      <link rel="stylesheet" type="text/css" href="https://blacklabel.github.io/grouped_categories/css/styles.css"> 
      <script type="text/javascript" src="https://code.highcharts.com/js/highcharts.js"></script> 
      <script type="text/javascript" src="https://blacklabel.github.io/grouped_categories/grouped-categories.js"></script> 
      <script type="text/javascript">
$(function () {/*w  ww.  j av  a 2s  .  com*/
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: "container",
            type: "column"
        },
        title: {
            useHTML: true,
            x: -10,
            y: 8,
            text: '<span class="chart-title"> Grouped categories <span class="chart-href"> <a href="http://www.blacklabel.pl/highcharts" target="_blank"> Black Label </a> </span> <span class="chart-subtitle">plugin by </span></span>'
        },
        series: [{
            data: [4, 14, 18, 5, 6, 5, 14, 15, 18]
        }],
        xAxis: {
            categories: [{
                name: "Fruit",
                categories: ["Apple", "Banana", "Orange"]
            }, {
                name: "Vegetable",
                categories: ["Carrot", "Potato", "Tomato"]
            }, {
                name: "Fish",
                categories: ["Cod", "Salmon", "Tuna"]
            }]
        }
    });
});

      </script> 
   </head> 
   <body> 
      <div id="container" class="chart-container"></div>  
   </body>
</html>

Related Tutorials