Skip to content

Added functionality for callbacks #287

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

Merged
merged 3 commits into from
May 12, 2025

Conversation

h4ck4l1
Copy link
Contributor

@h4ck4l1 h4ck4l1 commented Apr 25, 2025

  • Added functionality of Click event callback
  • Added wasm-yew-minimal-callback example in example docs

@h4ck4l1
Copy link
Contributor Author

h4ck4l1 commented Apr 25, 2025

@andrei-ng please notify any changes, I am unsure when I will respond next week but I will make sure changes take place atmost in next weeks weekend.

  1. I thought of adding everything in binding but callbacks even the next Select callback need their own structs and higher level SelectEvent structs
  2. All the fields are Optional as using serdes default attribute gives serialization error for reasons beyond me.
  3. Added the minimal Yew example
  4. If this goes through implementing select,hover and rest are on the way

Best Regards

@andrei-ng
Copy link
Collaborator

Thank you for the PR! I will review it during the week.

@andrei-ng
Copy link
Collaborator

Thank you for the PR! I will review it during the week.

Sorry, I have been a bit busy & traveling. Will review it this coming week.

@h4ck4l1
Copy link
Contributor Author

h4ck4l1 commented May 3, 2025

No worries

Thank you for the PR! I will review it during the week.

Sorry, I have been a bit busy & traveling. Will review it this coming week.

No worries. I have been lurking between wasm, dioxus and this repo and found something more breaking

I've raised this in #4071

in yew this might not be a problem but in frameworks like dioxus SPA the scripts loading takes a bit time and plotly actually takes more time that other frameworks, so when i am using other 3rd party libraries and functions using wasm_bindgen they are giving me an unreachable error. that why i am currently having to inject scripts manually before the calling of new_plot i don't think this will effect yew but for dioxus it will imo, if one uses more that 2 or 3 scripts. please check the issue if you have the time.
Right now i am using 2 external js libraries plotly and datatable and both of them actually require injecting js_scripts if the page is to work after a refresh.

@andrei-ng andrei-ng force-pushed the plotly-rs-js-callbacks branch from 6c5e75d to 69c1363 Compare May 12, 2025 18:18
@andrei-ng andrei-ng force-pushed the plotly-rs-js-callbacks branch 3 times, most recently from c2b8f92 to 0c92ca0 Compare May 12, 2025 18:32
h4ck4l1 and others added 2 commits May 12, 2025 20:44
Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com>
@andrei-ng andrei-ng force-pushed the plotly-rs-js-callbacks branch 2 times, most recently from 5df0dc7 to d26ac48 Compare May 12, 2025 20:33
 - update changelog

Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com>
@andrei-ng andrei-ng force-pushed the plotly-rs-js-callbacks branch from d26ac48 to fd684ae Compare May 12, 2025 20:41
@andrei-ng
Copy link
Collaborator

  1. I thought of adding everything in binding but callbacks even the next Select callback need their own structs and higher level SelectEvent structs

Yes, I agree with the choice, better to have them separate.

  1. All the fields are Optional as using serdes default attribute gives serialization error for reasons beyond me.
  2. Added the minimal Yew example

Looks great. Did some minor tweaking to make the bar chart /histogram wider.

  1. If this goes through implementing select,hover and rest are on the way

If you have the time and are willing to do so... that would be awesome. I plan to make use of them in one of my projects as well.

@andrei-ng
Copy link
Collaborator

No worries. I have been lurking between wasm, dioxus and this repo and found something more breaking

I've raised this in #4071

in yew this might not be a problem but in frameworks like dioxus SPA the scripts loading takes a bit time and plotly actually takes more time that other frameworks, so when i am using other 3rd party libraries and functions using wasm_bindgen they are giving me an unreachable error. that why i am currently having to inject scripts manually before the calling of new_plot i don't think this will effect yew but for dioxus it will imo, if one uses more that 2 or 3 scripts. please check the issue if you have the time. Right now i am using 2 external js libraries plotly and datatable and both of them actually require injecting js_scripts if the page is to work after a refresh.

Interesting, I will check the issue

@andrei-ng andrei-ng merged commit 3b66a48 into plotly:main May 12, 2025
17 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants