简体   繁体   中英

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. 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.

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

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

No working demo provided using official spline-plot-bands demo

You can use css to achieve the requirement

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

fiddle demo

Just use symbolHeight, symbolWidth in your config...

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;
        }
    },
/////

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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