簡體   English   中英

Highcharts 餅圖顯示圖例始終為浮動

[英]Highcharts Pie chart display legend always as floating

我用 hightcharts 工作了一段時間,這是一個很棒的圖書館。 但我被餅圖中的傳說困住了。 圖例總是像浮動一樣顯示,但我需要餅圖下的圖例。

我懂了:-/

傳說在飄

我想要這個:D

底部圖例

我的定義是:

Highcharts.chart('container', {
  "chart": {
    "margin": 0,
    "type": "pie",
    "height": 300,
    "backgroundColor": "#FDFDFD",
    "width": 250
  },
  "legend": {
    "floating": false,
    "align": "center",
    "verticalAlign": "bottom",

  },
  "plotOptions": {
    "pie": {
      "dataLabels": {
        "enabled": false,
      },
      "size": "100%",
      "showInLegend": true,

    }
  },
  "title": false,
  "exporting": false,
  "series": [{
    "data": [1, 2, 3, 4, 3, 2, 1]
  }],
});

問題在於margin 將邊距設置為 null,或者刪除此行將被修復。

Highcharts.chart('container', {
  "chart": {
    "margin": null,
  },...
});

額外提示:默認情況下禁用圖例浮動,您也可以刪除此行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM