nxt3AT / sankeydiagram.net

sankeydiagram.net is an easy-to-use webapp for generating Sankey Diagrams to visualize flows and budgets.
Other
75 stars 12 forks source link

feature request: save settings to share link #30

Closed JonasDoesThings closed 1 year ago

JonasDoesThings commented 2 years ago

Currently when using the share sankey as link function only the content gets shared, not the settings. In the future the settings should also be included in the share link.

Attention: I think the share link should only include actually changed settings as that would help keeping the link length in check. The downside is that when we decide to change the default of some settings in the future, the settings would default on the new pre-set value.

domvo commented 2 years ago

Maybe you could also save a version number in the URL and hardcode the default settings somewhere in the app, so when the link is opened, the app knows which "settings version" it should load.

JonasDoesThings commented 1 year ago

It would probably be beneficial if we were to store all the settings in one state dictionary variable, so we could easily serialize and deserialize all settings without having to go through each single setting variable on it's own.

Alternatively we could also just forEach through all input elements. Maybe use a class like "settings-input" for that.

JonasDoesThings commented 1 year ago

Implemented basic functionality for this in Pull Request #36

Only changed settings are saved to the URL, but at this point it has no 'version control'. So as mentioned before, changing the default settings in the future can change the behavior of existing URLs.

JonasDoesThings commented 1 year ago

The change is live to test on https://dev.sankeydiagram-net.pages.dev/ now Test URL with some settings set: https://dev.sankeydiagram-net.pages.dev/?content=PTAEGUHkFUCUGECioDaA1AggGWsgFAMYCGAdqAEYCmoRoA5APx0CUAuqACoawDiiHoPCniQskWK2YAoAM4B7AK4AnAtRQBGAAyb2AFyJKA5pV2zFK6roDuc1AGYdofUZNTnx3agZ6DHpzbdfE1QADkcAMzkAGyi5K1AAW2o5MmsAS11dSiVUAAc0kgBrVkCXT2tbFABWHzKnAAslSkpSvwrUACYapyDPSOVW4PaUDsd3YPC0gDcW8b7ptXVuudAZNIAPVCi0w3rdQybKEhKgA===&sankey-settings-precision=0&sankey-settings-separators=true&sankey-settings-labelabove=true&sankey-settings-colorscheme=4&sankey-settings-suffix=+---+THIS+IS+A+TEST&sankey-settings-hidenumbers=true&sankey-settings-canvas-width=2000&sankey-settings-canvas-height=1000

If no problems arise, I will include it in the next release next week.

JonasDoesThings commented 1 year ago

Included in the latest release, follow-up issues are #38.