Highcharts Demo
author(s):
Torstein Hønsi
by subhamgupta026
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<div id="container" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>
JavaScript
Highcharts.chart('container', {
colors: ['red','blue','yellow','pink','green'],
chart: {
type: 'bar'
},
title: {
text: null
},
exporting: {
enabled: false
},
/* tooltip: {
formatter: function () {
return 'The value for <b>' + this.x +
'</b> is <b>' + this.y + '</b>'+' '+ this.series.name + ' '+ this.point.rc;
}
}, */
tooltip: {
// enabled: false
useHTML: true,
formatter: function () {
// show tooltip for actual series and not for the background series
return '<table><tr><td style="padding-bottom: 3px;font-size:12px;font-style:Open Sans;font-weight:600;">'
+ this.x + ' (' + this.y + '%)</td></tr><tr><td style="font-size:12px;font-style:Open Sans;">' +
'Response Count</td><td style="padding-left: 16px;font-size:12px;font-style:Open Sans;">' +
this.point.responseCount + '</td></tr></table>';
}
},
xAxis: {
// categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
ticks: false,
/* minorTickLength: 1,
minorTickWidth: 10,
minorTickInterval: 'auto' */
tickWidth: 0,
labels: {
formatter: function () {
return this.pos+1 + '. '+
this.value ;
},
align: 'left',
reserveSpace: true,
}
},
yAxis: {
min: 0,
title: {
text: null
},
tickInterval: 25,
max: 100,
/* offset: -5
*/
labels: {
format: '{value} %',
align: 'center',
y:0,
}
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'reversed'
}
...