in

LineChartBarData height is out of bound


I have implemented LineChart using fl_chart, however, for some coins, the chart data is outside the parent bounds. This may be due to the difference between fall and growth, but it shouldn’t exceed the parent’s height, so I’m not sure how to resolve it.

Here is the code:

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    return Container(
      height: size.height * 0.47,
      width: size.width,
      decoration: BoxDecoration(
        color: Colors.grey[200],
        borderRadius: BorderRadius.circular(20),
        boxShadow: [
          BoxShadow(
            color: Colors.grey[300]!,
            blurRadius: 10,
            offset: const Offset(0, 5),
          ),
        ],
      ),
      child: Padding(
        padding: const EdgeInsets.all(10.0),
        child: LineChart(
          //  the implemention of the chart data and style
          CoinLineChartData(sparkline7D: marketData.sparkline7D).lineChartData,
        ),
      ),
    );
  }

And also I tried to set constraints to the Container but doesn’t work:

Container(
      constraints: BoxConstraints(
        minHeight: size.height * 0.47,
        maxWidth: size.width,
      )

Also tried to set FittedBox as parent of LineChart and again not work.

Problem picture:

What I want to be like:

Correct picture



Source: https://stackoverflow.com/questions/70631951/linechartbardata-height-is-out-of-bound

Boat Airdopes 601 ANC Launched in India at Rs 3,999

CryptoN v1.0 – NFT Collectibles Marketplace HTML Template – ULC