首页 > 解决方案 > 如果 Y.axis 相同,Highchart 不显示线条

问题描述

我的highchart仅在值不同时才显示数据线,如果值相同,如本例1100,它只显示1465数据,如一个点。如果数据以连续的方式具有相同的值,则问题出在 Y.axis 上。谢谢你。 高图的结果图像

$( document ).ready(function() {
      var datacharts = ["1100","1100","1100","1100","1100","1100","1100","1100","1100","1100",1465,"1100"];
      Highcharts.chart('container', {
        chart: {
          type: 'line',
          height:500,
          options3d: {
            enabled: true,
            alpha: 15,
            beta: -10,
            viewDistance: 180,
            depth: 100
          }
        },
          title: {
              text: 'Personne 1'
          },

        xAxis: {
          categories: ["mars","avril","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.","janv.","f\u00e9vr."],
          labels: {
            skew3d: true,
            style: {
              fontSize: '16px'
            }
          }
        },

        yAxis: {
          allowDecimals: false,
          min: 800,
          color:'red',
          title: {
            text: 'Prime Par mois',
            skew3d: true
          }
        },


        plotOptions: {
          column: {
            stacking: 'normal',
            depth: 40
          }
        },

        series: [{
          name: 'Data',
          data: datacharts,
          color: '#0e9bb7'
        }]
      });
});
</script>

标签: javascriptphphtmlhighcharts

解决方案


问题是您将数据作为字符串而不是数字传递。尝试这个:

var datacharts = [1100,1100,1100,1100,1100,1100,1100,1100,1100,1100,1465,1100];

在您的示例1465中是唯一一个不是字符串的,因此它在图表上表示。


推荐阅读