图例仅显示直到图表高度的系列。如果图表高度为 500 像素,则图例的高度也是 500 像素,因此未显示剩余的系列值。如何在图例中显示所有系列值?
问问题
64 次
1 回答
0
我建议在使用 Horizontal 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'
于 2020-01-24T08:16:43.393 回答