我添加如下图表标题
chart[unique].setTitle(nn).setPadding({
bottom: -2,
right: -2,
top: -36,
left: -2
}).setMouseInteractions(false);
如何设置字体大小?我试过 setFont((font) => font.setSize(12))
,但没有用。
我也无法将它添加到legendBox
legendBox["axis"].add(line[name], undefined, ' ').setText(entryname);
,我想为图表标题和图例框条目或完整图例框设置字体大小和颜色。谢谢
答案 0 :(得分:1)
LegendBox 标题和条目可以通过 LegendBox Builder (setTitle
, setEntry
) 的方法设置样式:
const legendBox = ChartXY.addLegendBox(
LegendBoxBuilders.VerticalLegendBox
.setTitle((title) => title
.setFont((font) => font.setFamily('monospace'))
)
.setEntry((entry) => entry
.setFont((font) => font.setSize(10).setStyle('italic'))
),
)
编辑