javascript - highcharts, bar chart legend with verticalAlign top not working -


i made bar stacked chart using highcharts , want legend on top, used attribute verticalalign value top didn't work ! here jsfiddle http://jsfiddle.net/rchod/sbtt6/

 $(function () {     $('#container').highcharts({         chart: {             type: 'bar'         },     legend: {         align: 'right',         verticalalign: 'top',         x: 0,         y: 100     },      credits: {         enabled: false     },         title: {             text: ''         },         xaxis: {                         labels: {             enabled: false         },             categories: ['']         },         yaxis: {         labels: {             enabled: true         },             min: 0,             title: {                 text: ''             }         },         legend: {             backgroundcolor: '#ffffff',             reversed: true         },         tooltip: {             enabled: false         },         plotoptions: {             series: {                 minpointlength: 3,                          datalabels: {                 color: 'white',                 align: 'center',                 enabled: true,                 format: '{y} %'               },                 stacking: 'percent'              },             bar: {            events: {                 legenditemclick: function () {                    vote(1,this.useroptions.id);                    return false;                      }                 }             ,             showinlegend: true            }         },             series: [                              {             name: 'yes',             data: [{ y : 73.91, id : '1' }],             id: '1'         },                              {             name: 'no',             data: [{ y : 26.09, id : '2' }],             id: '2'         },              ]     }); }); 

you have legend property twice in options. 2nd 1 overriding first. put them together:

legend: {     backgroundcolor: '#ffffff',     reversed: true,     align: 'right',     verticalalign: 'top',     x: 0,     y: 100 }, 

updated fiddle.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -