Search code examples
flutterdartsfcartesianchart

How to make bottom line dashed?


I have SfCartesianChart and I want to make a bottom line dashed. How to make it?

enter image description here

This is my code:

SfCartesianChart(
  plotAreaBorderWidth: 0,
  plotAreaBorderColor: Colors.white24,
  primaryXAxis: DateTimeAxis(
    majorGridLines: const MajorGridLines(
    width: 0.5,
    color: Colors.transparent,
    ),
  ),
  primaryYAxis: NumericAxis(
    majorGridLines: const MajorGridLines(width: 1, color: Colors.white24, dashArray: <double>[5, 5]),
      minimum: 0,
      maximum: 100
    ),
)

Solution

  • Have you tried playing with the dashArray property on the AxisLine? I.e.:

    primaryXAxis: DateTimeAxis(
      majorGridLines: const MajorGridLines(
        width: 0.5,
        color: Colors.transparent,
        ),
      axisLine: AxisLine(
        color: Colors.red, 
        dashArray: <double>[2.0, 1.0],
      ),
    ),