Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Wallet Graph component #16789

Merged
merged 1 commit into from
Aug 1, 2023
Merged

Conversation

briansztamfater
Copy link
Member

@briansztamfater briansztamfater commented Jul 26, 2023

fixes #16739 #16705

Summary

Integrate react-native-gifted-charts library and implement Wallet Graph component

Results

wallet-graph-light.mp4
walletgraph-dark.mp4

Platforms

  • Android
  • iOS

Areas that maybe impacted

Steps to test

  • Open Status
  • Log in
  • Go to Settings > Quo2 Preview
  • Check wallet-graph component under Graph section

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Jul 26, 2023

Jenkins Builds

Click to see older builds (70)
Commit #️⃣ Finished (UTC) Duration Platform Result
0c2a651 #1 2023-07-26 21:34:11 ~3 min tests 📄log
✔️ 0c2a651 #1 2023-07-26 21:37:06 ~6 min android 🤖apk 📲
✔️ 0c2a651 #1 2023-07-26 21:37:36 ~7 min android-e2e 🤖apk 📲
0c2a651 #1 2023-07-26 21:37:52 ~7 min ios 📄log
0c2a651 #2 2023-07-26 22:06:43 ~4 min ios 📄log
0c2a651 #2 2023-07-27 13:15:51 ~2 min tests 📄log
f330ba1 #3 2023-07-27 15:18:45 ~3 min tests 📄log
f330ba1 #3 2023-07-27 15:19:49 ~4 min ios 📄log
✔️ f330ba1 #2 2023-07-27 15:21:16 ~5 min android 🤖apk 📲
✔️ f330ba1 #2 2023-07-27 15:22:11 ~6 min android-e2e 🤖apk 📲
40069b4 #4 2023-07-27 15:26:03 ~2 min tests 📄log
40069b4 #4 2023-07-27 15:29:32 ~5 min ios 📄log
✔️ 40069b4 #3 2023-07-27 15:29:45 ~5 min android 🤖apk 📲
✔️ 40069b4 #3 2023-07-27 15:30:14 ~6 min android-e2e 🤖apk 📲
2c41b34 #5 2023-07-27 15:52:23 ~3 min tests 📄log
✔️ 2c41b34 #4 2023-07-27 15:55:05 ~6 min android 🤖apk 📲
✔️ 2c41b34 #4 2023-07-27 15:55:07 ~6 min android-e2e 🤖apk 📲
2c41b34 #5 2023-07-27 15:57:42 ~9 min ios 📄log
21d4bf9 #6 2023-07-28 02:15:38 ~2 min tests 📄log
21d4bf9 #6 2023-07-28 02:17:30 ~3 min ios 📄log
✔️ 21d4bf9 #5 2023-07-28 02:19:06 ~5 min android 🤖apk 📲
✔️ 21d4bf9 #5 2023-07-28 02:19:12 ~5 min android-e2e 🤖apk 📲
67ff3e7 #7 2023-07-28 03:16:47 ~1 min tests 📄log
67ff3e7 #7 2023-07-28 03:19:41 ~4 min ios 📄log
✔️ 67ff3e7 #6 2023-07-28 03:20:27 ~5 min android 🤖apk 📲
✔️ 67ff3e7 #6 2023-07-28 03:20:35 ~5 min android-e2e 🤖apk 📲
7c1315d #8 2023-07-28 04:01:43 ~3 min ios 📄log
✔️ 7c1315d #7 2023-07-28 04:03:30 ~5 min android-e2e 🤖apk 📲
✔️ 7c1315d #7 2023-07-28 04:03:33 ~5 min android 🤖apk 📲
7c1315d #8 2023-07-28 04:06:01 ~8 min tests 📄log
bdff78c #9 2023-07-28 16:12:13 ~4 min ios 📄log
✔️ bdff78c #8 2023-07-28 16:13:34 ~5 min android-e2e 🤖apk 📲
✔️ bdff78c #8 2023-07-28 16:16:12 ~8 min android 🤖apk 📲
✔️ bdff78c #9 2023-07-28 16:16:47 ~8 min tests 📄log
✔️ d31d813 #11 2023-07-28 16:46:11 ~5 min android-e2e 🤖apk 📲
✔️ d31d813 #11 2023-07-28 16:48:31 ~7 min android 🤖apk 📲
✔️ d31d813 #12 2023-07-28 16:49:17 ~8 min tests 📄log
✔️ d31d813 #12 2023-07-28 16:50:29 ~9 min ios 📱ipa 📲
✔️ 19536c8 #12 2023-07-28 18:22:40 ~6 min android-e2e 🤖apk 📲
✔️ 19536c8 #12 2023-07-28 18:24:15 ~7 min android 🤖apk 📲
✔️ 19536c8 #13 2023-07-28 18:26:12 ~9 min tests 📄log
✔️ 19536c8 #13 2023-07-28 18:31:00 ~14 min ios 📱ipa 📲
✔️ 9c5a14a #13 2023-07-28 19:42:32 ~5 min android-e2e 🤖apk 📲
✔️ 9c5a14a #13 2023-07-28 19:44:40 ~7 min android 🤖apk 📲
9c5a14a #14 2023-07-28 19:45:54 ~8 min tests 📄log
✔️ 9c5a14a #14 2023-07-28 19:46:37 ~9 min ios 📱ipa 📲
cefae1c #15 2023-07-28 19:54:42 ~4 min tests 📄log
✔️ cefae1c #14 2023-07-28 19:56:00 ~5 min android 🤖apk 📲
✔️ cefae1c #14 2023-07-28 19:56:11 ~5 min android-e2e 🤖apk 📲
✔️ cefae1c #15 2023-07-28 20:00:20 ~9 min ios 📱ipa 📲
✔️ 201b127 #15 2023-07-28 20:14:50 ~6 min android 🤖apk 📲
✔️ 201b127 #15 2023-07-28 20:17:19 ~9 min android-e2e 🤖apk 📲
✔️ 201b127 #16 2023-07-28 20:17:32 ~9 min ios 📱ipa 📲
201b127 #16 2023-07-28 20:17:42 ~9 min tests 📄log
✔️ b102c1b #16 2023-07-28 20:25:39 ~5 min android-e2e 🤖apk 📲
✔️ b102c1b #16 2023-07-28 20:27:57 ~7 min android 🤖apk 📲
b102c1b #17 2023-07-28 20:29:01 ~8 min tests 📄log
✔️ b102c1b #17 2023-07-28 20:30:00 ~9 min ios 📱ipa 📲
✔️ 4476d4c #17 2023-07-28 23:23:50 ~5 min android-e2e 🤖apk 📲
✔️ 4476d4c #17 2023-07-28 23:25:57 ~7 min android 🤖apk 📲
✔️ 4476d4c #18 2023-07-28 23:27:12 ~8 min tests 📄log
✔️ 4476d4c #18 2023-07-28 23:28:57 ~10 min ios 📱ipa 📲
✔️ e8c1d5a #18 2023-07-31 16:58:41 ~9 min android-e2e 🤖apk 📲
✔️ e8c1d5a #18 2023-07-31 16:58:49 ~9 min android 🤖apk 📲
✔️ e8c1d5a #19 2023-07-31 16:58:55 ~9 min ios 📱ipa 📲
✔️ e8c1d5a #19 2023-07-31 16:59:35 ~9 min tests 📄log
✔️ 10a3c7a #19 2023-07-31 17:21:39 ~9 min android-e2e 🤖apk 📲
✔️ 10a3c7a #19 2023-07-31 17:21:50 ~9 min android 🤖apk 📲
✔️ 10a3c7a #20 2023-07-31 17:23:32 ~11 min tests 📄log
✔️ 10a3c7a #20 2023-07-31 17:30:22 ~17 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6eda692 #20 2023-07-31 18:28:13 ~7 min android-e2e 🤖apk 📲
✔️ 6eda692 #20 2023-07-31 18:28:14 ~7 min android 🤖apk 📲
✔️ 6eda692 #21 2023-07-31 18:30:18 ~9 min ios 📱ipa 📲
✔️ 6eda692 #21 2023-07-31 18:30:24 ~9 min tests 📄log
✔️ 26597d1 #22 2023-08-01 13:50:58 ~5 min android-e2e 🤖apk 📲
✔️ 26597d1 #23 2023-08-01 13:53:47 ~8 min tests 📄log
✔️ 26597d1 #22 2023-08-01 13:53:55 ~8 min android 🤖apk 📲
✔️ 26597d1 #23 2023-08-01 13:55:04 ~9 min ios 📱ipa 📲

