简体   繁体   English

是否可以使用Highcharts将日期导航器添加到列范围图表中?

[英]Is it possible to add the date navigator to a columnrange chart using Highcharts?

I have a columnRange chart with 4 categories that I would like to be able to add the navigator scrollbar at the bottom, or if not possible, create the same chart using the Highstocks library. 我有一个4类类别的columnRange图表,我希望能够在底部添加导航器滚动条,或者,如果不可能的话,请使用Highstocks库创建相同的图表。

This is my code: http://jsfiddle.net/gportela/9rjby/ 这是我的代码: http : //jsfiddle.net/gportela/9rjby/

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'columnrange',
            inverted: true
        },

        title: {
            text: 'Machine Status: Producing'
        },
        subtitle: {
            text: 'Between Dates x and y'
        },
        xAxis: {
            categories: ['Producing', 'Idle', 'Below Rate', 'Changeover']
        },
        yAxis: {
            type: 'datetime',
            dateTimeLabelFormats: { // don't display the dummy year
                month: '%e. %b',
                year: '%b'
            },
            title: {
                text: 'Date'
            }
        },
        legend: {
            enabled: false
        },
        tooltip: {
            formatter: function() {
                return '<b>'+ this.series.name +'</b><br/>'+
                    'Hours: ' + Highcharts.dateFormat('%e. %b (%H:%M', this.point.low) +' - '+ Highcharts.dateFormat('%H:%M', this.point.high) + ')';
            }
        },
        series: [{
            name: 'Hours',
            data: [
                {x:0,low:Date.UTC(2014,  2, 12,7),high:Date.UTC(2014,  2, 12,8),color: "lightgreen"},
                {x:0,low:Date.UTC(2014,  2, 12,10),high:Date.UTC(2014,  2, 12,13),color: "lightgreen"},
                {x:0,low:Date.UTC(2014,  2, 12,17),high:Date.UTC(2014,  2, 12,18),color: "lightgreen"},
                {x:0,low:Date.UTC(2014,  2, 12,19),high:Date.UTC(2014,  2, 12,20),color: "lightgreen"},
                {x:0,low:Date.UTC(2014,  2, 12,22),high:Date.UTC(2014,  2, 12,23),color: "lightgreen"},
                {x:1,low:Date.UTC(2014,  2, 12,15),high:Date.UTC(2014,  2, 12,16),color: "orangered"},
                {x:1,low:Date.UTC(2014,  2, 12,8),high:Date.UTC(2014,  2, 12,9),color: "orangered"},
                {x:2,low:Date.UTC(2014,  2, 12,11),high:Date.UTC(2014,  2, 12,12),color: "GreenYellow"},
                {x:3,low:Date.UTC(2014,  2, 12,19),high:Date.UTC(2014,  2, 12,20),color: "DodgerBlue "}
            ]
        }]

    });

});

Anyone has any idea on how to achieve this? 有人对如何实现这一目标有任何想法吗?

Thanks, 谢谢,

不幸的是,滚动条仅在xAxis的高库存中可用,而在yAxis中不可用(因为它在像您一样的倒排图中)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM