Closed renatomserra closed 1 year ago
@RenatoSerra22 On line chart yes this is possible by setting the xDomain
prop on the LineChart.Provider.
For the xDomain value, provide an array with 2 numbers, the lowest timestamp and highest timestamp in your data.
Let's say I had this data
const dataToShow = [
{ timestamp: 1661904060, value: 1 },
{ timestamp: 1661925060, value: 1.3 },
{ timestamp: 1661926260, value: 2 },
];
and we put it into our provider...
<LineChart.Provider
// other props
data={dataToShow}
xDomain={[dataToShow[0], dataToShow[dataToShow.length -1]}>
// rest of code
</LineChart.Provider>
It will give you the desired result.
Here is an example (not with the above data) of the difference supplying an xDomain makes.
No xDomain Has xDomain
beautifuuuuuuul thanks so much @cam-shaw !
I was about to post this exact same question. This prop of the provider should be on the Component APIs section of the docs
I was about to post this exact same question. This prop of the provider should be on the Component APIs section of the docs
You're 100% correct, and this is my bad. When I added the feature in a PR I forgot to update the docs with it. I'll take a look during the week at adding some documentation.
@cam-shaw the gradient doesnt seem to respect the domain tho :)
Iiinteresting... Had a look and I think I know how to solve the gradient issue.. Looks fairly simple to resolve, the gradient just needs to also respect the xDomain if provided. No promises yet but give me some time and I'll try this week to have a play and I'll get something up for the maintainers to review.
@cam-shaw For some reason I am getting a malformed path data error when putting the xDomain the same as the example that you gave, not sure what I am doing wrong
Nevermind I figured it out, the timestamps were formatted differently then the data that was being shown, I did find a weird reaction when putting the xdomain, the dot seems to be hanging off the screen
@ChaseK30 If you're able to, would be great if you can give this PR a test. I have fixed up the x position for the dot - would be great to know if it resolves your issues.
https://github.com/coinjar/react-native-wagmi-charts/pull/144
Let me know if you have any issues integrating it into your project.
2.3.0-local.0
to avoid any package conflictsyarn prepare && yarn pack
- This will output a path to the terminal similar to success Wrote tarball to "/Users/.../react-native-wagmi-charts-v2.3.0-local.0.tgz
yarn install pathToTarball
checking now!
@cam-shaw there are no build commands
@ChaseK30 sorry, yarn prepare
instead of yarn build
. Have updated my comment above.
Sorry for the delay running into a ton of dependency issues
@ChaseK30 no worries at all. Could be good to document on the PR if the dependency issues are specific to the PR. I'd imagine the maintainers could throw that into the release notes.
Perhaps we can move this conversation there.
Gettin a ton of these errors trying to run it at all
@ChaseK30 those are unfortunately/fortunately (depending on how you look at it 😅 ) unrelated to the PR. Double check your @react/types and react native types are correct for the React version you're using.
Perhaps even go as far as deleting the node_modules
directory and installing dependencies again. Bit hard to debug from here unfortunately.
Were you already on react-native-wagmi-charts 2.3.0?
in my personal project yes, but i am getting all these errors running a yarn install && yarn prepare && yarn pack
before getting it into my personal project
@cam-shaw
just saw the PR thank you @cam-shaw for being so quick with it!
Found another issue :D when dragging over the line, the labels dont show the correct timestamp/value
@RenatoSerra22 are you able to provide some sample data for me to test with? I believe I have fixed this in the PR as well.
Hellow,
Is there any way to make the distance between two points respect the scale of time between them? Right now points are evenly split across the x axis in the graph