Highchart area with date pointStart

i'm trying to build a area chart with single data series and date pointStart

enter image description here

now i'm trying to change plotOption.area.pointStart as new Date(epoch*1000) format, my current code is :

Highcharts.chart('container', {
    chart: {
        type: 'area'
    },
    title: {
        text: ''
    },
    xAxis: {
        type: 'datetime',
        tickInterval: 24 * 3600 * 1000
    },
    yAxis: {
        title: {
            text: ''
        },
        labels: {
            formatter: function () {
                return this.value / 1000 + 'k';
            }
        }
    },
    tooltip: {
        pointFormat: '{series.name} had stockpiled <b>{point.y:,.0f}</b><br/>warheads in {point.x}'
    },
    plotOptions: {
        area: {
            pointStart: new Date(1562716800*1000),
            pointInterval: 24 * 3600 * 1000,
            marker: {
                enabled: false,
                symbol: 'circle',
                radius: 2,
                states: {
                    hover: {
                        enabled: true
                    }
                }
            }
        }
    },
    series: [{
        name: 'Incoming Chat',
        showInLegend: false,
        data: [245, 212, 0]
    }]
});

i don't know but the chart only show single date like :

enter image description here

Upvotes: 0

Views: 713

Answers (1)

pointStart is actually only receive a epoch int, here the wanted version

Highcharts.chart('container', {
    chart: {
        type: 'area'
    },
    xAxis: {
        type: 'datetime'
    },

    plotOptions: {
        series: {
            pointStart: 1562716800*1000,
            pointInterval: 24 * 3600 * 1000 // one day
        }
    },

    title: {
      text: ''
    },

    series: [{
        data: [5325,1631,23]
    }]
});

Upvotes: 1

Related Questions