最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Highcharts navigator error: Invalid negative value for <rect> attribute width - Stack Overflow

programmeradmin3浏览0评论

Does anyone know why I am seeing this error - "error: Invalid negative value for attribute width" while using the Highstock navigator? Please see this JsFiddle for my code - /

var chart = new Highcharts.StockChart({
    chart: {
        renderTo: 'container',
        height: 120
    },
    navigator: {
        series: {
            data: chartData
        }
    },
    series: [{
        data: [null],
        markers: {
            enabled:true
        }
    }]
});

Does anyone know why I am seeing this error - "error: Invalid negative value for attribute width" while using the Highstock navigator? Please see this JsFiddle for my code - http://jsfiddle/Yrygy/250/

var chart = new Highcharts.StockChart({
    chart: {
        renderTo: 'container',
        height: 120
    },
    navigator: {
        series: {
            data: chartData
        }
    },
    series: [{
        data: [null],
        markers: {
            enabled:true
        }
    }]
});
Share Improve this question asked Nov 3, 2014 at 19:44 vikasraovikasrao 951 silver badge10 bronze badges 2
  • I think it's because your series data is null. If you add data to the series, the error goes away. – Barbara Laird Commented Nov 3, 2014 at 20:10
  • @BarbaraLaird yes but if you do that, the rangeselector bees un-usable. – vikasrao Commented Nov 3, 2014 at 22:50
Add a ment  | 

2 Answers 2

Reset to default 4

Your data is all on one day. The minRange of highstock is one day by default. So, the reason it appears your rangeselector is unusable when you have your data correctly defined within the series is that you are already zoomed into one day.
Move the data from the navigator to a series and change the xAxis minRange to be a smaller number (I choose 1 minute)

var chart = new Highcharts.StockChart({
    chart: {
        renderTo: 'container'
    },
    series: [{
        data: chartData,
        markers: {
            enabled:true
        }
    }],
    xAxis : {
        minRange: 60 * 1000 // one minute
    },
});

http://jsfiddle/blaird/Yrygy/256/

I have this error when I used navigator.series.setData(). All you need is set min and max values with chart.xAxis[0].setExtremes(min, max)

发布评论

评论列表(0)

  1. 暂无评论