如何删除Flutter融合条形图背景网格线?

t98cgbkg  于 2023-08-07  发布在  Flutter
关注(0)|答案(1)|浏览(100)

如何删除Flutter融合条形图背景网格线?
使用pub.dev_flutter_charts 19.4.56 https://pub.dev/packages/syncfusion_flutter_charts
<图像网格线(灰色线)>
x1c 0d1x的数据
我的代码

return SfCartesianChart(
  title: ChartTitle(text: totalTaxString, textStyle: const TextStyle(fontWeight: FontWeight.bold)),
  primaryXAxis: CategoryAxis(
    maximumLabelWidth: MediaQuery.of(context).size.width > 480 ? MediaQuery.of(context).size.width * 0.3 : 100,
    labelStyle: const TextStyle(overflow: TextOverflow.ellipsis)
    // isVisible: false
  ),
  primaryYAxis: CategoryAxis(    
    isVisible: false
  ),
  series: <BarSeries>[
    BarSeries<ModelPioChartData, String>(
      dataSource: listPioChartData,
      pointColorMapper:(ModelPioChartData data, _) => data.color,
      xValueMapper: (ModelPioChartData data, _) => data.x,
      yValueMapper: (ModelPioChartData data, _) => data.y,
      dataLabelMapper: (ModelPioChartData data, _) {
        if(data.y.toStringAsFixed(0).length > 4) {
          return "${data.y/10000}조 원";
        } else {
          return "${data.y.toStringAsFixed(0)}억 원";
        }
        
      },

      dataLabelSettings: const DataLabelSettings(
        isVisible: true
      ),
      enableTooltip: true,
      
    ),
  ],
);

字符串

3htmauhk

3htmauhk1#

我建议你在轴中使用majorGridLines属性,你可以自定义主网格线的宽度、颜色和大小。我们附上了下面的代码片段和UG供您参考。

primaryXAxis:
   CategoryAxis(
     majorGridLines: const MajorGridLines(width: 0)
  ),

字符串
UG:https://help.syncfusion.com/flutter/cartesian-charts/axis-customization#grid-lines-customization

相关问题