highcharts - Highcarts custom legend -
check highcharts legend api options.you can further customize desired css. use proper svg image (background color taken chart itself)
legend: { align: 'right', verticalalign: 'top', layout: 'vertical', x: -50, y: 120, symbolpadding: 0, symbolwidth: 0.1, symbolheight: 0.1, symbolradius: 0, usehtml: true, symbolwidth: 0, labelformatter: function() { if(this.name=="microsoft internet explorer"){ return '<div style="width:200px;"><span style="float:left; margin-left:10px"><img src = "http://cdn.onlinewebfonts.com/svg/img_508736.svg" width = "40px" height = "40px" style="background-color:' + this.color + ';"></span><span style="float:right;padding:9px">' + this.percentage.tofixed(2) + " " + this.y + '%</span></div>'; } if(this.name=="chrome"){ return '<div style="width:200px;"><span style="float:left; margin-left:10px"><img src = "http://cdn.onlinewebfonts.com/svg/img_159842.svg" width = "40px" height = "40px" style="background-color:' + this.color + ';"></span><span style="float:right;padding:9px">' + this.percentage.tofixed(2) + " " + this.y + '%</span></div>'; } if(this.name=="firefox"){ return '<div style="width:200px;"><span style="float:left; margin-left:10px"><img src = "http://cdn.onlinewebfonts.com/svg/img_261106.svg" width = "40px" height = "40px" style="background-color:' + this.color + ';"></span><span style="float:right;padding:9px">' + this.percentage.tofixed(2) + " " + this.y + '%</span></div>'; } }, itemstyle: { color: '#ffffff', fontweight: 'bold', fontsize: '19px' } },
fiddle demo
Comments
Post a Comment