Highstock导航仪不可调节

时间:2018-05-08 18:15:29

标签: highcharts highstock

我有一个Highstock图表,其中包含几个系列以及几个月内每个系列的几个数据点。我希望能够在导航窗口中调整选择,但我不能。

var seriesOptions = [
    {
    name: 'Apples',
    data: [
        {x: 1525737600000, y: Math.floor(Math.random() * 30)},
        {x: 1535737600000, y: Math.floor(Math.random() * 30)},
        {x: 1545737600000, y: Math.floor(Math.random() * 30)}
    ]
  },
    {
    name: 'Oranges',
    data: [
        {x: 1525737600000, y: Math.floor(Math.random() * 30)},
        {x: 1535737600000, y: Math.floor(Math.random() * 30)},
        {x: 1545737600000, y: Math.floor(Math.random() * 30)}
    ]
  },
    {
    name: 'Grapes',
    data: [
        {x: 1525737600000, y: Math.floor(Math.random() * 30)},
        {x: 1535737600000, y: Math.floor(Math.random() * 30)},
        {x: 1545737600000, y: Math.floor(Math.random() * 30)}
    ]
  }
];

function createChart() {

    Highcharts.stockChart('container', {

        plotOptions: {
            series: {
                showInNavigator: true
            }
        },

        tooltip: {
            pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>',
            valueDecimals: 0
        },

        series: seriesOptions
    });
}

createChart();

这里是fiddle

1 个答案:

答案 0 :(得分:0)

这是因为您没有足够的数据:

{
  name: 'Oranges',
  data: [
    {x: 1525737600000, y: Math.floor(Math.random() * 30)},
    {x: 1528737600000, y: Math.floor(Math.random() * 30)},
    {x: 1530737600000, y: Math.floor(Math.random() * 30)},
    {x: 1533737600000, y: Math.floor(Math.random() * 30)},
    {x: 1535737600000, y: Math.floor(Math.random() * 30)},
    {x: 1538737600000, y: Math.floor(Math.random() * 30)},
    {x: 1540737600000, y: Math.floor(Math.random() * 30)},
    {x: 1540737600000, y: Math.floor(Math.random() * 30)},
    {x: 1545737600000, y: Math.floor(Math.random() * 30)}
  ]
}

Fiddle