c3 js Zoom api域解释
提前抱歉,英语不是我的母语。
我有一个类似于以下内容的json:
{
"Date": "19.09.2021",
"a": "1100",
"b": "29500",
"c": "462",
"d": " 93.3"
}
日期是我的x轴,我想使用c3缩放api来实现x轴上的缩放。
例如,我希望能够缩放到日期“23.12.2021”,
在文档中它说=>;如果给定域,图表将缩放到给定域。如果没有给出参数,则将返回当前的缩放域。
所以我尝试使用以下代码检查给定域内的内容=>
onzoom: function (domain) {
// do something with domain, which is the domain after zoomed
console.log(domain)
var foo = JSON.stringify(domain)
console.log(foo)
}
产生类似的东西 ["2021-12-23T04:11:58.624Z","2021-12-23T07:54:23.405Z"]
document.getElementById("button").onclick = function() {load1()};
function load1(){
//chart.toggle('a')
chart.zoom(["2021-12-23T04:11:58.624Z","2021-12-23T07:54:23.405Z"]);}
sorry in advance, english is not my native language.
I have a json that looks somewhat like the following:
{
"Date": "19.09.2021",
"a": "1100",
"b": "29500",
"c": "462",
"d": " 93.3"
}
Date is my x axis, and i want to use the c3 zoom api to achieve zooming on the x axis.
For example, I want to be able to zoom to date '23.12.2021'
In the documentation it says => If domain is given, the chart will be zoomed to the given domain. If no argument is given, the current zoomed domain will be returned.
So i tried to check what lays inside of given domain with the following code =>
onzoom: function (domain) {
// do something with domain, which is the domain after zoomed
console.log(domain)
var foo = JSON.stringify(domain)
console.log(foo)
}
which produces something like that ["2021-12-23T04:11:58.624Z","2021-12-23T07:54:23.405Z"]
document.getElementById("button").onclick = function() {load1()};
function load1(){
//chart.toggle('a')
chart.zoom(["2021-12-23T04:11:58.624Z","2021-12-23T07:54:23.405Z"]);}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论