flutter - chart_flutter:如何使用 Flutter Chart 做折线图重叠 y 轴标签?
问题描述
谁能帮我解决这个问题?我正在使用 charts_flutter 库,希望图表与 y 轴标签重叠。
库:https ://pub.dev/packages/charts_flutter
这是我的代码:
TimeSeriesChart(
seriesList,
dateTimeFactory: const LocalDateTimeFactory(),
animate: animate,
domainAxis: DateTimeAxisSpec(
renderSpec: GridlineRendererSpec(
labelStyle: new TextStyleSpec(
fontSize: MyDimens.chart_text_size, //
color: labelColor),
lineStyle: LineStyleSpec(
thickness: 0, color: MaterialPalette.transparent)),
),
primaryMeasureAxis: new NumericAxisSpec(
tickFormatterSpec: simpleCurrencyFormatter,
tickProviderSpec: new BasicNumericTickProviderSpec(
zeroBound: false,
dataIsInWholeNumbers: false,
desiredTickCount: MyDimens.chart_desired_tick_count,
),
renderSpec: new GridlineRendererSpec(
// Tick and Label styling here.
labelStyle: new TextStyleSpec(
fontSize: MyDimens.chart_text_size, //
color: labelColor),
// Change the line colors to match text color.
lineStyle: new LineStyleSpec(color: lineColor),
labelAnchor: TickLabelAnchor.after,
labelJustification: TickLabelJustification.inside,
)),
)
解决方案
设置zeroBound
参数为true
推荐阅读
- domain-driven-design - 将遗留数据库迁移到 cqrs/事件源视图
- javascript - 有人能告诉我如何只对嵌套在我的 JavaScript 数组中的一些项目求和吗?
- json - Bigquery:从 json 数组中提取数据
- c# - 为什么分配的内存比预期的多?
- python - Python在逗号分隔的字符串中添加引号?
- excel - 来自另一张纸的间接
- vb.net - 如何防止重复减法?
- node.js - 是否可以通过 Node 或 Shell 脚本向 bash_profile 添加行?
- angular - ionic 4 表单控制问题未在输入中显示值
- c++ - 调用 shared_ptr 对象方法