@briansztamfater briansztamfater force-pushed the research/chart-library branch 9 times, most recently from d31d813 to 19536c8 Compare July 28, 2023 18:16
package.json Outdated Show resolved Hide resolved
@briansztamfater briansztamfater changed the title [WIP] Implement Wallet Graph component Implement Wallet Graph component Jul 28, 2023
@briansztamfater briansztamfater force-pushed the research/chart-library branch 2 times, most recently from 201b127 to b102c1b Compare July 28, 2023 20:19
@briansztamfater briansztamfater marked this pull request as ready for review July 29, 2023 20:23
Copy link
Member

@smohamedjavid smohamedjavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! @briansztamfater 🚀

src/quo2/components/graph/wallet_graph/utils.cljs Outdated Show resolved Hide resolved
src/quo2/components/graph/wallet_graph/view.cljs Outdated Show resolved Hide resolved
(defn downsample-data
[data max-array-size]
(let [data-size (count data)
aggregation-interval (max (/ data-size max-array-size) 1)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we are cutting out the most recent portion of data if it doesn't fit into max-array-size, e.g. if we have data=[1 2 3 4 5] and max-array-size=2 then only [1 2 3] are going to be used. Not a big deal on a big set, but we still would rather want to cut the head of that set in case if the set is ordered from the older value to newer (which is likely).

Copy link
Member Author

@briansztamfater briansztamfater Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've refactored and simplified the function and added some unit test so expected outputs are more understandable. Basically it cuts the array into by X amount of steps to fit given max amount of elements (if the original data array exceeds that amount) and avoid rendering lots of unnecessary points which won't even be visible in mobile screens.

If I did not misunderstood your suggestion, I think in that case we could split the data array and pre-process it, and keep this function as simple as possible. Let me know if that makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know what are expected numbers for (count data) and max-array-size? I do like that a new implementation is shorter but it might have introduced another issue depending on data we are going to show.

For instance, in the previous implementation we would cut the last portion of data if it wouldn't have enough elements in it, e.g. for data=[1 2 3 4 5] and max-array-size=2 if would be split into [1 2 3] and [3 4] and then [3 4] would not be shown, which in some cases might mean we do not show the recent data, and that might not be optimal (specifically if the user wants to see that recent data and the dataset is relatively small).

In a new implementation by doing decimation we can get a noticeably lower number of elements in the resulting data set although we potentially have enough information to show more details of it. e.g. if we have (count data) = 21 and max-array-size=20 the result will have only 11 elements. That's not going to be a problem if that dataset is big enough (comparing to max-array-size) or if (count data) is multiple of max-array-size.

That's why I'm asking whether we know what to expect here :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarification, this function is only meant to use with big data sets (> 500 points). As far as I've tested, 500 points at max works fine and is performant. (count data) could be any value, maybe price history of a token, but for the preview I am using random datasets of 182500 elements (which would not be performant to render all and there's no space in the mobile screen to render them either way, so it is downsampled to 500 elements). In reality, I think user could view other smaller timeframes to inspect detailed information.
Anyways, I will create an issue so we can revisit this later once we start testing it with real data sets.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created it here #16831

Copy link
Contributor

@ilmotta ilmotta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who doesn't love line charts ;) Cool work @briansztamfater, and the unit tests made it all better!

@briansztamfater
Copy link
Member Author

Who doesn't love line charts ;) Cool work @briansztamfater, and the unit tests made it all better!

I actually had fun times developing this component! And I must admit I now feel better after adding those unit tests, so thanks for the valuable feedback 💪

I think we can now safely summon @Francesca-G to review this component 🧙

Signed-off-by: Brian Sztamfater <brian@status.im>
@briansztamfater briansztamfater merged commit 21807cb into develop Aug 1, 2023
2 checks passed
@briansztamfater briansztamfater deleted the research/chart-library branch August 1, 2023 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature requests
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement Wallet Graph component
9 participants