Using D3 With Url Query Strings
I'd like to be able to provide URLs to access different views of visualizations that I've created. For example, some of the visualizations change for each year or for each variable
Solution 1:
on your script you can do something like
var i=0;
var telem;
var search_values=location.search.replace('\?','').split('&');
var query={}
for(i=0;i<search_values.length;i++){
telem=search_values[i].split('=');
query[telem[0]]=telem[1];
}
console.log(query);
after this the query variable should hold all the key:values of your query string. this of should be contained inside a function to avoid polluting the global scope
Post a Comment for "Using D3 With Url Query Strings"