Highcharts Symbol in Legend

泄露秘密 提交于 2019-12-10 16:27:19

问题


I have a highcharts legend where the symbols are displaying with varying sizes as they are different sizes in the actual chart. Unfortunately, when the sizes of the data points grow, they also grow in the legend. I want the legend symbols to remain the same size regardless of the data point size.

Here is an example where the data points have grown with the graph. In case it matters, the actual graph I'm using is a scatter plot (unlike the example).

http://jsfiddle.net/RsUhk/

Any help is much appreciated!


回答1:


This is a little hacky but it's the best I can come up with. After you draw the plot, manually adjust the legend symbols:

$(chart.series).each(function(){
    this.legendSymbol.attr('width',8);
    this.legendSymbol.attr('height',8);
    this.legendSymbol.attr('x',this.legendLine.attr('translateX')-17);
    this.legendSymbol.attr('y',this.legendLine.attr('translateY')-4);
});

Updated fiddle here.



来源:https://stackoverflow.com/questions/10551727/highcharts-symbol-in-legend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!