You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the only issue with this will be the 2048 URL character limit for some browsers.
Could base64 encode the JSON to make it shorter, but would need to also encodeURI it.
I think for this reason the Vega links are POST rather than GET? not too sure.
Maybe have two parameters,
j=URI encoded {sankey JSON stuff}
b=Base64 and URI encoded version of sankey stuff (should be shorter)
The b version could be used as a type of "permalink"
The j version would be useful for simple use cases where you have JSON in the right format and want to get a quick link to the data.
I still think having access to the text representation of the json is useful if you want to save it on your computer.
I don't know if I'll have time to do a proper pull request implementing these ideas, thank you for the great tool, I am busily downloading my set of 87 sankey charts and can finally visualise the flow of students between different bands for the last decade!
In case I don't get a chance to return to this the code below implements the "reading" of the 'j' parameter from the URL
Insert instead of line 335-336 in food.js
// check if graph definition passed in url
if ('URLSearchParams' in window) {
// Browser supports URLSearchParams
let url = new URL(window.location);
let params = new URLSearchParams(url.search.slice(1));
if (params.has('j')) {
// yes there was, so load it
loadraw(decodeURI(params.get('j')));
} else {
// check if there is any info stored in LocalStorage before first draw
loadLS();
}
} else {
// check if there is any info stored in LocalStorage before first draw
loadLS();
}
Vega-style, one should be able to a call the Sankey from the JSON string encoded directly into the URL parameter, too.
The text was updated successfully, but these errors were encountered: