earth
earth copied to clipboard
step
Hi, how can i modify gfsStep function in products.js in order for it to work with different steps (1h, 3h, etc). I tried like this but it's not working :
function gfsStep(date, step) { if (FACTORIES === "wind") { var offset = (step > 1 ? 24 : step < -1 ? -24 : step) * 1, adjusted = new Date(date); adjusted.setHours(adjusted.getHours() + offset); return adjusted; } else if... }
This is what I used to switch it to 1 hour and 24 hour steps.
function gfsStep(date, step) { var offset = (step > 1 ? 24 : step < -1 ? -24 : step) * 1, adjusted = new Date(date); adjusted.setHours(adjusted.getHours() + offset); return adjusted; }
Are you using ±1 and ±10 in the navigate buttons. The code in earth.js should have this for the buttons.
d3.select("#nav-backward-more").on("click", navigate.bind(null, -10));
d3.select("#nav-forward-more").on("click", navigate.bind(null, +10));
d3.select("#nav-backward" ).on("click", navigate.bind(null, -1));
d3.select("#nav-forward" ).on("click", navigate.bind(null, +1));
d3.select("#nav-now").on("click", function () { configuration.save({ date: "current", hour: "" }); });
what is the if(FACTORIES === "wind") supposed to do?
Yes i can change the step in the gfsStep function, but i was wondering, if i have a model with 1h step, how can i use different steps at the same time, by example making buttons for 1h, 3h, 6h...