0

I have a stylesheet on my app that sets a baseline font. It works fine and I'm happy with it.

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

I'm adding a label to the center of a pie chart. The label is added correctly, but fontSize has no effect. I would think that being so explicit would override any other styles, but it doesn't?

chartOverviewAnimatedCenterLabel = chartOverviewAnimated.seriesContainer.createChild(am4core.Label);
chartOverviewAnimatedCenterLabel.text = "";
chartOverviewAnimatedCenterLabel.horizontalCenter = "middle";
chartOverviewAnimatedCenterLabel.verticalCenter = "middle";
chartOverviewAnimatedCenterLabel.fontSize = 50;
chartOverviewAnimatedCenterLabel.id = "center";
Java North
  • 43
  • 1
  • 6

1 Answers1

1

You have to define font size on axis. something like this

let categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.renderer.labels.template.fontSize = 8;
amansoni211
  • 889
  • 2
  • 13
  • 30