2006-03-18 jrandom

* Made the netDb search load limitations a little less stringent
    * Add support for specifying the number of periods to be plotted on the
      graphs - e.g. to plot only the last hour of a stat that is averaged at
      the 60 second period, add &periodCount=60
This commit is contained in:
jrandom
2006-03-18 23:09:35 +00:00
committed by zzz
parent b03ff21d3b
commit f3849a22ad
7 changed files with 84 additions and 21 deletions

View File

@ -1,10 +1,16 @@
<%
boolean rendered = false;
String templateFile = request.getParameter("template");
if (templateFile != null) {
java.io.OutputStream cout = response.getOutputStream();
response.setContentType("image/png");
rendered = net.i2p.router.web.StatSummarizer.instance().renderPng(cout, templateFile);
}
net.i2p.stat.Rate rate = null;
String stat = request.getParameter("stat");
String period = request.getParameter("period");
net.i2p.stat.RateStat rs = net.i2p.I2PAppContext.getGlobalContext().statManager().getRate(stat);
boolean rendered = false;
if (rs != null) {
if ( !rendered && (rs != null)) {
long per = -1;
try {
per = Long.parseLong(period);
@ -19,15 +25,18 @@ if (rs != null) {
response.setContentType("image/png");
int width = -1;
int height = -1;
int periodCount = -1;
String str = request.getParameter("width");
if (str != null) try { width = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
str = request.getParameter("height");
if (str != null) try { height = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
str = request.getParameter("periodCount");
if (str != null) try { periodCount = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
boolean hideLegend = Boolean.valueOf(""+request.getParameter("hideLegend")).booleanValue();
boolean hideGrid = Boolean.valueOf(""+request.getParameter("hideGrid")).booleanValue();
boolean hideTitle = Boolean.valueOf(""+request.getParameter("hideTitle")).booleanValue();
boolean showEvents = Boolean.valueOf(""+request.getParameter("showEvents")).booleanValue();
rendered = net.i2p.router.web.StatSummarizer.instance().renderPng(rate, cout, width, height, hideLegend, hideGrid, hideTitle, showEvents);
rendered = net.i2p.router.web.StatSummarizer.instance().renderPng(rate, cout, width, height, hideLegend, hideGrid, hideTitle, showEvents, periodCount);
}
if (rendered)
cout.close();