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++; }
/** * Add a plot, but only uses String as parameters, for the GraphFactory * * @param name Name of the plot * @param dsName the datastore to use * @param rpn The RPN, used instead of the datastore * @param graphType * @param color * @param legend * @param consFunc * @param reversed * @param host * @param probe * @param subDsName */ public void add( String name, String rpn, String graphType, String color, String legend, String consFunc, String reversed, String percentile, // The path to an external datastore String host, String probe, String dsName) { if (logger.isTraceEnabled()) logger.trace( "Adding " + name + ", " + rpn + ", " + graphType + ", " + color + ", " + legend + ", " + consFunc + ", " + reversed + ", " + host + ", " + probe); GraphType gt = null; if (graphType == null || "".equals(graphType)) { if (legend != null) gt = GraphType.COMMENT; else gt = GraphType.NONE; } else gt = GraphType.valueOf(graphType.toUpperCase()); ConsolFun cf = null; if (gt != GraphType.COMMENT) { cf = DEFAULTCF; if (consFunc != null && !"".equals(consFunc)) cf = ConsolFun.valueOf(consFunc.toUpperCase()); } Color c = null; if (gt.toPlot()) { c = Color.WHITE; if (color != null && color.toUpperCase().matches("^#[0-9A-F]{6}")) { int r = Integer.parseInt(color.substring(1, 3), 16); int g = Integer.parseInt(color.substring(3, 5), 16); int b = Integer.parseInt(color.substring(5, 7), 16); c = new Color(r, g, b); } else if (color != null && !"".equals(color)) { c = Colors.valueOf(color.toUpperCase()).getColor(); if (c == null) c = Color.getColor(color); if (c == null) { logger.error("Cannot read color " + color); c = Color.white; } } else { c = Colors.resolveIndex(lastColor); if (gt.toPlot()) lastColor++; } } if (name != null) { // If not a rpn, it must be a datastore if (gt.datasource() && rpn == null && dsName == null) { dsName = name; } } // If the name is missing, generate one ? else { name = Integer.toHexString((int) (Math.random() * Integer.MAX_VALUE)); } // Auto generated legend if (legend == null && name != null && gt.legend()) legend = name; Integer valPercentile = null; if (percentile != null && !"".equals(percentile)) { valPercentile = jrds.Util.parseStringNumber(percentile, Integer.valueOf(0)); } add(name, dsName, rpn, gt, c, legend, cf, reversed != null, valPercentile, host, probe); }
/** * Add a datastore that will not generate a graph * * @param name String */ public void add(String name) { add(name, name, null, GraphType.NONE, null, null, DEFAULTCF, false, null, null, null); }