【发布时间】:2014-01-13 21:54:22
【问题描述】:
我正在使用 highcharts 来显示条形图。我有一个固定的图表垂直高度,我希望显示所有 xAxis 标签。 webparts 容器的水平部分响应窗口的大小。我发现在某些水平尺寸下,图例会包裹起来,这似乎会导致我的一些 xAxis 标签被隐藏。我一直找不到任何可以阻止这种情况的设置或设置组合。有谁知道在不改变 webpart 垂直高度的情况下实现这一点的方法?
问题示例jsFiddle。
或下面的示例代码,
HTML:
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 180px; width: 330px; margin: 0 auto"></div>
<div id="container2" style="height: 180px; width: 500px; margin: 0 auto"></div>
Javascript
$(function () {
var options = {
chart: {
type: 'bar'
},
title: {
text: null
},
xAxis: {
categories: ['Data1', 'Data2', 'Data3', 'Data4', 'Data5']
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name:'Due > 7',
data: [29.9, 71.5, 106.4, 129.2, 144.0]
},{
name:'Due < 7',
data: [34.9, 72.1, 99.4, 150.4, 169.1]
},{
name:'Overdue < 7',
data: [29.9, 71.5, 106.4, 129.2, 144.0]
},{
name:'Overdue > 7',
data: [34.9, 72.1, 99.4, 150.4, 169.1]
}]
};
$('#container').highcharts(options);
$('#container2').highcharts(options);
});
【问题讨论】:
标签: highcharts