gpt4 book ai didi

javascript - 无法强制 float 刻度数

转载 作者:行者123 更新时间:2023-11-29 15:37:10 24 4
gpt4 key购买 nike

JSFiddle代表问题。

我在这里和 Google 上看到了很多解决方案,但它们似乎都不起作用。我已经尝试将 tickSize 设置为 1,将刻度设置为 arraynumber(在本例中为 15),但 flot lib 仍然按照它很高兴。

我已经阅读了很多次 API 文档,我认为我没有遗漏任何内容。

If you want to completely override the tick algorithm, you can specify an array for "ticks", ...

相关代码片段:

xaxis: {
show: true,
ticks: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
}

有人有解决办法吗?随意编辑 JSFiddle 或发表评论。

提前致谢!

最佳答案

我在 series 之外定义了 xaxis 比较幸运。

documentation 中的结构并不完全清楚.

var options = {
series: {
bars: {
show: true,
fill: true,
align: 'center'
},
shadowSize: 0

},
xaxis: {
show: true,
ticks: [[1,'test label'],2,3,4,5,6,7,8,9,10,11,12,13,14,15]
}
};

$(function() {

var options = {
series: {
bars: {
show: true,
fill: true,
align: 'center'
},
shadowSize: 0

},
xaxis: {
show: true,
ticks: [[1,'test label'], 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
}
};

var d2 = [
[1, 25],
[2, 35],
[3, 15],
[4, 13],
[5, 3],
[6, 8],
[7, 5],
[8, 13],
[9, 3],
[10, 8],
[11, 12],
[12, 15],
[13, 7],
[14, 4],
[15, 1]
];

$.plot($("#placeholder"), [d2], options);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script src="http://people.iola.dk/olau/flot/jquery.flot.js"></script>
<h1>Flot Examples</h1>
<div id="placeholder" style="width:600px;height:300px;"></div>

关于javascript - 无法强制 float 刻度数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26661489/

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