如何在波动图上添加标签?

时间:2019-08-31 09:34:23

标签: android flutter dart

我尝试Charts_flutter:^ 0.6.0依赖项, 该图表效果很好。

但我想在图表中为x轴和y轴添加标签。 标签,如评分和这张照片中的条目数。
charts.BarChart(
              _seriesData,
              animate: true,
              behaviors: [new charts.SeriesLegend()],
              animationDuration: Duration(seconds: 3),
            )

1 个答案:

答案 0 :(得分:0)

假设尚未在官方文档中找到任何解决方案:https://pub.dev/documentation/flutter_charts/latest/

用堆栈小部件包装小部件并向其添加文本小部件:

Stack(
  children: <Widget>[
    AnimatedPositioned(
      // use top,bottom,left and right property to set the location and Transform.rotate to rotate the widget if needed
child : Text("Title comes here"),
duration : Duration(seconds:3),
),
charts.BarChart(
              _seriesData,
              animate: true,
              behaviors: [new charts.SeriesLegend()],
              animationDuration: Duration(seconds: 3),
            ),
]
)