在Flutter圆图中显示图例

时间:2019-12-08 03:21:53

标签: flutter

我正在使用flutter_circular_chart:^ 0.1.0。我需要在图表中添加图例,但不确定如何添加。

我尝试检查https://pub.dev/packages/flutter_circular_chart中的文档,但似乎没有记录。

这是我代码的一部分。

List<CircularStackEntry> data = <CircularStackEntry>[
  new CircularStackEntry(
    <CircularSegmentEntry>[
      new CircularSegmentEntry(100.0, Colors.red[200], rankKey: 'Q1'),
      new CircularSegmentEntry(10.0, Colors.green[200], rankKey: 'Q2'),
      new CircularSegmentEntry(20.0, Colors.blue[200], rankKey: 'Q3'),
      new CircularSegmentEntry(60.0, Colors.yellow[200], rankKey: 'Q4'),
    ],
    rankKey: 'Quarterly Profits',
  ),
];

new AnimatedCircularChart(
  key: _chartKey,
  size: const Size(500.0, 500.0),
  initialChartData: this.data,
  holeRadius: 25.0,
  duration: Duration(seconds: 5),
  chartType: CircularChartType.Radial,
  holeLabel: '1/3',
  labelStyle: new TextStyle(
    color: Colors.blueGrey[600],
    fontWeight: FontWeight.bold,
    fontSize: 24.0,
  ),
)

0 个答案:

没有答案