Skip to content

Readme is not clear #64

Description

@ismailonur

1-) Where does usePriceHistory come from?
2-) Is priceHistory an array or an object? What value should it contain?
Thank you

Activity

  1. Wilmela commented on Feb 28, 2023

    @Wilmela

    Same here.

  2. shawnob2123 commented on Mar 7, 2023

    @shawnob2123

    Agreed. Show imports and possibly a better use case

  3. hiphilli commented on Jul 31, 2023

    @hiphilli

    Unsure how to use priceHistory too. Very unclear in the docs.

  4. papidb commented on Sep 28, 2023

    @papidb

    Hey @Montchy can I pick this up?

  5. IAmCoder commented on Mar 15, 2024

    @IAmCoder

    I found some examples here: https://github.com/margelo/react-native-graph/blob/main/example/src/data/GraphData.ts

    function weightedRandom(mean: number, variance: number): number {
      var distribution = gaussian(mean, variance)
      // Take a random sample using inverse transform sampling method.
      return distribution.ppf(Math.random())
    }
    
    export function generateRandomGraphData(length: number): GraphPoint[] {
      return Array<number>(length)
        .fill(0)
        .map((_, index) => ({
          date: new Date(
            new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * index
          ),
          value: weightedRandom(10, Math.pow(index + 1, 2)),
        }))
    }
    
    export function generateSinusGraphData(length: number): GraphPoint[] {
      return Array<number>(length)
        .fill(0)
        .map((_, index) => ({
          date: new Date(index),
          value: Math.sin(index),
        }))
    }
    
  6. chrispader commented on Sep 17, 2026

    @chrispader
    Member

    The README example was updated in PR #136. It now shows where the graph data comes from and the expected GraphPoint[] shape, so the documentation questions here are addressed.

    Answered by Codex, instructed by Chris.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions