gpt4 book ai didi

javascript - 如何重新缩放时间序列的 x 轴(C3js)?

转载 作者:行者123 更新时间:2023-11-30 21:21:26 25 4
gpt4 key购买 nike

在 C3.js 中,有一种方法可以在放大时重新缩放 y 轴。x 轴是否存在类似的函数?

图表中的类似代码

var visualizeThis = c3.generate({
bindto: '#this',
data: {
x: 'Dates',
columns:[
dates,
dataPoints
]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%m/%d/%Y'
}
}
},
zoom: {
enabled: true,
rescale: true //this only rescales the y-axis
},
point: {
show: false
}
});

最佳答案

在 c3.js 中,缩放会影响 x 轴,如此 example 所示.

如果你还想缩放 y 轴,你可以尝试 zoom.rescale 选项。

zoom: {
enabled: true,
rescale: true
}

关于 jsfiddle 的工作示例.

关于javascript - 如何重新缩放时间序列的 x 轴(C3js)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45150214/

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