gpt4 book ai didi

highcharts - 如何在 highcharts 中包装图例项目?

转载 作者:行者123 更新时间:2023-12-03 21:01:16 25 4
gpt4 key购买 nike

我在使用 highcharts 时遇到了一个大问题,因为如果它们很长,我已经尝试了几个小时来包装图例项目。

我试图设置图例和图例项目宽度,但我的文字仍然从图例中出来。我发现的唯一一件事就是改变 highcharts.src.js但我认为这不是解决这个问题的方法。

这是我的代码:

<script type="text/javascript">
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'graph_container',
defaultSeriesType: 'line',
zoomType: 'y',
marginRight: 130,
marginBottom: $ {
marginBottom
}
},
title: {
x: -10,
text: null
},
xAxis: {
title: {
text: '<fmt:message key="html.time" bundle="${msg}"/>',
align: 'high'
},
categories: [$ {
years
}]
},
yAxis: {
title: {
text: '<fmt:message key="html.value" bundle="${msg}"/>',
align: 'high'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
style: {
fontSize: '9pt',
width: '400px', //,
wrap: 'hard'
},
formatter: function() {
return '<b>' + this.series.name + '<br>' +
+this.x + ': ' + this.y + '</b>';
}
},
legend: {
layout: 'vertical',
width: 600,
floating: true,
align: 'center',
verticalAlign: 'bottom',
borderWidth: 1,
itemWidth: '500px'

},
credits: {
enabled: false
},
exporting: {
enabled: false
},
series: [ <
c: forEach items = "${graphValues}"
var = "value"
varStatus = "counter" >
<
c: if test = "${counter.count != 1}" > , < /c:if> {
name: '${value.name}',
data: $ {
value.jsonData
}
} <
/c:forEach>
]
});


});
</script>

最佳答案

您可以使用:

legend: {
itemStyle: {
width: 90 // or whatever
},
}

Highcharts 会为您包装元素。

关于highcharts - 如何在 highcharts 中包装图例项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6611832/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com