How to change data url of a dc.js visualization dynamically?

29 views Asked by At

i want to get some data based on selected dates. I am sending the dates via the resource route in a flask application. Hence, i want to change the data url everytime the date range is changed.

1

There are 1 answers

0
muhammed haithem On
function setOneYearRefiner(searchParam) {
if (document.URL.indexOf("Default") == -1){
var nu = new Date();
nu.setFullYear(nu.getFullYear()-1);
nu.setMonth(nu.getMonth());
nu.setDate(nu.getDate()-1);
var lastyear = nu.getUTCFullYear();

var thisMonth = nu.getMonth()+1;
if (thisMonth < 10) {thisMonth = "0" + thisMonth;}

var thisDay = nu.getUTCDate();
if (thisDay < 10) {thisDay = "0" + thisDay;}

location.hash='Default={"k":"'+searchParam+'","r":[{"n":"LastModifiedTime","t":["range('+lastyear+'-'+thisMonth+'-'+ thisDay+'T22:00:00Z, max, to=\\"le\\")"],"o":"and","k":false,"m":null}]}'
}