我一直在使用 Flutter 图表的在线画廊 (https://google.github.io/charts/flutter/gallery.html),但我正在努力为 x 和 y 轴值添加标题。
有人可以帮助我或告诉我如何将标签添加到图表中吗?
最佳答案
可以使用behaviors
属性,检查代码
var chart = charts.LineChart(seriesList,
behaviors: [
new charts.ChartTitle('Dimension',
behaviorPosition: charts.BehaviorPosition.bottom,
titleStyleSpec: chartsCommon.TextStyleSpec(fontSize: 11),
titleOutsideJustification:
charts.OutsideJustification.middleDrawArea),
new charts.ChartTitle('Dose, mg',
behaviorPosition: charts.BehaviorPosition.start,
titleStyleSpec: chartsCommon.TextStyleSpec(fontSize: 11),
titleOutsideJustification:
charts.OutsideJustification.middleDrawArea)
],
defaultRenderer: new charts.LineRendererConfig(includePoints: true));
来源https://google.github.io/charts/flutter/example/behaviors/chart_title
关于charts - 如何在 flutter、x 轴和 y 轴上向图表添加名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50955214/