我的应用程序上有一个样式表,可以设置一个基线字体。它工作得很好,我对它很满意。
* {
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";
你必须在坐标轴上定义字体大小,就像这样
let categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.renderer.labels.template.fontSize = 8;