【问题标题】:Highcharts stacked bar with datetime, not able to set start date带有日期时间的Highcharts堆积条,无法设置开始日期
【发布时间】:2018-02-10 21:28:53
【问题描述】:

我正在尝试使用堆积条来表示一段时间内的向上/向下状态。出于某种原因,我无法让开始日期正常工作。

这就是我想要的,但开始日期不会更新过去的纪元开始。 http://jsfiddle.net/t5d72ka5/4/

Highcharts.chart('container', {
    chart: {
        type: 'bar',
        backgroundColor:'transparent',
        zoomType:'y'
    },
    title: {
        text: ''
    },
    xAxis: {
    },
    yAxis: {
        //min: 1502236800000 or min: Date.UTC(2011, 4, 31) 
        type: 'datetime',
        "tickInterval": 86400000,
        "minTickInterval": 86400000,
        dateTimeLabelFormats: {
            day: '%Y %b %e'
        },
        title: {
            enabled: false
        }
    },
    legend: {
        enabled: false
    },
    plotOptions: {
        series: {
            stacking: 'normal'
        }
    },
    series: [
    {
        name: 'down',
        data: [83621000],
        color: 'red'
    }, {
        name: 'up',
        data: [83621000],
        color: 'green'
    }, {
        name: 'down',
        data: [83621000],
        color: 'red'
    }, {
        name: 'up',
        data: [83621000],
        color: 'green'
    }]
});

我尝试以 min: 1502236800000 或 UTC 为单位添加开始日期,虽然它设置了正确的开始日期,但数据不会呈现。

还对数据值、pointStart 等进行了一些其他尝试,但无法正常工作。

【问题讨论】:

    标签: javascript datetime highcharts stacked


    【解决方案1】:

    我想threshold 选项是您正在寻找的:

      plotOptions: {
        series: {
          stacking: 'normal',
          threshold: 1502236800000
        }
      },
    

    现场演示: http://jsfiddle.net/BlackLabel/jyjfvoac/

    API 参考: https://api.highcharts.com/highcharts/series.column.threshold

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-20
      • 1970-01-01
      • 2016-07-06
      • 1970-01-01
      • 1970-01-01
      • 2020-09-20
      • 2013-12-20
      相关资源
      最近更新 更多