2013-05-27 32 views
5

我使用highcharts創建了一個基本boxplot,它顯示了當我將鼠標懸停時最大值,最小四分位數,中位數,最小四分位數和最小值在箱子陰謀。我想以某種方式在劇情本身旁邊的每一行顯示這些值。Highcharts:在箱形圖中顯示標籤(最小,最大,中位數等)

我檢查了api,發現「dataLabel」會有所幫助,但這並不支持boxplot。有人能告訴我如何實現這一目標嗎?

謝謝。

回答

1

添加另一個數據系列,這是一種「分散」的數據和標籤適用於本系列使用標記傳請求你的建議。訣竅是使用與背景顏色和0行寬相同的填充顏色,因此標記將不可見,只會顯示標籤。

{ 
     name: 'Outlier', 
     color: 'white', 
     type: 'scatter', 
     data: [ // x, y positions where 0 is the first category 
      { 
       name: 'This is my label for the box', 
       x:0, //box index. first one is 0. 
       y:975 //it will be bigger than the maximum value of of the box 
      } 
     ], 
     dataLabels : { 
      align: 'left', 
       enabled : true, 
       formatter : function() { 
        return this.point.name; 
       }, 
      y: 10, 
      }, 
     marker: { 
      fillColor: 'white', 
      lineWidth: 0, 
      lineColor: 'white' 
     } 
    } 
1

不可能開箱即用,但正如Steve Gu所提到的那樣,可以通過scatter實現。您甚至可以忽略格式化程序並全部禁用標記:

{ 
    series: [ 
    { 
     type: 'scatter', 
     tooltip: { 
     enabled: false 
     }, 
     dataLabels: { 
     format: '{key}', 
     enabled: true, 
     y: 0, 
     }, 
     data: [{ x: 0, y: 975, name: '975'}], 
     marker: { 
     enabled: false, 
     } 
    } 
    ] 
} 

只是禁用標記並將格式設置爲鍵。

相關問題