jQuery 如何在 Highcharts 中移动图例?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17500064/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 19:13:29  来源:igfitidea点击:

How can I move legend in Highcharts?

jqueryhighcharts

提问by PSR

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?

但它对我不起作用。我做错了什么吗?

回答by Sri--

回答by Andrey Nelubin

Do you want to place legend above whole graph or just above plot? Is that what you need? http://jsfiddle.net/8Qm5a/

您想将图例放在整个图形上方还是图上方?那是你需要的吗?http://jsfiddle.net/8Qm5a/

Anyway, if you need to place legend above the title, try to change marginTopof chart settings and set ysettings in title options:

无论如何,如果您需要在标题上方放置图例,请尝试更改marginTop图表设置并y在标题选项中设置设置:

    chart: {
        marginTop: 100
    },

    title: {
        text: "test",
        y: 60
    },

http://jsfiddle.net/8Qm5a/1/

http://jsfiddle.net/8Qm5a/1/