深色模式
Flutter fl_chart的使用
LineChartData
这是配置LineChart的入口,包含所有配置。
super.backgroundColor,:背景色super.borderData,:边框double? minX,:x轴double? maxX,:x轴super.baselineX,:以参考点对齐风格double? minY,:y轴double? maxY,:y轴super.baselineY,:以参考点对齐风格super.gridData = const FlGridData(),:网格super.titlesData = const FlTitlesData(),:4条边上的文字this.lineBarsData = const [],:所有的曲线this.lineTouchData = const LineTouchData(),this.betweenBarsData = const [],super.extraLinesData = const ExtraLinesData(),this.showingTooltipIndicators = const [],super.rangeAnnotations = const RangeAnnotations(),super.clipData = const FlClipData.none(),
LineChartBarData
一个LineChartBarData代表一条曲线。
this.spots = const [],:一系列点坐标,这些点,会连成一条曲线this.show = true,:是否显示Color? color,:曲线的颜色this.gradient,:曲线渐变色,会覆盖colorthis.barWidth = 2.0,this.isCurved = false,this.curveSmoothness = 0.35,this.preventCurveOverShooting = false,this.preventCurveOvershootingThreshold = 10.0,this.isStrokeCapRound = false,this.isStrokeJoinRound = false,BarAreaData? belowBarData,:曲线以下的区域BarAreaData? aboveBarData,this.dotData = const FlDotData(),:点的配置this.showingIndicators = const [],this.dashArray,this.shadow = const Shadow(color: Colors.transparent),:曲线加阴影this.isStepLineChart = false,this.lineChartStepData = const LineChartStepData(),
LineTouchData
曲线的触摸交互配置。
bool enabled = true,BaseTouchCallback<LineTouchResponse>? touchCallback,MouseCursorResolver<LineTouchResponse>? mouseCursorResolver,Duration? longPressDuration,this.touchTooltipData = const LineTouchTooltipData(),this.getTouchedSpotIndicator = defaultTouchedIndicators,this.touchSpotThreshold = 10,this.distanceCalculator = _xDistance,this.handleBuiltInTouches = true,this.getTouchLineStart = defaultGetTouchLineStart,this.getTouchLineEnd = defaultGetTouchLineEnd,
类型
- LineChartBarData 一条曲线的配置
- spots 一系列FlSpot组成一条曲线
- FlSpot 一个数据点
