c3 js Zoom api域解释

发布于 2025-01-12 07:04:30 字数 884 浏览 0 评论 0原文

提前抱歉,英语不是我的母语。

我有一个类似于以下内容的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文