我正在使用 amcharts 来呈现一个简单的饼图,我希望饼图从容器的最左侧边缘开始。 我已经通过了 amcharts API,但似乎没有做我需要的事情。 下面你可以看到我正在使用的代码和我得到的图像(在我想要的东西上画了一些红线
am4core.useTheme(am4themes_animated);
// Themes end
var data = [
{
revenueSource: "Fee Revenue",
value: 356
},
{
revenueSource: "Retail Revenue",
value: 247
},
{
revenueSource: "Ticket Revenue",
value: 9876
}
];
var chart1 = am4core.create("chartdiv", am4charts.PieChart);
chart1.hiddenState.properties.opacity = 0;
chart1.data = data;
chart1.innerRadius = am4core.percent(50);
chart1.legend = new am4charts.Legend();
chart1.legend.position = "right";
var series1 = chart1.series.push(new am4charts.PieSeries());
series1.dataFields.value = "value";
series1.dataFields.category = "revenueSource";
series1.ticks.template.disabled = true;
series1.labels.template.disabled = true;
注意。图表在其中呈现的 div 的高度为 400px
,宽度为 100%
最佳答案
chart1.seriesContainer.align = "left";
应该完成这项工作。
关于javascript - 左对齐饼图 (amCharts),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59276111/