Skip to content

Support wasm #59

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 11 commits into from
May 10, 2022
Merged

Support wasm #59

merged 11 commits into from
May 10, 2022

Conversation

mfreeborn
Copy link
Contributor

This is a very simple PR which enables the project to be built in a wasm environment, tested on rust stable v1.60.0 with the command cargo build --features wasm --target wasm-unknown-unknown

Relates to issues #25 and #26.

This doesn't refactor any of the code, like a previous attempt, and just uses a new wasm feature and conditional compilation.

@mfreeborn
Copy link
Contributor Author

It's useful for wasm apps to be able to call the plotly newPlot (+/- react) function directly, so I've added wasm bindings to those to functions.

Down the line, I wonder if it would be useful to implement bindings for validate and/or validateTemplate. It would then be possible to use those functions to validate Plot::to_json() output with the reference implementation in a testing configuration.

@mfreeborn mfreeborn changed the base branch from master to dev April 23, 2022 15:22
@mfreeborn mfreeborn merged commit f23da3c into plotly:dev May 10, 2022
@mfreeborn mfreeborn deleted the support-wasm branch May 10, 2022 12:32
mfreeborn added a commit that referenced this pull request Aug 26, 2022
* Update dependencies

* Improve NumOrString (#76)

* reimplement NumOrString + tests

* changelog

* Fix contributing typos (#77)

* fix typos

* update changelog

* Fix Visible enum implementation (#70)

* implement proper Visible enum

* fix implementation and add tests

* improve test

* remove TruthyEnum

* update changelog

* add PartialEq impl and tests (#61)

* add PartialEq impl and tests

* impl clone with test

* add Clone derives

* update changelog

* Add support for the majority of config options (#65)

* add support for the majority of config options

* fix enum serialization representations

* add DoubleClick enum

* refine options

* doc fix

* add tests

* fix dependencies

* update changelog

* add setter for `Plot.configuration`

* impl Serialize for Plot (#68)

* impl Serialize for Plot

* serialize Traces/Layout separately

* improve tests

* refactor template rendering with serializable plot

* add to doctest to prove html tags aren't escaped

* update changelog

* add getter for `Plot.configuration`

* Add support for layout templates (#62)

* add LayoutTemplate struct

* add constructor for Template

* add test

* WIP

* support static predefined themes

* implement plotly_dark layout template

* make theme public

* fix colorbar recursive Default impl

* fix incorrect rename for Marker.size_mode

* make Layout::template() method generic

* add plotly_white and default (empty) themes

* fix dependencies

* update changelog

* Serialize plotly_kaleido::PlotData correctly (#75)

* impl Serialize for Plot

* serialize Traces/Layout separately

* improve tests

* refactor template rendering with serializable plot

* add to doctest to prove html tags aren't escaped

* serialize PlotData

* serialize PlotData

* update changelog

* Support wasm (#59)

* builds for wasm-unknown-unknown

* add wasm feature to readme

* update conditional compilation derives

* add bindings to plotly.js newPlot() and react()

* add helper function Plot::to_js_object()

* fix imports

* update changelog

* update workflows for new feature

* fix conditional imports

* update readme

* fix variable interpolation (#78)

* Add tests (#74)

* partial test coverage of common/mod.rs

* finish tests for common.rs

* start layout tests

* finish tests for enums

* just a few more structs to go for layout...

* more tests

* make tests pass

* update changelog

* Support Sankey Diagrams (#69)

* working basic example

* fix examples

* implement the rest of sankey

* fix Domain

* improve test

* add sankey tests

* add test for Domain

* fix tests

* add Sankey to book

* Impl clone for colors (#79)

* add Clone/Copy derives

* update changelog

* Update plotly js (#80)

* update plotly and mathjax deps

* fix imports + typo

* update changelog

* Add tests for layout module (#81)

* add tests for bar trace (#82)

* Fix stack overflow in layout tests (#83)

* box some layout struct fields

* undo method signature changes

* Fix unused Dependencies warning with proper feature gating #84

* Tidy up folder structure (#85)

* reconfigure folder structure

* disambiguate import and fix feature gating

* Refactor Color trait and apply throughout codebase (#87)

* Add Scatter3d support (#66)

* scatter 3D plot example running

* added 3D line plot and examples for 3d line plot and surface plot

* fixes and cleanup

* adjusted CHANGELOG.md

* adjusted CHANGELOG.md

* remove unintentionally included test output file

* fix merge

* tweak examples

* derive Default and sort imports

* fix feature-gated import

* add tests

* update book

* fix examples

* add plot3d examples to ci

* update book

* fix newest book examples

Co-authored-by: Michael Freeborn <[email protected]>

* Align API for saving/showing plots more closely with plotly.py (#89)

* reconfigure API for saving/showing plots

* update changelog

* update book introduction with new api

* add rustfmt step to ci (#90)

* add wasm example to book (#91)

* Add serde_with::skip_serializing_none macro (#94)

* add serde_with dependency

* apply skip_serializing_none macro

* finish applying skip_if_none macro

* fix typo

* fix typo

* clippy lints (#95)

* add tests (#96)

* add tests

* add tests

* prepare v0.8.0 (#97)

Co-authored-by: Ioannis Giagkiozis <[email protected]>
Co-authored-by: Mario Herzog <[email protected]>
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.

1 participant