How to create a table for Stacked Chart legend in Highcharts?
This is the javascript code of a stack chart in highchart -
legend: {
align: 'right',
x: -70,
verticalAlign: 'top',
y: 20,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
Here are some of my data -
series: [{
name: 'A',
data: [5]
}, {
name: 'B',
data: [2]
}, {
name: 'C',
data: [3]
}]
Is it possible to show the legend above Highcharts data (stacked chart) in table format?
+3
source to share
1 answer
High quality charts (tabular) in tabular format
http://jsfiddle.net/ntg7qz3q/1/
working script
$(function () {
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['A', 'B', 'C']
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
}
},
legend: {
align: 'right',
x: -70,
verticalAlign: 'top',
y: 20,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'A',
data: [5]
}, {
name: 'B',
data: [2]
}, {
name: 'C',
data: [3]
}]
});
});
-1
source to share