add different colors to legend in one series histogram - Javascript highcharts

Javascript examples for highcharts:Chart Legend

Description

add different colors to legend in one series histogram

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="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function () {//from w ww .  ja v  a2s . c o  m
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
            type: 'column'
        },
        title: {
            text :'Beta histogram for sample'
        },
        xAxis: {
            title: {
                    enabled: true,
                    text: 'V Genes'
             },
            categories:
                ['first', 'second', 'third'],
            labels: {
                    align: 'left',
                    rotation: 45,
                    overflow: 'justify'
                }
        },
         yAxis: {
                title: {
                    text: 'Percentage'
                }
         },
        plotOptions: {
                column: {
                    cursor: 'pointer',
                }
            },
            tooltip: {
                formatter: function() {
                  s = '<b>V Gene: </b>' + this.x + '<br/><b>%</b> : ' + this.y + '<br/>' +
                         '<b>Count: </b>' + this.point.count+ '</b>';
                    return s;
                }
            },
        series: [
            { name: 'V Genes',
              color: '#3D96AE',
            data: [{count: 400, y: 10, x: 1}]
        }, {
            name: 'Serie 2',
            color: '#4572A7',
            data: [{count: 300, y: 5, x: 0}, {count: 500, y: 15, x: 2}]
        }]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div>  
   </body>
</html>

Related Tutorials