Plot band in Flutter Spark Chart

6 Aug 20261 minute to read

This feature is used to highlight a particular region in spark charts along the Y axis.

The following properties are used to customize the appearance:

  • start - Configures the start plot band value on the Y axis.
  • end - Configures the end plot band value on the Y axis.
  • color - Changes the plot band color.
  • borderColor - Changes the plot band border color.
  • borderWidth - Changes the plot band border width.
@override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Center(
          child: SfSparkLineChart(
            axisLineWidth:0,
              plotBand: SparkChartPlotBand(start: 7, end: 8),
              data: <double>[
                  5, 6, 5, 7, 4, 3, 9, 5, 6, 5, 7, 8, 4, 5, 3, 4, 11, 10, 2, 12, 4, 7, 6, 8
              ],
          )
        )
      );
    }

Sparkline plot band