limit max graph size

This commit is contained in:
zzz
2010-01-24 02:11:55 +00:00
parent 15d1b005f5
commit 959bf4a7f4
2 changed files with 14 additions and 3 deletions

View File

@@ -119,6 +119,10 @@ public class StatSummarizer implements Runnable {
return renderPng(rate, out, -1, -1, false, false, false, false, -1, true);
}
public boolean renderPng(Rate rate, OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents, int periodCount, boolean showCredit) throws IOException {
if (width > GraphHelper.MAX_X)
width = GraphHelper.MAX_X;
if (height > GraphHelper.MAX_Y)
height = GraphHelper.MAX_Y;
for (int i = 0; i < _listeners.size(); i++) {
SummaryListener lsnr = (SummaryListener)_listeners.get(i);
if (lsnr.getRate().equals(rate)) {
@@ -147,6 +151,10 @@ public class StatSummarizer implements Runnable {
public boolean renderRatePng(OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents, int periodCount, boolean showCredit) throws IOException {
long end = _context.clock().now() - 60*1000;
if (width > GraphHelper.MAX_X)
width = GraphHelper.MAX_X;
if (height > GraphHelper.MAX_Y)
height = GraphHelper.MAX_Y;
if (periodCount <= 0) periodCount = SummaryListener.PERIODS;
if (periodCount > SummaryListener.PERIODS)
periodCount = SummaryListener.PERIODS;