gpt4 book ai didi

highcharts - 删除 yAxis 和 highcharts 中的数据之间的空间

转载 作者:行者123 更新时间:2023-12-04 18:11:01 25 4
gpt4 key购买 nike

我想删除 y 轴和图表之间的空间,如下所示:
enter image description here

这是用于创建此图表的 fiddle :jsFiddle for this chart

这是用于设置的代码(与 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
}
}
});
});

});

最佳答案

正确的做法是设置 offset-15 .

yAxis: {
offset: -15
}

demo

偏移 :
The distance in pixels from the plot area to the axis line. A positive offset moves the axis with it's line, labels and ticks away from the plot area. This is typically used when two or more axes are displayed on the same side of the plot. Defaults to 0.
reference

关于highcharts - 删除 yAxis 和 highcharts 中的数据之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14331112/

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