Once again exploring Amcharts V4 and i get to display legend in amcharts v3 with value numbers like this (believe is standard)
"legend":{ "position":"left", "fontSize": 22, },
But in V4 in the documentation the session about Legend values isn't pleted, and when i declare the standard is in percentage
pieChart.legend = new am4charts.Legend()
Image of a legend in Amcharts V3 and Amcharts V4
thanks in advance =)
Once again exploring Amcharts V4 and i get to display legend in amcharts v3 with value numbers like this (believe is standard)
"legend":{ "position":"left", "fontSize": 22, },
But in V4 in the documentation the session about Legend values isn't pleted, and when i declare the standard is in percentage
pieChart.legend = new am4charts.Legend()
Image of a legend in Amcharts V3 and Amcharts V4
thanks in advance =)
Share Improve this question asked May 22, 2018 at 14:15 Leandro MurtaLeandro Murta 531 gold badge2 silver badges8 bronze badges2 Answers
Reset to default 6You can change template text in amCharts v4 pie chart by :
pieSeries.labels.template.text = "{category}: {value}";
pieSeries.slices.template.tooltipText = "{category}: {value}";
what worked for me is passing in the value into the legend like so:
let pieSeries = chart.series.push(new am4charts.PieSeries());
pieSeries.legendSettings.labelText = '{category}';
pieSeries.legendSettings.valueText = '{value}';
this assumes your data is something like
const data = [{
category: "hotdogs",
value: 33
}]