钻取时将X轴类型从类别更改为日期时间 [英] Changing X axis type from category to datetime on drilldown

查看:101
本文介绍了钻取时将X轴类型从类别更改为日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在钻取时将图表的X轴类型从类别更改为日期时间?我已经堆积了柱状图形,其中每列是不同的类别。当我点击其中一列时,我想钻取该日期时间x轴的该类别的专用柱状图。

Is it possible to change a graph's x axis type from category to datetime on drilldown? I have stacked column style graph where each column is a different category. When I click on one of the columns I want to drilldown to a dedicated column graph of that category with a datetime x axis.

我已成功钻取到另一列类别样式图,并将每个类别设置为日期范围内的一天,但使用日期时间格式会更好。

I have been able to successfully drilldown to another category style graph, and set each category to a day in a daterange, but using the datetime format would be much better.

以下是我正在运行的onClick代码试图做到这一点。显然,这些数据仅仅是为了保持简单的样本数据。目前,这会导致Firefox内存限制崩溃。

Here is the "onClick" code I am running to try to do this. Obviously the data is sample data just to keep things simple. Currently, this crashes Firefox with a memory limit.

是否可以像这样动态切换x轴类型?

Is it even possible to switch x axis type dynamically like this?

function setChart() {



    while(hChart.series.length > 0){
        hChart.series[0].remove();
    }


    hChart.xAxis[0].update({
        type: 'datetime'
    });

    console.log(hChart.xAxis[0]);


    data = [
            [Date.UTC(2010, 0, 1), 5],
            [Date.UTC(2010, 0, 2), 11],
            [Date.UTC(2010, 0, 3), 3],
            [Date.UTC(2010, 0, 6), 7],
            [Date.UTC(2010, 0, 7), 4],
            [Date.UTC(2010, 0, 8), 1]
    ];
    console.log(data);



    hChart.addSeries({
       type: 'column',
      data: data,
    }, false);

    hChart.redraw();
}


推荐答案

不幸的是,这个选项不可行,您需要销毁并创建新图表。

Unforunately this option is not avaialble, you need to destroy and create new chart.

这篇关于钻取时将X轴类型从类别更改为日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