Javascript examples for highcharts:Chart Legend
custom legend
<html> <head> <title>Highcharts Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .highcharts-legend-item rect { visibility: hidden; } .lnr {/*from w w w .j a v a 2 s . co m*/ width: 50px; height: 50px; } .lnr-smile { fill: #E3297D; } .lnr-neutral { fill: #59BD8B; } .lnr-sad { fill: #1DA4D1; } </style> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://cdn.linearicons.com/free/1.0.0/svgembedder.min.js"></script> <div id="container" style="width: 600px;"></div> <script type="text/javascript"> Highcharts.chart('container', { chart: { type: 'pie', backgroundColor: '#242C33', marginRight: 250 }, title: { text: '' }, credits: { enabled: false }, legend: { enabled: true, useHTML: true, align: 'right', verticalAlign: 'middle', layout: 'vertical', itemMarginTop: 30, itemMarginBottom: 30, x: -20, labelFormatter: function() { var images = [ '<svg class="lnr lnr-smile"><use xlink:href="#lnr-smile"></use></svg>', '<svg class="lnr lnr-neutral"><use xlink:href="#lnr-neutral"></use></svg>', '<svg class="lnr lnr-sad"><use xlink:href="#lnr-sad"></use></svg>' ]; return images[this.index] + ' ' + Math.round(this.percentage) + '% ' + this.y; }, itemStyle: { color: '#FFFFFF', fontSize: '30px', lineHeight: '10px' } }, plotOptions: { series: { dataLabels: { enabled: false } }, pie: { borderWidth: 0, innerSize: 140, startAngle: 60 } }, series: [{ showInLegend: true, data: [{ name: 'woman', color: '#E3297D', y: 322 }, { name: 'men', color: '#59BD8B', y: 298 }, { name: 'child', color: '#1DA4D1', y: 344 }] }] }); </script> </body> </html>