我想删除 y 轴和图表之间的空间,如下所示:
这是用于创建此图表的小提琴:此图表的 jsFiddle
这是用于设置的代码(与 jsFiddle 相同):
$(function () {
var chart;
$(document).ready(function () {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
spacingLeft: 2,
spacingRight: 2
},
credits: { enabled: false },
title: { text: '' },
yAxis: {
title: '',
labels: {
style: {
fontSize:'9px'
}
}
},
xAxis: { labels: { enabled: false } }, //hide the x axis labels
series: [{
type: 'area',
name: 'speed',
showInLegend: false,
data: [
71.5, 106.4, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 95.6,
71.5, 106.4, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 95.6,
54.4]
}],
/* To make it pretty */
plotOptions: {
area: {
animation: false,
lineWidth: 1,
marker: {
enabled: false,
states: {
hover: {
enabled: true,
radius: 5
}
}
},
shadow: false,
states: {
hover: {
lineWidth: 1
}
},
threshold: null
}
}
});
});
});