legend width and item width setting - Javascript highcharts

Javascript examples for highcharts:Chart Legend

Description

legend width and item width setting

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
    legend: {/*from w ww.j a  v a  2s  .c o  m*/
        width: 450,
        itemWidth: 150,
    },
    series: [{
        data: [6, 4, 2],
        name: 'First - this one is long'
    }, {
        data: [7, 3, 2],
        name: 'Second'
    }, {
        data: [9, 4, 8],
        name: 'Third'
    }, {
        data: [1, 2, 6],
        name: 'Fourth'
    }, {
        data: [4, 6, 4],
        name: 'Fifth'
    }, {
        data: [1, 2, 7],
        name: 'Sixth'
    }, {
        data: [4, 2, 5],
        name: 'Seventh'
    }, {
        data: [8, 3, 2],
        name: 'Eighth'
    }, {
        data: [4, 5, 6],
        name: 'Ninth'
    }]
});

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

Related Tutorials