1

我正在使用这个插件来创建一个饼图。当只有 2 个分区时,标签显示完美,但当它们增加时,仅显示 2 个标签,其余部分没有。我的代码:-

final List<ChartData> chartData=[ChartData('abc;, 15),ChartData('uvw', 15),ChartData('xyz', 15)];

class ChartData {
  ChartData(this.x, this.y, [this.color]);
  final String x;
  final double y;
  final Color color;
}
    SfCircularChart(
                    series: <CircularSeries>[
                      DoughnutSeries<ChartData, String>(
                        dataSource: chartData,
                        pointColorMapper:(ChartData data,  _) => data.color,
                        xValueMapper: (ChartData data, _) => data.x,
                        yValueMapper: (ChartData data, _) => data.y,
                        startAngle: 90,
                        endAngle: 360,
                        dataLabelMapper: (ChartData data, _) => data.x,
                        radius: '45%',
                        dataLabelSettings: DataLabelSettings(
                          isVisible: true,
                          labelPosition: ChartDataLabelPosition.outside,
                          labelAlignment: ChartDataLabelAlignment.auto,
                          textStyle: GoogleFonts.gugi(
                            textStyle: TextStyle(
                            ),
                          ),
                        ),
                      )
                    ]
                ),
4

0 回答 0