我使用Highcharts创建图表:
http://dev.speechlink.co.uk/David/sixthiteration/home.php
然而,当缩放时,它似乎会将图表右侧的部分切掉...我不完全确定为什么......?
这是我的代码:
jQuery的:
chart = new Highcharts.Chart({
chart: {
renderTo: 'summarycontainer',
},
credits: {
enabled: false
},
exporting: {
enabled: false
},
title: {
text: 'No. Entries Submitted This Month',
style: {
fontSize: 10
}
},
xAxis: {
lineWidth: 1,
lineColor: '#999999',
title: {
text: 'x-axis'
}
},
yAxis: {
title: {
text: 'y-axis'
},
labels: {
y: 2
},
lineWidth: 1,
lineColor: '#999999',
gridLineWidth: 1,
gridLineColor: '#eaeaea',
startOnTick: false,
showFirstLabel: false
},
tooltip: {
shared: true
},
legend: {
enabled: false
},
plotOptions: {
},
series: [{
type: 'scatter',
name: '',
data: [10, 20, 10, 20, 2, 3, 1, 9],
lineColor: '#f6a828',
color: '#418ed6'
}],
});
});
在我的HTML中,我有一个div容器:
<div id = "summarycontainer" style="width: 250px; height: 250px"></div>
答案 0 :(得分:1)
在上面的代码中,您有:
data: [10, 20, 10, 20, 2, 3, 1, 9],
并且页面来源是:
data: [10, 20, 10, 20, 2, 3, 1],
也许你认为情节最后一点?
修改强>
将categories: ['', '']
添加到xAxis
:
xAxis: {
categories: ['', ''],
lineWidth: 1,
lineColor: '#999999',
title: {
text: 'x-axis'
}
},
在我看来,highcharts中存在一个错误。
编辑2:
用于格式化工具提示使用(以下仅为示例!):
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': '+ this.y +'°C';
}
},