Легенда не отображает все серии в LightningChart JS - PullRequest
0 голосов
/ 22 января 2020

Легенда показывает только серии до высоты графика. Если высота диаграммы равна 500px, высота легенды также равна 500px, поэтому оставшиеся значения серии не отображаются. Как показать все значения серии в легенде?

Например, на диаграмме показаны только 7 названий серий, хотя исходные данные содержат 20 серий. enter image description here

1 Ответ

0 голосов
/ 24 января 2020

Я бы посоветовал попробовать использовать компоновщики Horizontal LegendBox и Vertical LegendBox. Вы можете сделать это, передав LegendBoxBuilder во время создания legendBox

// 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'
...