label - amCharts 标签字体设置
问题描述
我的应用程序上有一个样式表,用于设置基线字体。它工作正常,我很满意。
* {
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;
推荐阅读
- php - Laravel {{ auth()->user()->plan['name'] }} 如果为空
- vba - 使用 excel VBA 将 Powerpoint 保存为 PDF
- r - 我们如何选择包含 R 中某一列中信息的 csv 文件行?
- android - 在最近的 Playstore 控制台中修改隐私政策 URL
- javascript - Object 对象被渲染而不是 html
- python - ModuleNotFoundError 仅在终端启动时出现,如何解决?
- azure - 从本地文件系统读取 Azure 审核日志
- scala - scala可以隐式地将2个隐式连接到一个隐式元组中吗?
- php - 仅当类别具有产品 WooCommerce 时才在 foreach 中返回结果
- reactjs - 第一个按钮单击后反应组件不更新