代码之家  ›  专栏  ›  技术社区  ›  Shashi

HighChart堆叠条形图滚动条问题

  •  0
  • Shashi  · 技术社区  · 8 年前

    当highstock与堆叠条形图和滚动条一起使用时,有100个类别,当我开始滚动时,我看不到图表上的数据。 它可以很好地工作多达50个类别

    https://jsfiddle.net/shashi3337/5xn92uht/1/

    function test() {
      var data = [];
      for (var i = 0; i < 100; i++) {
        var value = Math.random() * 10;
        var x = {
          id: i,
          name: 'test ' + i,
          y: value
        }
        data.push(x);
      }
      return data;
    }
    
    $('#container').highcharts({
      chart: {
        type: 'column',
      },
      plotOptions: {
        column: {
          stacking: 'normal'
        },
      },
      xAxis: {
        type: 'category',
        max: 10
      },
      scrollbar: {
        enabled: true
      },
      series: [{
          name: "A",
          data: test()
        }, {
          name: "B",
          data: test()
        },
        {
          name: "C",
          data: test()
        },
        {
          name: "D",
          data: test()
        }
      ]
    });
    

    当我滚动回初始位置时,出现了以下错误 调整堆叠柱状图大小时,无法读取未定义“错误”的属性“0”

    1 回复  |  直到 8 年前
        1
  •  -1
  •   Shashi    8 年前

    当您设置cropThreshold参数时,它会起作用。

    plotOptions: {
        column: {
          stacking: 'normal',
          cropThreshold: 10000
        },
      }
    

    https://jsfiddle.net/shashi3337/cbd39oLh/1/