簡體   English   中英

左對齊餅圖 (amCharts)

[英]Left align pie chart (amCharts)

我正在使用 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"; 應該做這項工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM