簡體   English   中英

Flutter中SfCircularChart()中如何更改圖例圖標

[英]How to change the Legend Icon in SfCircularChart() in Flutter

我在 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
      )
    ],
  )

您可以按如下方式進行。

 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,
    • 在這里查看更多

文檔: 這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM