flutter多层轨迹描点图表

参考https://github.com/imaNNeoFighT/fl_chart

增加1,背景网格线增加虚线,2,折线只显示圆点
底部有重点代码

flutter多层轨迹描点图表_第1张图片

1,背景自定义虚线

gridData: FlGridData(
  show: true,
  checkToShowHorizontalLine: (double value) {
    return value == 1 || value == 3 || value == 5;
  },
  getDrawingHorizontalLine:  (value) {
    return FlLine(
      color: const Color(0xff37434d),
      strokeWidth: 1,
      dashArray: [5, 10],
    );
  },),

2,折线只显示圆点

LineChartBarData(
  spots: [
    FlSpot(1, 1),
    FlSpot(3, 1.8),
    FlSpot(6, 2),
    FlSpot(9, 2.2),
    FlSpot(13, 1.8),
  ],
  colors: [goodColor],
  showLines: false,
  dotData: FlDotData(
    show: true,
  ),
),

你可能感兴趣的:(flutter)