【问题标题】:Left align pie chart (amCharts)左对齐饼图 (amCharts)
【发布时间】:2019-12-10 22:11:07
【问题描述】:

我正在使用 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%

【问题讨论】:

    标签: javascript amcharts


    【解决方案1】:

    chart1.seriesContainer.align = "left"; 应该做的工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多