图例未在LightningChart JS中显示所有系列

问题描述 投票:0回答:1

图例仅显示序列直至图表高度。如果图表高度为500px,图例的高度也为500px,则剩余的序列值将不显示。如何在图例中显示所有系列值?

例如,即使原始数据有20个序列,图表中也仅显示7个序列名称。enter image description here

javascript lightningchart
1个回答
0
投票

我建议尝试在使用Horizo​​ntal LegendBox和Vertical 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 )

如果这还不够,您还可以尝试将系列分组在legendBox中,这样它们就不会在图表区域之外对齐。

// 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'
© www.soinside.com 2019 - 2024. All rights reserved.