是否可以使Highcharts中的预览/滑块/导航器与图形匹配?

时间:2019-01-03 17:32:34

标签: javascript graph highcharts navigation

CloudFlare workers

滑块/导航器中的三行与图形根本不相似。我能做些什么来解决这个问题?我没有在文档中找到任何内容,并且希望将此库保留在我的项目中,但是对于用户来说,在预览中看到完全错误的内容并不是一种很好的体验。谢谢!

代码是标准的:

function createChart() {
    Highcharts.stockChart('container', {

        rangeSelector: {
            selected: 4
        },

        yAxis: {
            labels: {
                formatter: function () {
                    return (this.value > 0 ? ' + ' : '') + this.value + '%';
                }
            },
            plotLines: [{
                value: 0,
                width: 2,
                color: 'silver'
            }]
        },

        plotOptions: {
            series: {
                compare: 'percent',
                showInNavigator: true
            }
        },

        series: seriesOptions
    }); }

$.each(names, function (i, name) {

    $.getJSON('https://www.highcharts.com/samples/data/' + name.toLowerCase() + '-c.json',    function (data) {

        seriesOptions[i] = {
            name: name,
            data: data
        };

        seriesCounter += 1;

        if (seriesCounter === names.length) {
            createChart();
        }
    }); });

enter image description here

1 个答案:

答案 0 :(得分:1)

导航器仅显示真实数据:

    plotOptions: {
        series: {
            //compare: 'percent',
            showInNavigator: true
        }
    },

Fiddle