• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RrdGraphDef类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jrobin.graph.RrdGraphDef的典型用法代码示例。如果您正苦于以下问题:Java RrdGraphDef类的具体用法?Java RrdGraphDef怎么用?Java RrdGraphDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RrdGraphDef类属于org.jrobin.graph包,在下文中一共展示了RrdGraphDef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initGraphSource

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
private void initGraphSource(RrdGraphDef graphDef, int height, boolean maxHidden) {
	final String dataSourceName = getDataSourceName();
	final String average = "average";
	graphDef.datasource(average, rrdFileName, dataSourceName, ConsolFuns.CF_AVERAGE);
	graphDef.setMinValue(0);
	final String moyenneLabel = I18N.getString("Moyenne");
	graphDef.area(average, getPaint(height), moyenneLabel);
	graphDef.gprint(average, ConsolFuns.CF_AVERAGE, moyenneLabel + ": %9.0f %S\\r");
	//graphDef.gprint(average, ConsolFuns.CF_MIN, "Minimum: %9.0f %S\\r");
	if (!maxHidden) {
		final String max = "max";
		graphDef.datasource(max, rrdFileName, dataSourceName, "MAX");
		final String maximumLabel = I18N.getString("Maximum");
		graphDef.line(max, Color.BLUE, maximumLabel);
		graphDef.gprint(max, ConsolFuns.CF_MAX, maximumLabel + ": %9.0f %S\\r");
	}
	// graphDef.comment("JRobin :: RRDTool Choice for the Java World");
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:19,代码来源:JRobin.java


示例2: setGraphStartEndTime

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
private static void setGraphStartEndTime(RrdGraphDef graphDef, Range range) {
  long endTime; // Current timestamp or custom end-date
  long startTime; // Depending on the range and end-date
  if (range.getPeriod().equals(Period.CUSTOM)) {
    // Custom period:
    endTime = Math.min(range.getEndDate().getTime() / 1000, Util.getTime());
    startTime = range.getStartDate().getTime() / 1000;
  }
  else {
    endTime = Util.getTime();
    startTime = endTime - range.getPeriod().getDurationSeconds();
  }
  graphDef.setStartTime(startTime);
  graphDef.setEndTime(endTime);
  graphDef.setFirstDayOfWeek(Calendar.getInstance().getFirstDayOfWeek());
}
 
开发者ID:purej,项目名称:purej-vminspect,代码行数:17,代码来源:Statistics.java


示例3: cfgBaseGraphDef

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
private static RrdGraphDef cfgBaseGraphDef() {
	RrdGraphDef rgdef = new RrdGraphDef();
	rgdef.setSignature("www.micmiu.com");
	rgdef.setAntiAliasing(false);
	rgdef.setImageFormat("PNG");
	rgdef.setSmallFont(new Font("Monospaced", Font.PLAIN, 11));
	rgdef.setLargeFont(new Font("SansSerif", Font.BOLD, 14));
	// rgdef

	rgdef.setTitle("JRobin Graph Demo for micmiu.com");
	rgdef.setBase(1024);
	rgdef.setWidth(500);
	rgdef.setHeight(200);
	rgdef.setVerticalLabel("transfer speed [bps]");

	return rgdef;
}
 
开发者ID:micmiu,项目名称:snmp-tutorial,代码行数:18,代码来源:GraphDemoHandler.java


示例4: graphByDef

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
public static void graphByDef(RrdGraphDef rgdef) {
	try {

		RrdGraph graph = new RrdGraph(rgdef);
		System.out.println("[rrd graph info:]"
				+ graph.getRrdGraphInfo().dump());

		// 如果filename没有设置,只是在内存中,可以调用下面的方法再次生成图片文件
		if ("-".equals(graph.getRrdGraphInfo().getFilename())) {
			createImgFile(graph, "jrobin-graph.jpg");
		}
		System.out.println("[Jrobin graph by RrdGraphDef success.]");
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:micmiu,项目名称:snmp-tutorial,代码行数:17,代码来源:GraphDemoHandler.java


示例5: createGraphDefByTemplate

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
/**
 * 根据定义的XML文件创建画图模板
 *
 * @param startTime
 * @param endTime
 * @param templateName
 * @param rrdName
 * @param imgFile
 * @return
 */
public static RrdGraphDef createGraphDefByTemplate(long startTime, long endTime, String templateName, String rrdName, String imgFile) {
	try {
		System.out
				.println("[GraphDef create by xml template file start...]");
		RrdGraphDefTemplate defTemplate = new RrdGraphDefTemplate(
				new InputSource(templateName));
		// setVariable 设置XML template的变量
		defTemplate.setVariable("startTime", startTime);
		defTemplate.setVariable("endTime", endTime);
		defTemplate.setVariable("img_file", imgFile);
		defTemplate.setVariable("rrd_file", rrdName);
		return defTemplate.getRrdGraphDef();

	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:micmiu,项目名称:snmp-tutorial,代码行数:29,代码来源:GraphDemoHandler.java


示例6: addVdefDs

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
protected void addVdefDs(RrdGraphDef graphDef, String sourceName, String[] rhs, double start, double end, Map<String,List<String>> defs) throws RrdException {
    if (rhs.length == 2) {
        graphDef.datasource(sourceName, rhs[0], rhs[1]);
    } else if (rhs.length == 3 && "PERCENT".equals(rhs[2])) {
        // Is there a better way to do this than with a separate DataProcessor?
        double pctRank = Double.valueOf(rhs[1]);
        DataProcessor dataProcessor = new DataProcessor((int)start, (int)end);
        for (String dsName : defs.keySet()) {
            List<String> thisDef = defs.get(dsName);
            if (thisDef.size() == 3) {
                dataProcessor.addDatasource(dsName, thisDef.get(0), thisDef.get(1), thisDef.get(2));
            } else if (thisDef.size() == 1) {
                dataProcessor.addDatasource(dsName, thisDef.get(0));
            }
        }
        try {
            dataProcessor.processData();
        } catch (IOException e) {
            throw new RrdException("Caught IOException: " + e.getMessage());
        }
        
        double result = dataProcessor.getPercentile(rhs[0], pctRank);
        ConstantStaticDef csDef = new ConstantStaticDef((long)start, (long)end, result);
        graphDef.datasource(sourceName, csDef);
    } 
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:27,代码来源:JRobinRrdStrategy.java


示例7: testPrint

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
@Test
public void testPrint() throws Exception {
    long end = System.currentTimeMillis();
    long start = end - (24 * 60 * 60 * 1000);
    String[] command = new String[] {
            "--start=" + start,
            "--end=" + end,
            "CDEF:something=1",
            "PRINT:something:AVERAGE:\"%le\""
    };

    RrdGraphDef graphDef = ((JRobinRrdStrategy)m_strategy).createGraphDef(new File(""), command);
    RrdGraph graph = new RrdGraph(graphDef);
    assertNotNull("graph object", graph);
    
    RrdGraphInfo info = graph.getRrdGraphInfo();
    assertNotNull("graph info object", info);
    
    String[] printLines = info.getPrintLines();
    assertNotNull("graph printLines", printLines);
    assertEquals("graph printLines size", 1, printLines.length);
    assertEquals("graph printLines item 0", "1.000000e+00", printLines[0]);
    double d = Double.parseDouble(printLines[0]);
    assertEquals("graph printLines item 0 as a double", 1.0, d, 0.0);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:26,代码来源:JRobinRrdStrategyTest.java


示例8: parseVDef

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
private void parseVDef(RrdGraphDef graphDef, String word) throws RrdException {
	String[] tokens1 = new ColonSplitter(word).split();
	if (tokens1.length != 2) {
		throw new RrdException("Invalid VDEF specification: " + word);
	}
	String[] tokens2 = tokens1[1].split("=");
	if (tokens2.length != 2) {
		throw new RrdException("Invalid DEF specification: " + word);
	}
               String[] tokens3 = tokens2[1].split(",");
               if (tokens3.length == 2)  {
                   graphDef.datasource(tokens2[0], tokens3[0], tokens3[1]);
               } else {
                   graphDef.datasource(tokens2[0], tokens3[0], Double.parseDouble(tokens3[1]), tokens3[2].equals("PERCENT"));
               }
}
 
开发者ID:OpenNMS,项目名称:jrobin,代码行数:17,代码来源:RrdGraphCmd.java


示例9: parseYGrid

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
private void parseYGrid(RrdGraphDef graphDef, String ygrid) throws RrdException {
	if (ygrid == null) {
		return;
	}
	if (ygrid.equalsIgnoreCase("none")) {
		graphDef.setDrawYGrid(false);
		return;
	}
	String[] tokens = new ColonSplitter(ygrid).split();
	if (tokens.length != 2) {
		throw new RrdException("Invalid YGRID settings: " + ygrid);
	}
	double gridStep = parseDouble(tokens[0]);
	int labelFactor = parseInt(tokens[1]);
	graphDef.setValueAxis(gridStep, labelFactor);
}
 
开发者ID:OpenNMS,项目名称:jrobin,代码行数:17,代码来源:RrdGraphCmd.java


示例10: parseXGrid

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
private void parseXGrid(RrdGraphDef graphDef, String xgrid) throws RrdException {
	if (xgrid == null) {
		return;
	}
	if (xgrid.equalsIgnoreCase("none")) {
		graphDef.setDrawXGrid(false);
		return;
	}
	String[] tokens = new ColonSplitter(xgrid).split();
	if (tokens.length != 8) {
		throw new RrdException("Invalid XGRID settings: " + xgrid);
	}
	int minorUnit = resolveUnit(tokens[0]), majorUnit = resolveUnit(tokens[2]),
			labelUnit = resolveUnit(tokens[4]);
	int minorUnitCount = parseInt(tokens[1]), majorUnitCount = parseInt(tokens[3]),
			labelUnitCount = parseInt(tokens[5]);
	int labelSpan = parseInt(tokens[6]);
	String fmt = tokens[7];
	graphDef.setTimeAxis(minorUnit, minorUnitCount, majorUnit, majorUnitCount,
			labelUnit, labelUnitCount, labelSpan, fmt);
}
 
开发者ID:OpenNMS,项目名称:jrobin,代码行数:22,代码来源:RrdGraphCmd.java


示例11: processRrdFontArgument

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
private void processRrdFontArgument(RrdGraphDef graphDef, String argParm) {
	/*
	String[] argValue = tokenize(argParm, ":", true);
	if (argValue[0].equals("DEFAULT")) {
		int newPointSize = Integer.parseInt(argValue[1]);
		graphDef.setSmallFont(graphDef.getSmallFont().deriveFont(newPointSize));
	} else if (argValue[0].equals("TITLE")) {
		int newPointSize = Integer.parseInt(argValue[1]);
		graphDef.setLargeFont(graphDef.getLargeFont().deriveFont(newPointSize));
	} else {
		try {
			Font font = Font.createFont(Font.TRUETYPE_FONT, new File(argValue[0]));
		} catch (Throwable e) {
			// oh well, fall back to existing font stuff
			log().warn("unable to create font from font argument " + argParm, e);
		}
	}
	*/
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:20,代码来源:JRobinRrdStrategy.java


示例12: graph

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
public byte[] graph(Range range, int width, int height, boolean maxHidden) throws IOException {
	// static init of the AppContext ClassLoader
	AppContextClassLoaderLeakPrevention.dummy();

	try {
		// Rq : il pourrait être envisagé de récupérer les données dans les fichiers rrd ou autre stockage
		// puis de faire des courbes en sparklines html (écrites dans la page html) ou jfreechart

		// create common part of graph definition
		final RrdGraphDef graphDef = new RrdGraphDef();
		if (Locale.CHINESE.getLanguage()
				.equals(I18N.getResourceBundle().getLocale().getLanguage())) {
			graphDef.setSmallFont(new Font(Font.MONOSPACED, Font.PLAIN, 10));
			graphDef.setLargeFont(new Font(Font.MONOSPACED, Font.BOLD, 12));
		}

		initGraphSource(graphDef, height, maxHidden);

		initGraphPeriodAndSize(range, width, height, graphDef);

		graphDef.setImageFormat("png");
		graphDef.setFilename("-");
		// il faut utiliser le pool pour les performances
		// et pour éviter des erreurs d'accès concurrents sur les fichiers
		// entre différentes générations de graphs et aussi avec l'écriture des données
		graphDef.setPoolUsed(true);
		return new RrdGraph(graphDef).getRrdGraphInfo().getBytes();
	} catch (final RrdException e) {
		throw createIOException(e);
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:32,代码来源:JRobin.java


示例13: createGraph

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
/**
 * Creates a graphics binary of this statistics in PNG format.
 *
 * @param range the range to be shown
 * @param width the width of the created PNG
 * @param height the height of the created PNG
 * @return the created binary image data
 * @throws IOException if image creation failed
 */
public byte[] createGraph(Range range, int width, int height) throws IOException {
  try {
    // Create the graph definition:
    RrdGraphDef graphDef = new RrdGraphDef();
    graphDef.setPoolUsed(true);
    graphDef.setFilename("-"); // Important for in-memory generation!

    // Set datasources:
    graphDef.datasource("average", _rrdPath, _name, FUNCTION_AVG, _rrdBackendFactory.getFactoryName());
    graphDef.datasource("max", _rrdPath, _name, FUNCTION_MAX, _rrdBackendFactory.getFactoryName());
    graphDef.setMinValue(0);

    // Set graphics stuff:
    graphDef.setImageFormat("png");
    graphDef.area("average", new GradientPaint(0, 0, Color.RED, 0, height, Color.GREEN, false), "Mean");
    graphDef.line("max", Color.BLUE, "Maximum");
    graphDef.gprint("average", FUNCTION_AVG, "Mean: %9.0f " + _unit + "\\r");
    graphDef.gprint("max", FUNCTION_MAX, "Maximum: %9.0f " + _unit + "\\r");
    graphDef.setWidth(width);
    graphDef.setHeight(height);

    setGraphStartEndTime(graphDef, range);
    setGraphTitle(graphDef, _label, range, width);

    return new RrdGraph(graphDef).getRrdGraphInfo().getBytes();
  }
  catch (final RrdException e) {
    throw new IOException(e);
  }
}
 
开发者ID:purej,项目名称:purej-vminspect,代码行数:40,代码来源:Statistics.java


示例14: setGraphTitle

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
private static void setGraphTitle(RrdGraphDef graphDef, String label, Range range, int width) {
  String titleStart = label + " - " + range.getPeriod().getLabel();
  String titleEnd = "";
  if (width > 400) {
    if (range.getPeriod().equals(Period.CUSTOM)) {
      titleEnd = " - " + Utils.formatDate(range.getStartDate()) + " - " + Utils.formatDate(range.getEndDate());
    }
    else {
      titleEnd = " - " + Utils.formatDate(new Date());
    }
  }
  graphDef.setTitle(titleStart + titleEnd);
}
 
开发者ID:purej,项目名称:purej-vminspect,代码行数:14,代码来源:Statistics.java


示例15: graphDef4Demo

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
/**
 * 自定义画图模板
 *
 * @param startTime
 * @param endTime
 * @param rrdName
 * @param imgFileName
 * @return
 */
public static RrdGraphDef graphDef4Demo(long startTime, long endTime,
										String rrdName, String imgFileName) {
	RrdGraphDef rgdef = null;
	try {
		System.out.println("[rrd graph by RrdGraphDef start...]");
		rgdef = cfgBaseGraphDef();

		rgdef.setFilename(imgFileName);
		rgdef.setStartTime(startTime);
		rgdef.setEndTime(endTime);

		rgdef.datasource("port", rrdName, "flow", "AVERAGE");
		rgdef.datasource("line_data", "port,8,*");
		rgdef.line("line_data", Color.BLUE, "test flow\\l");

		// \\l->左对齐 \\c->中间对齐 \\r->右对齐 \\j->自适应
		// \\s-> \\g->glue \\J->
		rgdef.gprint("line_data", "MAX", "速率最大值=%.2f %sbps");
		rgdef.gprint("line_data", "AVERAGE", "速率平均值=%.2f %sbps\\l");
		rgdef.gprint("line_data", "TOTAL", "总流量=%.2f %sb\\l");
		rgdef.comment("More info see : www.micmiu.com");

		return rgdef;
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:micmiu,项目名称:snmp-tutorial,代码行数:38,代码来源:GraphDemoHandler.java


示例16: graphDef4Interval

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
/**
 * 创建指定时间段的画图模板
 *
 * @param startTime
 * @param endTime
 * @param rrdName
 * @param imgFileName
 * @return
 */
public static RrdGraphDef graphDef4Interval(long startTime, long endTime,
											String rrdName, String imgFileName, String time1, String time2) {
	RrdGraphDef rgdef = null;
	try {
		System.out.println("[rrd graph def for TimeInterval start...]");
		rgdef = cfgBaseGraphDef();

		rgdef.setFilename(imgFileName);
		rgdef.setStartTime(startTime);
		rgdef.setEndTime(endTime);

		rgdef.datasource("port", rrdName, "flow", "AVERAGE");
		// rpn:TIME,starttime,GE,TIME,endtime,LT,*,dsname,UNKN,IF
		String rpnExp = "TIME,{0},GE,TIME,{1},LE,*,{2},UNKN,IF";
		String rpn = MessageFormat.format(rpnExp, time1, time2, "port");
		rgdef.datasource("port_data", rpn);
		rgdef.datasource("line_data", "port_data,8,*");
		rgdef.line("line_data", Color.BLUE, "test flow\\l");

		rgdef.gprint("line_data", "MAX", "速率最大值=%.2f %sbps");
		rgdef.gprint("line_data", "AVERAGE", "速率平均值=%.2f %sbps\\l");
		rgdef.gprint("line_data", "TOTAL", "总流量=%.2f %sb\\l");
		rgdef.comment("More info see : www.micmiu.com");

		return rgdef;
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:micmiu,项目名称:snmp-tutorial,代码行数:40,代码来源:GraphDemoHandler.java


示例17: graphDef4HorizontalMerge

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
/**
 * 多个端口指定时间段合并画图模板
 *
 * @param startTime
 * @param endTime
 * @param imgFileName
 * @param rrdparas
 * @return
 */
public static RrdGraphDef graphDef4HorizontalMerge(long startTime, long endTime, String imgFileName, List<String[]> rrdparas) {
	RrdGraphDef rgdef = null;
	try {
		System.out.println("[ RrdGraphDef for horizontal merge start...]");
		rgdef = cfgBaseGraphDef();

		rgdef.setFilename(imgFileName);
		rgdef.setStartTime(startTime);
		rgdef.setEndTime(endTime);

		// rpn:TIME,starttime,GE,TIME,endtime,LT,*,port_1,0,IF
		String rpnExp = "TIME,{0},GE,TIME,{1},LT,*,{2},0,IF";
		String totalExp = "0";
		for (int i = 0; i < rrdparas.size(); i++) {
			rgdef.datasource("port_" + i, rrdparas.get(i)[0], "flow",
					"AVERAGE");
			String rpn = MessageFormat.format(rpnExp, rrdparas.get(i)[1],
					rrdparas.get(i)[2], "port_" + i);
			rgdef.datasource("port_" + i + "_data", rpn);
			rgdef.datasource("port_" + i + "_data_8", "port_" + i
					+ "_data,8,*");
			totalExp += ",port_" + i + "_data_8,+";

		}
		rgdef.datasource("port_merge", totalExp);

		rgdef.line("port_merge", Color.BLUE, "test flow\\l");
		rgdef.gprint("port_merge", "MAX", "速率最大值=%.2f %sbps");
		rgdef.gprint("port_merge", "AVERAGE", "速率平均值=%.2f %sbps\\l");
		rgdef.gprint("port_merge", "TOTAL", "总流量=%.2f %sb\\l");
		rgdef.comment("More info see : www.micmiu.com");

		return rgdef;
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:micmiu,项目名称:snmp-tutorial,代码行数:48,代码来源:GraphDemoHandler.java


示例18: createGraphReturnDetails

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * This constructs a graphDef by parsing the rrdtool style command and using
 * the values to create the JRobin graphDef. It does not understand the 'AT
 * style' time arguments however. Also there may be some rrdtool parameters
 * that it does not understand. These will be ignored. The graphDef will be
 * used to construct an RrdGraph and a PNG image will be created. An input
 * stream returning the bytes of the PNG image is returned.
 */
public RrdGraphDetails createGraphReturnDetails(final String command, final File workDir) throws IOException, org.opennms.netmgt.rrd.RrdException {

    try {
        String[] commandArray = tokenize(command, " \t", false);

        RrdGraphDef graphDef = createGraphDef(workDir, commandArray);
        graphDef.setSignature("OpenNMS/JRobin");

        RrdGraph graph = new RrdGraph(graphDef);

        /*
         * We use a custom RrdGraphDetails object here instead of the
         * DefaultRrdGraphDetails because we won't have an InputStream
         * available if no graphing commands were used, e.g.: if we only
         * use PRINT or if the user goofs up a graph definition.
         * 
         * We want to throw an RrdException if the caller calls
         * RrdGraphDetails.getInputStream and no graphing commands were
         * used.  If they just call RrdGraphDetails.getPrintLines, though,
         * we don't want to throw an exception.
         */
        return new JRobinRrdGraphDetails(graph, command);
    } catch (Throwable e) {
        log().error("JRobin: exception occurred creating graph: " + e.getMessage(), e);
        throw new org.opennms.netmgt.rrd.RrdException("An exception occurred creating the graph: " + e.getMessage(), e);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:38,代码来源:JRobinRrdStrategy.java


示例19: testCommentWithNewlines

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
@Test
public void testCommentWithNewlines() throws Exception {
    long end = System.currentTimeMillis();
    long start = end - (24 * 60 * 60 * 1000);
    String[] command = new String[] {
            "--start=" + start,
            "--end=" + end,
            "COMMENT:foo\\n"
    };
    String[] command2 = new String[] {
            "--start=" + start,
            "--end=" + end,
            "COMMENT:foo\\n",
            "COMMENT:foo2\\n"
    };

    RrdGraphDef graphDef = ((JRobinRrdStrategy)m_strategy).createGraphDef(new File(""), command);
    RrdGraph graph = new RrdGraph(graphDef);
    assertNotNull("graph object", graph);
    
    int firstHeight = graph.getRrdGraphInfo().getHeight();

    RrdGraphDef graphDef2 = ((JRobinRrdStrategy)m_strategy).createGraphDef(new File(""), command2);
    RrdGraph graph2 = new RrdGraph(graphDef2);
    assertNotNull("second graph object", graph2);
    
    int secondHeight = graph2.getRrdGraphInfo().getHeight();

    assertFalse("first graph height " + firstHeight + " and second graph height " + secondHeight + " should not be equal... there should be another newline in the second one making it taller", firstHeight == secondHeight);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:31,代码来源:JRobinRrdStrategyTest.java


示例20: testGprintWithNewlines

import org.jrobin.graph.RrdGraphDef; //导入依赖的package包/类
@Test
public void testGprintWithNewlines() throws Exception {
    long end = System.currentTimeMillis();
    long start = end - (24 * 60 * 60 * 1000);
    String[] command = new String[] {
            "--start=" + start,
            "--end=" + end,
            "CDEF:a=1",
            "GPRINT:a:AVERAGE:\"%8.2lf\\n\""
    };
    String[] command2 = new String[] {
            "--start=" + start,
            "--end=" + end,
            "CDEF:a=1",
            "CDEF:b=1",
            "GPRINT:a:AVERAGE:\"%8.2lf\\n\"",
            "GPRINT:b:AVERAGE:\"%8.2lf\\n\""
    };

    RrdGraphDef graphDef = ((JRobinRrdStrategy)m_strategy).createGraphDef(new File(""), command);
    RrdGraph graph = new RrdGraph(graphDef);
    assertNotNull("graph object", graph);
    
    int firstHeight = graph.getRrdGraphInfo().getHeight();

    RrdGraphDef graphDef2 = ((JRobinRrdStrategy)m_strategy).createGraphDef(new File(""), command2);
    RrdGraph graph2 = new RrdGraph(graphDef2);
    assertNotNull("second graph object", graph2);
    
    int secondHeight = graph2.getRrdGraphInfo().getHeight();

    assertFalse("first graph height " + firstHeight + " and second graph height " + secondHeight + " should not be equal... there should be another line with a newline in the second one making it taller", firstHeight == secondHeight);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:34,代码来源:JRobinRrdStrategyTest.java



注:本文中的org.jrobin.graph.RrdGraphDef类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JTATransactionController类代码示例发布时间:2022-05-22
下一篇:
Java DefaultGoApiResponse类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap