2015-06-19 37 views
0

我有我的情节线的折线图与钻到显示的问题显示的故事情节。如何当只有一个值存在

每一件事工作正常,但是当我在2015年(在这里我只有每行值为1)向下钻取,情节线不显示。

我在this post阅读关于这个问题,但他们禁用y轴的自动缩放所有解决方案都不能接受的。

这里是发生了什么:

正常的图表(前向下钻取)。它完美:

The normal chart (before drill down)

用钻头在2014年(在那里我有每行4个值)的图表。它完美:

The chart with a drill down on 2014 (Where I have 4 values per line)

用钻头向下在2015年(在那里我有每行1倍的值)的图。情节线没有显示出与这两个点在同一位置:

The chart with a drill down on 2015(Where I have 1 value per line)

这是我如何初始化我的图表:

/*Initialisation du chart*/ 
      chart = new Highcharts.Chart({ 
       chart: { 
        renderTo: instanceData.id, 
        type: 'line', 
        alignTicks: false 
       }, 
       title: { 
        text: titre_drill 
       }, 
       subtitle: { 
        text: soustitre_drill 
       }, 
       legend:{ 
        enabled:true 
       }, 
       xAxis: { 
        type: 'category' 
       }, 
       yAxis: [{ 
        title: { 
         text: texte_ordonee_expedie, 
         style: { 
          color: color_expedie 
         } 
        }, 
        plotLines : [{ 
         value : seuil_expedie, 
         color : color_expedie, 
         dashStyle : 'shortdash', 
         width : 2, 
         label : { 
          text : '' 
         } 
        }], 
        labels: { 
         format: '{value} €', 
         style: { 
          color: color_expedie 
         } 
        }, 
        gridLineColor: 'transparent' 
       }, 
       { 
        title: { 
         text: texte_ordonee_packee, 
         style: { 
          color: color_packee 
         } 
        }, 
        plotLines : [{ 
         value : seuil_packee, 
         color : color_packee, 
         dashStyle : 'shortdash', 
         width : 2, 
         label : { 
          text : '' 
         } 
        }], 
        labels: { 
         format: '{value} €', 
         style: { 
          color: color_packee 
         } 
        }, 
        gridLineColor: 'transparent', 
        opposite: true //Pour que le deuxième axe soit à l'opposé du premier 
       }], 
       plotOptions: { 
        line: { 
         cursor: 'pointer', 
         marker: { 
          symbol: 'triangle' 
         }, 
         dataLabels: { 
          enabled: false 
         } 
        } 
       }, 
       tooltip: { 
        formatter: function() { 
         return '<b>'+ this.y +'</b> €<br/>'; 
        } 
       },    
       series: main_data, 
       drilldown: { 
        series: drilldown_series, 
        drillUpButton: { 
         relativeTo: 'spacingBox', 
         position: { 
          y: 0, 
          x: 0 
         } 
        } 
       }, 
       exporting: { 
        enabled: true 
       } 
      }); 

我知道没有任何本地函数在Highcharts到“总是显示”情节线。有没有人有建议,所以我可以在2015年的钻取中显示我的两条情节?

回答

1

如果你想显示在一个点自动缩放不会显示情节主线......你要扰乱自动缩放。情节线无法绕过。

你可以做什么,将与自动缩放轴工作是用线系列,而不是情节线。
如果您希望它的行为类似于情节而不是系列,则可以禁用图例条目,工具提示等。

这样,轴将始终自动缩放以包含您的行。

example

+0

我明白了。我想这是保持自动缩放的最佳解决方案。谢谢 ! – Kabulan0lak

相关问题