flutter syncfusion条形图背景网格线如何删除?
how to flutter syncfusion bar chart background grid line delete?
flutter syncfusion条形图背景网格线如何删除?
使用 pub.dev // syncfusion_flutter_charts 19.4.56
https://pub.dev/packages/syncfusion_flutter_charts
<图像网格线(灰色线)>
我的代码
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,
),
],
);
我建议你在坐标轴中使用majorGridLines 属性,你可以自定义主要网格线的宽度、颜色和大小。下面附上代码片段和UG,供大家参考。
primaryXAxis:
CategoryAxis(
majorGridLines: const MajorGridLines(width: 0)
),
UG:https://help.syncfusion.com/flutter/cartesian-charts/axis-customization#grid-lines-customization
flutter syncfusion条形图背景网格线如何删除?
使用 pub.dev // syncfusion_flutter_charts 19.4.56 https://pub.dev/packages/syncfusion_flutter_charts
<图像网格线(灰色线)>
我的代码
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,
),
],
);
我建议你在坐标轴中使用majorGridLines 属性,你可以自定义主要网格线的宽度、颜色和大小。下面附上代码片段和UG,供大家参考。
primaryXAxis:
CategoryAxis(
majorGridLines: const MajorGridLines(width: 0)
),
UG:https://help.syncfusion.com/flutter/cartesian-charts/axis-customization#grid-lines-customization