amCharts标签字体设置

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

我的应用程序上有一个样式表,可以设置一个基线字体。它工作得很好,我对它很满意。

* {
    font-family: Roboto, sans-serif;
    font-size: 13px;
}

我正在向饼图的中心添加一个标签。标签被正确地添加了,但fontSize没有效果。我认为如此明确的做法会覆盖任何其他样式,但它没有?

chartOverviewAnimatedCenterLabel = chartOverviewAnimated.seriesContainer.createChild(am4core.Label);
chartOverviewAnimatedCenterLabel.text = "";
chartOverviewAnimatedCenterLabel.horizontalCenter = "middle";
chartOverviewAnimatedCenterLabel.verticalCenter = "middle";
chartOverviewAnimatedCenterLabel.fontSize = 50;
chartOverviewAnimatedCenterLabel.id = "center";
label amcharts
1个回答
0
投票

你必须在坐标轴上定义字体大小,就像这样

let categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.renderer.labels.template.fontSize = 8;
© www.soinside.com 2019 - 2024. All rights reserved.