简体   繁体   English

Highstock导航器步骤类似于父图表

[英]Highstock navigator step like the parent chart

I am using Highstock to visualize some data for my web application. 我正在使用Highstock来可视化我的Web应用程序的一些数据。

The data is displayed as steps (that is one value is held until a new one takes over), however the navigator of Highstock seems to use the spline algorithm on the data. 数据以步长显示(即保留一个值,直到新值接管为止),但是Highstock的导航器似乎在数据上使用了样条算法。 I would rather like it to display as "blocks" like the main chart. 我希望它像主图表一样显示为“块”。

I have tried adding step: "true" to navigator.series in the options, but it does not seem to matter. 我尝试在选项中的navigator.series中添加步骤:“ true”,但这似乎无关紧要。

Does anyone know a way to do this with the Highstock API? 有人知道使用Highstock API做到这一点的方法吗? I have been digging into the documentation for a while without any luck. 一段时间以来,我一直在仔细阅读文档。

Code used to initialize highstock chart: 用于初始化高库存图表的代码:

$('#container').highcharts('StockChart', {


    rangeSelector: {
        inputEnabled: true,
        selected: 0,
        buttons: [{
            type: 'day',
            count: 1,
            text: 'Day'
        }, {
            type: 'week',
            count: 1,
            text: 'Week'
        }]

    },

    series: [{
        name: 'Light level',
        data: data,
        type: 'area',
        step: true,
        threshold: null,
        tooltip: {
            valueDecimals: 2
        },
        fillColor: {
            linearGradient: {
                x1: 0,
                y1: 0,
                x2: 0,
                y2: 1
            },
            stops: [
                [0, "#fff800"],
                [1, Highcharts.Color("#fff800").setOpacity(0).get('rgba')]
            ]
        }
    }],

    yAxis: {
        labels: {
            formatter: function () {
                if (this.value > 0) return "" + this.value + "%";
                return "";
            }
        },
        plotLines: [{
            value: 0,
            color: 'green',
            dashStyle: 'shortdash',
            width: 2,
            label: {
                text: '0%',
                align: "right"
            }
        }, {
            value: 100,
            color: 'red',
            dashStyle: 'shortdash',
            width: 2,
            label: {
                text: '100%',
                align: "right"
            }
        }],
        tickPositions: [0, 25, 50, 75, 100]
    },
    credits: {
        enabled: false
    },
    navigator: {
        //enabled: false
    }
});

I have also created a jsfiddle with example data. 我还用示例数据创建了一个jsfiddle。 http://jsfiddle.net/EJZ5x/ http://jsfiddle.net/EJZ5x/

According to docs - step option isn't supported. 根据文档 -不支持step选项。

However, when you set directly type for navigator, it works! 但是,当您直接设置导航器的type ,它将起作用! See: http://jsfiddle.net/EJZ5x/1/ 请参阅: http//jsfiddle.net/EJZ5x/1/

    navigator: {
        series: {
            type: 'area',
            step: 'left' 
        }
    }

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

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