簡體   English   中英

圖例未在 LightningChart JS 中顯示所有系列

[英]Legend not showing all series in LightningChart JS

圖例僅顯示達到圖表高度的系列。 如果圖表的高度為 500 像素,圖例的高度也是 500 像素,因此不會顯示剩余的系列值。 如何在圖例中顯示所有系列值?

例如,即使原始數據有 20 個系列,圖表中也只顯示了 7 個系列名稱。 在此處輸入圖片說明

我建議嘗試使用水平 LegendBox 和垂直 LegendBox 構建器。 您可以通過在 LegendBox 創建期間傳遞LegendBoxBuilder來完成此操作

// Align legendBox entries vertically, with groups aligned horizontally
const legendBox = chart.addLegendBox( LegendBoxBuilders.HorizontalLegendBox )
// Align legendBox entries horizontally, with groups aligned vertically
const legendBox = chart.addLegendBox( LegendBoxBuilders.VerticalLegendBox )

如果這還不夠,您還可以嘗試在圖例框中對系列進行分組,這樣它們就不會在圖表區域之外對齊。

// Add a series to a legendBox, attach it to a specific group
legendBox.add(
  // Series to attach to the legendBox.
  series1,
  // Boolean to set if clicking on the checkbox should hide/show the series attached.
  true,
  // Group name the entry should be grouped under; if no group with the name exists, it is created. If left empty, entry will be grouped under 'undefined group'.
  'Group 1'
)

// Add a series to a legendBox, set it to a second group
legendBox.add(
  series6,
  true,
  'Group 2'

暫無
暫無

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

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