Libraryless. Click here for Pure Java version (5147L/33K/114K).
!7 static DependentCache<S> imageCache = new(f makeChart_fresh, f unixDay); answer { if "visitors chart" ret standardChart(); if (match("visitors chart *", s, m) || match("visitors chart * days", s, m)) ret makeChart_fresh(m.psi(0)); } html { ret himg(skipToURL(standardChart())); } // 7 days static S standardChart() { ret imageCache!; } static S makeChart_fresh() { ret makeChart_fresh(7); } static S makeChart_fresh(int days) { print("Making visitors chart for " + days + " days"); days = max(1, days); exceptionToUser { L<S> l = toLinesFullTrim(unSlackSnippet(askSelf("visitors last " + (days+1) + " days"))); new L<Integer> data; for (S line : l) { O o = safeUnstructure(line); int n = toInt(get(o, "cookies")); data.add(n); } removeLast(data); // drop today's data - it looks bad ret chartBase("Visitors last " + days + " days (= cookies)", 0, data); // base value = 0 } }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment