Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minY value is overlapped #1755

Open
Reeganantony opened this issue Sep 25, 2024 · 5 comments
Open

minY value is overlapped #1755

Reeganantony opened this issue Sep 25, 2024 · 5 comments

Comments

@Reeganantony
Copy link

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
overlapping_issue1

Versions

  • Flutter : 3.22.0
  • fl_chart: ^0.69.0
@baiama
Copy link

baiama commented Oct 4, 2024

Same for me

@gauravkakad1
Copy link

any update on this ?

@Reeganantony
Copy link
Author

Nope!

@imaNNeo
Copy link
Owner

imaNNeo commented Oct 20, 2024

Please provide me with your reproducible code,
I mean a minimal version of the issue that I can run.

@Reeganantony
Copy link
Author

Reeganantony commented Oct 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants