【问题标题】:How to change the Legend Icon in SfCircularChart() in Flutter如何在 Flutter 中更改 SfCircularChart() 中的图例图标
【发布时间】:2021-09-22 20:59:20
【问题描述】:

我在 SfCircularChart() 中使用 RadialBarSeries()。
调用Legend()(在SfCircularChart() 中的属性legend)后,
我得到以下信息:

我想把这些圆形图标改成普通的方形图标。
这是我的代码:

  child: SfCircularChart(
    legend: Legend(
      isVisible: true,
      overflowMode: LegendItemOverflowMode.wrap,
      position: LegendPosition.left,
    ),
    series: <CircularSeries>[
      RadialBarSeries<Qualification, String>(
        dataLabelSettings: DataLabelSettings(isVisible: true),
        dataSource: _qualifications,
        xValueMapper: (Qualification data, _) => data.name,
        yValueMapper: (Qualification data, _) => data.value
      )
    ],
  )

【问题讨论】:

    标签: flutter charts icons legend


    【解决方案1】:

    你可以这样做。

     child: SfCircularChart(
        title: ChartTitle(text: 'Advances'),
        palette: const <Color>[
          Color(0xFFffc107),
          Color(0xFF0386E8),
        ],
        legend: Legend(
          isVisible: true,
          overflowMode: LegendItemOverflowMode.wrap,
          position: LegendPosition.left,
        ),
        tooltipBehavior: _tooltipData,
        series: <CircularSeries>[
          RadialBarSeries<ChartData, String>(
              legendIconType: LegendIconType.seriesType,
              dataSource: _chartData,
              xValueMapper: (ChartData data, _) => data.name,
              yValueMapper: (ChartData data, _) => data.value,
              dataLabelSettings: const DataLabelSettings(
                isVisible: true,
              ),
              enableTooltip: true,
              cornerStyle: CornerStyle.endCurve,
              maximumValue: 100)
        ],
      ),
    
    • legendIconType:指定图例的形状。
      • legendIconType:LegendIconType.seriesType,
      • legendIconType:LegendIconType.circle,
      • 查看更多here

    文档:here

    【讨论】:

    • 谢谢它的工作
    猜你喜欢
    • 2019-10-22
    • 2019-05-07
    • 2021-12-27
    • 2021-10-15
    • 2021-11-17
    相关资源
    最近更新 更多