earth icon indicating copy to clipboard operation
earth copied to clipboard

step

Open CristiCraciun opened this issue 7 years ago • 2 comments

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... }

CristiCraciun avatar Jan 18 '18 11:01 CristiCraciun

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?

westlin3 avatar Jun 15 '18 18:06 westlin3

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...

CristiCraciun avatar Jun 26 '18 07:06 CristiCraciun