【问题标题】:How to add label for timeseries line google flutter chart?如何为时间序列线谷歌颤动图添加标签?
【发布时间】:2019-10-19 22:50:32
【问题描述】:

我正在使用charts_flutter包在我的flutter应用程序中显示图表,据我所知,我们使用labelAccessorFn在饼图中显示标签,但它不适用于时间序列折线图。

对于条形图,我们可以添加如下标签 https://google.github.io/charts/flutter/example/bar_charts/horizontal_bar_label

我想为时间序列折线图实现相同的功能。

所以我添加了 labelAccessorFn: (TimeSeriesSales sales, _) => sales.sales.toString(),

https://github.com/google/charts/blob/master/charts_flutter/example/lib/time_series_chart/simple.dart

但没有成功

【问题讨论】:

    标签: charts flutter


    【解决方案1】:

    您也可以使用 RangeAnnotation 来提供标签样式。

    行为:[charts.RangeAnnotation(new charts.LineAnnotationSegment())]

    根据您的要求更改属性。我也想显示一条自定义垂直线。

    【讨论】:

    • 能否给出在折线图上显示Label的源代码
    • 此答案不能用于 TimeSeriesChart。 Flutter 将与 The argument type 'LineAnnotationSegment' can't be assigned to the parameter type 'List<AnnotationSegment>' 出错。如何将其调整为 TimeSeriesChart?
    猜你喜欢
    • 1970-01-01
    • 2019-09-23
    • 1970-01-01
    • 1970-01-01
    • 2020-03-31
    • 1970-01-01
    • 1970-01-01
    • 2022-07-05
    • 1970-01-01
    相关资源
    最近更新 更多