在 lightningchart 中隐藏 legendbox 标题
Hiding legendbox title in lightningchart
我们如何隐藏 legendbox 中的标题并删除顶部的填充。
const lb = chart.addLegendBox()
lb.setPosition({
x: 50,
y: 50
})
const entry = lb.add(series, undefined, 'Legend Box')
如果我替换上面的 'Legend Box'
,我会得到未定义的组作为标题。
此时无法删除LegendBox的标题
您可以尝试的一些事情:
- 传递空字符串 ' ' 而不是 undefined
- 尝试负填充、边距
- 创建您自己的 LegendBox(制作 Layout UIElement,向其添加 CheckBox 元素,使用
series.attach
将 CheckBox 附加到系列)
在 v3.0.0 版本中(本月底),LegendBox 标题将有适当的 API。
编辑
创建 Layout、CheckBox 并将其附加到系列的一般语法:
const customLegendBox = chart.addUIElement(UILayoutBuilders.Column)
const entry1 = customLegendBox.addElement(UIElementBuilders.CheckBox)
mySeries.attach(entry1)
我们如何隐藏 legendbox 中的标题并删除顶部的填充。
const lb = chart.addLegendBox()
lb.setPosition({
x: 50,
y: 50
})
const entry = lb.add(series, undefined, 'Legend Box')
如果我替换上面的 'Legend Box'
,我会得到未定义的组作为标题。
此时无法删除LegendBox的标题
您可以尝试的一些事情:
- 传递空字符串 ' ' 而不是 undefined
- 尝试负填充、边距
- 创建您自己的 LegendBox(制作 Layout UIElement,向其添加 CheckBox 元素,使用
series.attach
将 CheckBox 附加到系列)
在 v3.0.0 版本中(本月底),LegendBox 标题将有适当的 API。
编辑
创建 Layout、CheckBox 并将其附加到系列的一般语法:
const customLegendBox = chart.addUIElement(UILayoutBuilders.Column)
const entry1 = customLegendBox.addElement(UIElementBuilders.CheckBox)
mySeries.attach(entry1)