Giter VIP home page Giter VIP logo

Comments (4)

imaNNeo avatar imaNNeo commented on July 17, 2024

It seems it is a flutter engine-related issue
So, let's wait to see what happens

from fl_chart.

mihakosi avatar mihakosi commented on July 17, 2024

OK, thank you. Let's hope this gets resolved soon.

For anyone that might be looking for a solution, I have discovered the following workaround: you can use stack to render the same chart twice (one on top of the other), once in the reversed order and once in the original order, like this:

SizedBox(
  width: MediaQuery.of(context).size.width,
  height: 200,
  child: Stack(
    children: [
      // First chart, drawing in the reversed order
      LineChart(
        LineChartData(
          lineTouchData: const LineTouchData(
            enabled: false,
          ),
          lineBarsData: [
            LineChartBarData(
              spots: chartData.reversed.toList(),
              dotData: const FlDotData(
                show: false,
              ),
            ),
          ],
        ),
      ),
      // Second chart, drawing in the original order
      LineChart(
        LineChartData(
          lineTouchData: const LineTouchData(
            enabled: false,
          ),
          lineBarsData: [
            LineChartBarData(
              spots: chartData,
              dotData: const FlDotData(
                show: false,
              ),
            ),
          ],
        ),
      ),
    ],
  ),
)

You end up with two charts, on the first one the stroke ends are pointed towards the left side of the screen and on the other one towards the right side of the screen. But because they are displayed in a stack they are perfectly aligned and look like a properly rendered chart.

You can also limit this workaround to iOS to avoid unnecessarily impacting the performance of the app on other devices:

if (Platform.isIOS) {
  // Draw two charts in a stack, like in the code above
} else {
  // Draw chart normally
}

from fl_chart.

ruan65 avatar ruan65 commented on July 17, 2024

I am also interested in solving this problem...

from fl_chart.

techouse avatar techouse commented on July 17, 2024

Duplicate of #1625

from fl_chart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.