I have SfCartesianChart and I want to disable visibility of the left legend(0,50,100). How can I do this?
This is my code:
SfCartesianChart(
plotAreaBorderWidth: 0, // X top line
plotAreaBorderColor: Colors.white24,
primaryXAxis: DateTimeAxis(
majorTickLines: const MajorTickLines(width: 0), // Little sticks below X line
majorGridLines: const MajorGridLines(
width: 0.5,
color: Colors.transparent,
),
axisLine: const AxisLine( // X bottom line
color: Colors.white24,
dashArray: <double>[5,5]
),
),
primaryYAxis: NumericAxis(
majorGridLines: const MajorGridLines(width: 1, color: Colors.white24, dashArray: <double>[5, 5]),
majorTickLines: const MajorTickLines(width: 0), // Little sticks on left side
axisLine: const AxisLine(
color: Colors.transparent, // Y left line
dashArray: <double>[5,5]
),
minimum: 0,
maximum: 100,
),
)
I tried to add => labelPosition: const ChartDataLabelPosition(0), but ide returns me an error => Generative enum constructors can only be used as targets of redirection. Try using an enum constant, or a factory constructor.
labelStyle: TextStyle(color: Colors.transparent helps me but there is still a space and I don't know how to to remove this space
If you meet the same problem, just add this:
primaryYAxis: NumericAxis(
labelStyle: const TextStyle(
color: Colors.transparent,
fontSize: 0
),
),