diff --git a/apps/jrobin/java/src/org/jrobin/graph/RrdGraphConstants.java b/apps/jrobin/java/src/org/jrobin/graph/RrdGraphConstants.java index 939670c20..87e6fafed 100644 --- a/apps/jrobin/java/src/org/jrobin/graph/RrdGraphConstants.java +++ b/apps/jrobin/java/src/org/jrobin/graph/RrdGraphConstants.java @@ -286,11 +286,11 @@ public interface RrdGraphConstants { /** * Used internally */ - int PADDING_LEFT = 5; // pix + int PADDING_LEFT = 0; // pix - absent vertical label provides padding here /** * Used internally */ - int PADDING_TOP = 9; // pix + int PADDING_TOP = 5; // pix -- additional top pixels added by frame border /** * Used internally */ @@ -314,7 +314,7 @@ public interface RrdGraphConstants { /** * Used internally */ - int PADDING_VLABEL = 7; // pix + int PADDING_VLABEL = 8; // pix /** * Stroke used to draw grid diff --git a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java index 3320b8c69..7b27a46ff 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java @@ -24,6 +24,7 @@ public class GraphHelper extends FormHandler { private int _height; private int _refreshDelaySeconds; private boolean _persistent; + private boolean _graphHideLegend; private String _stat; private int _end; @@ -32,6 +33,7 @@ public class GraphHelper extends FormHandler { private static final String PROP_REFRESH = "routerconsole.graphRefresh"; private static final String PROP_PERIODS = "routerconsole.graphPeriods"; private static final String PROP_EVENTS = "routerconsole.graphEvents"; + private static final String PROP_LEGEND = "routerconsole.graphHideLegend"; public static final int DEFAULT_X = 400; public static final int DEFAULT_Y = 100; private static final int DEFAULT_REFRESH = 5*60; @@ -43,7 +45,7 @@ public class GraphHelper extends FormHandler { private static final int MIN_C = 20; private static final int MAX_C = SummaryListener.MAX_ROWS; private static final int MIN_REFRESH = 15; - + /** set the defaults after we have a context */ @Override public void setContextId(String contextId) { @@ -53,8 +55,9 @@ public class GraphHelper extends FormHandler { _periodCount = _context.getProperty(PROP_PERIODS, DEFAULT_PERIODS); _refreshDelaySeconds = _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH); _showEvents = _context.getBooleanProperty(PROP_EVENTS); + _graphHideLegend = _context.getBooleanProperty(PROP_LEGEND); } - + /** * This must be output in the jsp since *lt;meta> must be in the <head> * @since 0.8.7 @@ -78,14 +81,14 @@ public class GraphHelper extends FormHandler { } /** @since 0.9 */ - public void setE(String str) { + public void setE(String str) { try { _end = Math.max(0, Integer.parseInt(str)); } catch (NumberFormatException nfe) {} } /** @since 0.9 shorter parameter */ - public void setC(String str) { + public void setC(String str) { try { _periodCount = Math.max(MIN_C, Math.min(Integer.parseInt(str), MAX_C)); } catch (NumberFormatException nfe) {} @@ -98,7 +101,7 @@ public class GraphHelper extends FormHandler { } /** @since 0.9 shorter parameter */ - public void setH(String str) { + public void setH(String str) { try { _height = Math.max(MIN_Y, Math.min(Integer.parseInt(str), MAX_Y)); } catch (NumberFormatException nfe) {} @@ -109,7 +112,7 @@ public class GraphHelper extends FormHandler { } /** @since 0.9 shorter parameter */ - public void setW(String str) { + public void setW(String str) { try { _width = Math.max(MIN_X, Math.min(Integer.parseInt(str), MAX_X)); } catch (NumberFormatException nfe) {} @@ -128,6 +131,9 @@ public class GraphHelper extends FormHandler { /** @since 0.8.7 */ public void setPersistent(String foo) { _persistent = true; } + /** @since 0.9.32 */ + public void setHideLegend(String foo) { _graphHideLegend = true; } + /** * For single stat page * @since 0.9 @@ -135,7 +141,7 @@ public class GraphHelper extends FormHandler { public void setStat(String stat) { _stat = stat; } - + public String getImages() { if (StatSummarizer.isDisabled()) return ""; @@ -162,12 +168,20 @@ public class GraphHelper extends FormHandler { String title = _t("Combined bandwidth graph"); _out.write("\""\n"); } - + for (SummaryListener lsnr : ordered) { Rate r = lsnr.getRate(); // e.g. "statname for 60m" @@ -184,11 +198,12 @@ public class GraphHelper extends FormHandler { + " src=\"viewstat.jsp?stat=" + r.getRateStat().getName() + "&showEvents=" + _showEvents - + "&period=" + r.getPeriod() - + "&periodCount=" + _periodCount + + "&period=" + r.getPeriod() + + "&periodCount=" + _periodCount + "&width=" + _width + "&height=" + _height - + "\" alt=\"" + title + + "&hideLegend=" + _graphHideLegend + + "\" alt=\"" + title + "\" title=\"" + title + "\">\n"); } @@ -243,10 +258,11 @@ public class GraphHelper extends FormHandler { + name + "&showEvents=" + _showEvents + "&period=" + period - + "&periodCount=" + _periodCount - + "&end=" + _end + + "&periodCount=" + _periodCount + + "&end=" + _end + "&width=" + _width + "&height=" + _height + + "&hideLegend=" + _graphHideLegend + "\">

\n"); if (_width < MAX_X && _height < MAX_Y) { @@ -363,8 +379,13 @@ public class GraphHelper extends FormHandler { _out.write("   "); _out.write ("\n"); _out.write(_t("Graph size") + ":" + _t("pixels wide") + "   " + _t("pixels wide") + "   " + _t("pixels high") + "" + _t("Note: Dimensions are for graph only (excludes title, labels and legend).") + "\n"); + _out.write(_t("Hide legend") + ":"); + _out.write("\n"); _out.write(_t("Refresh delay") + ":