简体   繁体   English

更改图例符号的大小

[英]Change size of legend symbol

How do I change the size of the symbols in the legend?如何更改图例中符号的大小? Right now they look like this:现在它们看起来像这样:

在此处输入图片说明

I would like them to be squares approximately the same size as the titles.我希望它们是与标题大小大致相同的正方形。 After looking at the docs, I thought changing symbolHeight, symbolRadius and symbolWidth would do the trick, but it doesn't.查看文档后,我认为更改symbolHeight、symbolRadius 和symbolWidth 可以解决问题,但事实并非如此。 In fact these parameters don't change anything at all, as far as I can see.事实上,据我所知,这些参数根本没有改变任何东西。

If you are using line series, you need change its legend symbol to column series legend symbol.如果您使用的是线系列,则需要将其图例符号更改为列系列图例符号。 Then you can use symbolHeight , symbolWidth and symbolRadius properties.然后您可以使用symbolHeightsymbolWidthsymbolRadius属性。

API Reference: API参考:
http://api.highcharts.com/highcharts/legend.symbolHeight http://api.highcharts.com/highcharts/legend.symbolHeight
http://api.highcharts.com/highcharts/legend.symbolWidth http://api.highcharts.com/highcharts/legend.symbolWidth
http://api.highcharts.com/highcharts/legend.symbolRadius http://api.highcharts.com/highcharts/legend.symbolRadius

Example:例子:
http://jsfiddle.net/x2vk088m/ http://jsfiddle.net/x2vk088m/

No working demo provided using official spline-plot-bands demo没有使用官方样条曲线带演示提供工作演示

You can use css to achieve the requirement您可以使用css来实现要求

.highcharts-legend-item path{
  stroke-width:10
}

fiddle demo小提琴演示

Just use symbolHeight, symbolWidth in your config...只需在您的配置中使用symbolHeight、symbolWidth ...

Something like this:像这样的东西:

 ////////
    legend: {
        align: 'left',
        rtl: false,
        verticalAlign: 'top',
        useHTML: true,
        itemStyle: {
            'cursor': 'default',
            'font-weight': 'normal'
        },
        symbolWidth: 10, <<<<<//HERE
        symbolHeight: 2, <<<<<//HERE
        symbolRadius: 0, //creating square legend,
        labelFormatter: function() {
          return this.name;
        }
    },
/////

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM