2017-03-01 96 views
0

我正在嘗試製作一個高圖,同時具有負值和正值。現在的事情是,與負面價值相比,負面價值並不是很大。修復兩個y軸爲0高圖

這裏是圖的圖片作爲是: graph

現在,如果你同時在y軸上仔細一看,他們不爲0見面,有一個微小的差距。是否有可能使它們都從0開始,但允許它們爲負數?

這是我的代碼:

Highcharts.chart('chart', { 
       chart: { 
        type: 'column' 
       }, 
       title: { 
        text: 'Sales Graph' 
       }, 
       xAxis: { 
        categories: xAxisTicks 
       }, 
       plotOptions: { 
        column: { 
         stacking: 'normal' 
        } 
       }, 
       tooltip: { 
        formatter: function() { 
         debugger; 
         if (this.series.type == "column") { 
          return '<b>' + this.x + '</b><br/>' + 
           this.series.name + ': ' + prettyNumber(this.y) + '<br/>' + 
           'Sales without discount: ' + prettyNumber(this.point.stackTotal); 
         } else { 
          return '<b>' + this.x + '</b><br/>' + 
           this.series.name + ': ' + prettyNumber(this.y) + '<br/>'; 
         } 
        } 
       }, 
       colors: ['yellow', 'orange', 'red', 'blue', 'green', 'red', 'blue', 'green'], 
       yAxis: [ 
       { 
        title: { 
         text: 'Daily sales' 
        }, 
        min: minYAxisValue, 
        startOnTick: false 
       }, { 
        title: { 
         text: 'Accumulated sales' 
        }, 
        min: minYAxisValue, 
        startOnTick: false, 
        opposite: true 
       } 
       ], 
       series: data 
      }); 
+1

你能現場舉一個問題的例子?你可以硬編碼一些數據來顯示問題。此外,你可以檢查插件對齊閾值https://highcharts.uservoice.com/forums/55896-highcharts-javascript-api/suggestions/2554384-multiple-axis-alignment-control - 不知道它是否解決了問題,雖然 – morganfree

回答