Make the legend symbol a square or rectangle for line chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

Make the legend symbol a square or rectangle for line chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.js"></script> 
      <script type="text/javascript">
$(function () {/*from  ww  w .  j  a v a  2s  .  c o  m*/
    var chart = new Highcharts.Chart({
        chart: {
        renderTo: 'container',
        type: 'line',
        },
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },
        plotOptions: {
            series: {
                marker: {
                    enabled: true
                }
            }
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
        },
        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
            showInLegend : false,
            marker:{enabled:false}
        },{
            name : "testing",
            data : {},
            marker : {symbol : 'square',radius : 12 }
        }
                ]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
      http://jsfiddle.net/anchika/5dtjh4ws/1/#run  
   </body>
</html>

Related Tutorials