By default legend is displaying at the top-right side of the graph. I want to show it just above the graph. I've used the following code:
legend: {
layout: 'vertical',
align: 'left',
x: 600,
verticalAlign: 'top',
y: 40,
floating: true,
backgroundColor: '#FFFFFF'
}
But it is not working for me. Am I doing anything wrong?
Set legend's layout, align and verticalAlign options as follows: legend: { layout: 'vertical', align: 'right', verticalAlign: 'middle', itemMarginTop: 10, itemMarginBottom: 10 }, By itemMarginTop/Bottom you can control the padding between the legend items.
So best is to add your extraText in data while JSON creating and provide it to highcharts. At chart , it will show in desired format using the the code I posted in answer/fiddle. putting static text for "Extra" won't work in real scenario, so use the code in fiddle jsfiddle.net/wjnnt28p/3.
The legend displays the series in a chart with a predefined symbol and the name of the series. Series can be disabled and enabled from the legend.
Legends are a layout element that tell the map reader the meaning of the symbols used to represent features on the map. Legends can point to any map frame in the layout, but each legend can only reference a single map frame.
Like this:
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
floating: true,
backgroundColor: '#FFFFFF'
},
http://api.highcharts.com/highcharts#legend.verticalAlign http://api.highcharts.com/highcharts#legend.align
Do you want to place legend above whole graph or just above plot? Is that what you need? http://jsfiddle.net/8Qm5a/
Anyway, if you need to place legend above the title, try to change marginTop
of chart settings and set y
settings in title options:
chart: {
marginTop: 100
},
title: {
text: "test",
y: 60
},
http://jsfiddle.net/8Qm5a/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With