Skip to content

[syncfusion_flutter_charts] PlotBand line dashArray not working in the web #479

@thomasostfeld

Description

@thomasostfeld

I'm using the PlotBands to show horizontal lines at certain positions. The lines are customized to show as dashed lines.
This works as expected on iOS but the line shows up without dashing on the web.

plot_line_ios
plot_line_chrome

I'm using flutter 2.5.3 and syncfusion_flutter_charts: ^19.3.56.
Here is the code to reproduce:

class ChartData {
  final DateTime x;
  final double y;

  ChartData(this.x, this.y);
}

class PlotLineChart extends StatefulWidget {
  const PlotLineChart({Key? key}) : super(key: key);

  @override
  State<PlotLineChart> createState() => _PlotLineChartState();
}

class _PlotLineChartState extends State<PlotLineChart> {
  final List<ChartData> data = [
    ChartData(DateTime(2000, 1, 1), 1),
    ChartData(DateTime(2000, 1, 9), 9),
  ];

  @override
  Widget build(BuildContext context) {
    return SfCartesianChart(
      primaryXAxis: DateTimeAxis(),
      primaryYAxis: NumericAxis(
        plotBands: [
          PlotBand(start: 5.3, end: 5.3, borderWidth: 2, dashArray: const [5, 9]),
          PlotBand(start: 2.3, end: 2.3, borderWidth: 1, dashArray: const [4, 6]),
        ],
      ),
      series: _createSeries(),
    );
  }

  List<FastLineSeries<ChartData, DateTime>> _createSeries() {
    return [
      FastLineSeries<ChartData, DateTime>(
        dataSource: data,
        xValueMapper: (ChartData d, _) => d.x,
        yValueMapper: (ChartData d, _) => d.y,
        markerSettings: const MarkerSettings(isVisible: true),
      ),
    ];
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions