2014-10-01 162 views
0

我需要減少紅色列之間的空間。請參閱this code降低高圖中列間的間距

$(function() { 
$('#container').highcharts({ 

    colors: ['#ba0000'], 
    chart: { 
     type: 'column', 
     spacingBottom: 10, 
     spacingTop: 30, 
     spacingLeft: 0, 
     spacingRight: 10, 

     style: { 
      fontFamily: 'MuseoSans-500', 
      fontSize: '14px'     
     }  

    }, 

    title: { 
     text: '' 
    }, 
    subtitle: { 
     text: '' 
    }, 
    xAxis: { 
     categories: [ 
      'YTD', 
      'QTD', 
      'Last Period' 
     ], 
     labels: { 
      style: { 
       fontSize:'14px' 
      } 
     }   
    }, 
    yAxis: { 
     min: 0, 
     title: { 
      text: '%' 
     }, 

     plotLines: [{ 
      color: '#0054a6', 
      width: 2, 
      value: 48, 
      dashStyle: 'Dash', 
     label : { 
        text : 'AVG' 
       }    
     }, 



     { 
      color: '#00ed99', 
      width: 2, 
      value: 65, 
      dashStyle: 'Dash', 
      label : { 
        text : 'GOAL', 

      } 


      }] 

    }, 



    credits: { 
     enabled: false 
    }, 
    tooltip: { 
     headerFormat: '<span style="font-size:1.1em">{point.key}</span><table>', 
     pointFormat: '<tr><td style="color:{series.color};padding:0"></td>' + 
      '<td style="padding:0"><b>{point.y:.1f}%</b></td></tr>', 
     footerFormat: '</table>', 
     shared: true, 
     useHTML: true 
    }, 
    plotOptions: { 
     column: { 

      pointPadding: 0, 
      borderWidth: 0, 
      groupPadding: 0, 
      pointWidth: 50, 
     } 
    }, 
    series: [{ 
     data: [57, 63, 62], 


    }] 
}); 

});

我已經嘗試過Highcharts - How can I decrease space between categories?Space between columns的解決方案,但它並不奏效。我不太確定我錯過了什麼。

謝謝。

回答

5

你需要的屬性groupPadding

 plotOptions: { 
      series: { 
       pointPadding: 0, 
       groupPadding: 0, 
      } 
     }, 

這將徹底消除它們之間的間距。

See the DEMO here

+0

謝謝,但將重疊的兩條虛線情節線,在綠色和藍色。有什麼辦法可以減少空間,但不能重疊這些線條。 – square 2014-10-02 03:01:58

+0

@平行線根據您定義的值被禁用。所以如果你需要更高的價格,請設置不同的價值。 – 2014-10-10 11:17:51

+0

這正是我所尋找的,我有一個柱子stockChart與非常薄的列幾乎不可能鼠標懸停,這是完美的! – Eko3alpha 2016-11-29 17:35:37