specElement.appendChild(document.createElement("reversed")); specElement.appendChild(document.createElement("graphType")).setTextContent(e.graphType.toString()); if(e.color != null) { String colorString = colornames.get(e.color);
boolean complete; if (!ds.graphType.datasource()) { complete = true;
gt = GraphType.NONE; } else gt = GraphType.valueOf(graphType.toUpperCase()); if(gt.toPlot()) { if(color != null && color.toUpperCase().matches("^#[0-9A-F]{6}")) { int r = Integer.parseInt(color.substring(1, 3), 16); if(gt.toPlot()) lastColor++; if(gt.datasource() && rpn == null && dsName == null) { dsName = name; if(legend == null && gt.legend()) { legend = name;
/** * Fill a GraphDef with values as defined by the graph desc * * @param graphDef the GraphDef to configure * @param defProbe The probe to get values from * @param customData some custom data, they override existing values in the * associated probe */ public void fillGraphDef(RrdGraphDef graphDef, Probe<?, ?> defProbe, ExtractInfo ei, Map<String, ? extends Plottable> customData) { List<DsDesc> toDo = DatasourcesPopulator.populate(graphDef, defProbe, ei, customData, allds, name); // The title line, only if values block is required if(withSummary) { graphDef.comment(""); // We simulate the color box graphDef.comment(MANYSPACE.substring(0, Math.min(maxLengthLegend, MANYSPACE.length() - 2) + 4)); graphDef.comment("Current"); graphDef.comment(" Average"); graphDef.comment(" Minimum"); graphDef.comment(" Maximum"); graphDef.comment("\\l"); } String shortLegend = withSummary ? " \\g" : null; for(DsDesc ds: toDo) { ds.graphType.draw(graphDef, ds.name, ds.color, shortLegend); if(withSummary && ds.graphType.legend()) addLegend(graphDef, ds.name, ds.graphType, ds.legend); } }
static public GraphDesc getGd() { GraphDesc gd = new GraphDesc(); gd.add("sun", null, GraphDesc.LINE.toString(), "green", null, null, null, null, null, null, null); gd.add("shade", null, GraphDesc.LINE.toString(), "blue", null, null, null, null, null, null, null); gd.add("median", "sun,shade,+,2,/", GraphDesc.LINE.toString(), "magenta", null, null, null, null, null, null, null); gd.add("diff", "sun,shade,-,ABS,-1,*", GraphDesc.AREA.toString(), "yellow", null, null, null, null, null, null, null); gd.setGraphTitle("Temperatures in May 2003"); gd.setVerticalLabel("temperature"); return gd; }
public int getLegendLines() { int numlegend = 0; for(DsDesc dd: allds) { if(dd.graphType.legend() && dd.legend != null && withSummary) numlegend++; } return numlegend; }
public void add(String name, GraphType graphType) { add(name, name, null, graphType, Colors.resolveIndex(lastColor), name, DEFAULTCF, false, null, null, null); if(graphType.toPlot()) lastColor++; }