Code Monkey home page Code Monkey logo

Comments (2)

TwistedMinda avatar TwistedMinda commented on September 26, 2024 1

Nevermind, it's just that the lib tries to find "exact points" by default.
By commenting out : if (!isExactPointInsidePixelRatio) continue in createGraphPathBase (node_modules/react-native-graph/src/CreateGraphPath.ts) it's the same algorithm as the previous versions of the lib.

Oof!

from react-native-graph.

TwistedMinda avatar TwistedMinda commented on September 26, 2024

It seems that the timestamps need to be perfectly spaced in order for the graph to draw correctly:

const day = 3600 * 24 * 1000
const myPoints = [
    // Working graph with more than 6 points
    { value: 9.29, date: new Date(1678448549109 - day * 8) },
    { value: 8.98, date: new Date(1678448549109 - day * 7) },
    { value: 9.02, date: new Date(1678448549109 - day * 6) },
    { value: 9.15, date: new Date(1678448549109 - day * 5) },
    { value: 9.39, date: new Date(1678448549109 - day * 4) },
    { value: 9.08, date: new Date(1678448549109 - day * 3) },
    { value: 8.08, date: new Date(1678448549109 - day * 2) },

    // Now this breaks the graph and draws a straight line for the whole graph
    { value: 9.08, date: new Date(1678448549109 - day * 1.9) },
    { value: 9.08, date: new Date(1678448549109 - day * 1.8) },
    { value: 8.08, date: new Date(1678448549109 - day * 1.2) },
    { value: 10.08, date: new Date(1678448549109 - day * 1.1) },
]

It seems less practical, anything I can do to have the old behavior?

from react-native-graph.

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.