/** * Return the dimension calculated by the graph desc can (and should) be * overridden with custom graph classes * * @return the dimension of the graphic object */ public Dimension getDimension() { return getGraphDesc().getDimension(); }
protected void setGraphDefData(RrdGraphDef graphDef, Probe<?, ?> defProbe, ExtractInfo ei, Map<String, ? extends Plottable> customData) { GraphDesc gd = getGraphDesc(); gd.fillGraphDef(graphDef, node.getProbe(), ei, customData); }
/** * Provide a RrdGraphDef with template resolved for the node * * @return a RrdGraphDef with some default values */ public RrdGraphDef getEmptyGraphDef() { RrdGraphDef retValue = getGraphDesc().getEmptyGraphDef(); retValue.setDownsampler(new LargestTriangleThreeBuckets(getGraphDesc().getWidth())); retValue.setTitle(node.getGraphTitle()); return retValue; }
protected void addlegend(RrdGraphDef graphDef) { Date lastUpdate = node.getProbe().getLastUpdate(); graphDef.comment("\\l"); graphDef.comment("\\l"); graphDef.comment("Last update: " + lastUpdateFormat.get().format(lastUpdate) + "\\L"); String unit = "SI"; if(!getGraphDesc().isSiUnit()) unit = "binary"; graphDef.comment("Unit type: " + unit + "\\r"); graphDef.comment("Period from " + lastUpdateFormat.get().format(start) + " to " + lastUpdateFormat.get().format(end) + "\\L"); graphDef.comment("Source type: " + node.getProbe().getSourceType() + "\\r"); }
protected void fillGraphDef(RrdGraphDef graphDef) { GraphDesc gd = getGraphDesc(); try { long startsec = getStartSec(); long endsec = getEndSec(); ExtractInfo ei = ExtractInfo.get().make(start, end); graphDef.setStartTime(startsec); graphDef.setEndTime(endsec); PlottableMap customData = node.getCustomData(); if(customData != null) { long step = Math.max((endsec - startsec) / gd.getWidth(), 1); customData.configure(startsec, endsec, step); } setGraphDefData(graphDef, node.getProbe(), ei, customData); if(gd.withLegend()) addlegend(graphDef); } catch (RuntimeException e) { Util.log(this, logger, Level.ERROR, e, "Impossible to create graph definition: %s", e.getMessage()); } }