Open Reeganantony opened 1 month ago
Same for me
any update on this ?
Nope!
Please provide me with your reproducible code, I mean a minimal version of the issue that I can run.
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
class BarChartSample5 extends StatefulWidget {
@override
State<BarChartSample5> createState() => _BarChartSample5State();
}
class _BarChartSample5State extends State<BarChartSample5> {
final List<double> data = [-1, 12, 52, 58, 154, 26, 1000];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Line chart'),
),
body: Container(
height: 600,
child: Padding(
padding: EdgeInsets.all(16.0),
child: LineChart(
LineChartData(
gridData: FlGridData(
show: true,
horizontalInterval: 100 / 5,
getDrawingHorizontalLine: (value) {
return FlLine(
color: Colors.grey.withOpacity(0.5),
strokeWidth: 1.3,
);
},
getDrawingVerticalLine: (value) {
return FlLine(
color: Colors.grey.withOpacity(0.5),
strokeWidth: 1.3,
);
},
),
// Set up the X axis
titlesData: FlTitlesData(
// bottomTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
leftTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 50,
getTitlesWidget: (value, meta) {
if (value < 0) {
return Text('OFF');
}
return Text(value.round().toString());
},
)),
),
// Set up the Y axis
minY: -1,
borderData: FlBorderData(show: true),
lineBarsData: [
LineChartBarData(
spots:
data.asMap().entries.map((e) => FlSpot(e.key.toDouble(), e.value)).toList(),
isCurved: true,
color: Colors.blue,
barWidth: 4,
isStrokeCapRound: true,
dotData: FlDotData(show: false),
belowBarData: BarAreaData(show: false),
),
],
),
),
),
),
);
}
}
In this example, in the left tile -1 value is overlapped with 0.
In My project I set the minY value is -1, but the interval is 10000. so it overlapped with 0. How to give space to the minY value
Screenshots
Versions