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

Java RrdGraph类代码示例

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

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



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

示例1: createMoodleDiskWaitGraph

import org.rrd4j.graph.RrdGraph; //导入依赖的package包/类
private static final void createMoodleDiskWaitGraph(String graphLocation,
		String rrdDBLocation) {
	try {
		RrdGraphDef waitGraphDef = new RrdGraphDef();
		waitGraphDef.setTimeSpan(-3600L, -0L);
		waitGraphDef.datasource("linea", rrdDBLocation, "a", ConsolFun.TOTAL);
		waitGraphDef.datasource("lineb", rrdDBLocation, "b", ConsolFun.TOTAL);
		waitGraphDef.line("linea", Color.GREEN, "Average Wait", 3);
		waitGraphDef.line("lineb", Color.BLUE, "Service Wait", 3);
		waitGraphDef.setFilename(graphLocation);
		waitGraphDef.setMaxValue(10);
		RrdGraph waitGraph = new RrdGraph(waitGraphDef);//actually creates the graph for wait.
	} catch (IOException e) {
		System.out.println(e);
	}
}
 
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:17,代码来源:RRD.java


示例2: generateGraph

import org.rrd4j.graph.RrdGraph; //导入依赖的package包/类
private void generateGraph(RrdDb rrdDb) throws IOException {
	RrdGraphDef gDef = new RrdGraphDef();
	gDef.setWidth(500);
	gDef.setHeight(300);
	gDef.setFilename(name + ".png");
	gDef.setStartTime(startTime);
	gDef.setEndTime(rrdDb.getLastUpdateTime());
	gDef.setTitle(name);
	gDef.setVerticalLabel(physicalQuantity.getUnit());
	gDef.datasource(physicalQuantity.toString(), rrdPath, name, ConsolFun.MAX);
	gDef.line(physicalQuantity.toString(), Color.RED, physicalQuantity.toString() + " max");
	gDef.setImageFormat("png");
	graph = new RrdGraph(gDef);
}
 
开发者ID:SebiGo,项目名称:BrewControlServer,代码行数:15,代码来源:RRD.java


示例3: createImage

import org.rrd4j.graph.RrdGraph; //导入依赖的package包/类
private byte[] createImage(RrdGraphDef graphDef) throws IOException {
    RrdGraph graph = new RrdGraph(graphDef);
    BufferedImage bim = new BufferedImage(graph.getRrdGraphInfo().getWidth(),
            graph.getRrdGraphInfo().getHeight(), BufferedImage.TYPE_INT_RGB);
    graph.render(bim.getGraphics());

    ByteArrayOutputStream baos = null;
    try {
        baos = new ByteArrayOutputStream();
        ImageIO.write(bim, "png", baos);
        baos.flush();
        return baos.toByteArray();
    } finally {
        if (baos != null) {
            baos.close();
        }
    }
}
 
开发者ID:chadmv,项目名称:plow,代码行数:19,代码来源:RrdGraphController.java


示例4: run

import org.rrd4j.graph.RrdGraph; //导入依赖的package包/类
@Override
public void run() {
    try {
        // generate PNG diagram
        RrdGraphDef gDef = new RrdGraphDef();
        gDef.setFilename("-");
        gDef.setWidth(800);
        gDef.setHeight(600);
        gDef.setStartTime(start / 1000);
        gDef.setEndTime(System.currentTimeMillis() / 1000);
        gDef.setTitle("KiWiLoader Performance");
        gDef.setVerticalLabel("number/sec");
        gDef.setAntiAliasing(true);


        gDef.datasource("triples", statFile.toString(), "triples", ConsolFun.AVERAGE);

        gDef.line("triples", Color.BLUE, "Triples Written", 3F);


        gDef.setImageFormat("png");
        gDef.gprint("triples", ConsolFun.AVERAGE, "average triples/sec: %,.0f\\l");

        RrdGraph graph = new RrdGraph(gDef);
        BufferedImage img = new BufferedImage(900,750, BufferedImage.TYPE_INT_RGB);
        graph.render(img.getGraphics());

        try (OutputStream stream = Files.newOutputStream(gFile, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE)) {
            ImageIO.write(img, "png", stream);
        }

        log.info("updated statistics diagram generated in {}", gFile);

        statLastDump = System.currentTimeMillis();
    } catch (Exception ex) {
        log.warn("error creating statistics diagram: {}", ex.getMessage());
    }
}
 
开发者ID:apache,项目名称:marmotta,代码行数:39,代码来源:Statistics.java


示例5: createMoodleGraph

import org.rrd4j.graph.RrdGraph; //导入依赖的package包/类
private static final void createMoodleGraph(String graphLocation,
		String rrdDBLocation) {
	try {
		RrdGraphDef graphDef = new RrdGraphDef();
		graphDef.setTimeSpan(-3600L, -0L);
		graphDef.datasource("lineb", rrdDBLocation, "users", ConsolFun.TOTAL);
		graphDef.line("lineb", Color.GREEN, "Number of Moodle Users", 3);
		graphDef.setFilename(graphLocation);
		RrdGraph graph = new RrdGraph(graphDef);//actually creates the file.
	} catch (IOException e) {
		System.out.println(e);
	}
}
 
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:14,代码来源:RRD.java


示例6: createSREventCountGraph

import org.rrd4j.graph.RrdGraph; //导入依赖的package包/类
private static final void createSREventCountGraph(String graphLocation,
		String rrdDBLocation) {
	try {
		RrdGraphDef graphDef = new RrdGraphDef();
		graphDef.setTimeSpan(-3600L, -0L);
		graphDef.datasource("lineb", rrdDBLocation, "eventcount", ConsolFun.TOTAL);
		graphDef.line("lineb", Color.GREEN, "Event Count", 3);
		graphDef.setFilename(graphLocation);
		RrdGraph graph = new RrdGraph(graphDef);//actually creates the file.
	} catch (IOException e) {
		System.out.println(e);
	}
}
 
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:14,代码来源:RRD.java


示例7: createMoodleDiskUtilisationGraph

import org.rrd4j.graph.RrdGraph; //导入依赖的package包/类
private static final void createMoodleDiskUtilisationGraph(String graphLocation,
		String rrdDBLocation) {
	try {
		RrdGraphDef utilisationGraphDef = new RrdGraphDef();
		utilisationGraphDef.setTimeSpan(-3600L, -0L);
		utilisationGraphDef.datasource("linea", rrdDBLocation, "a", ConsolFun.TOTAL);
		utilisationGraphDef.line("linea", Color.RED, "Utilisation", 3);
		utilisationGraphDef.setFilename(graphLocation);
		RrdGraph utilisationGraph = new RrdGraph(utilisationGraphDef);//actually creates the graph for utilisation.
	} catch (IOException e) {
		System.out.println(e);
	}
}
 
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:14,代码来源:RRD.java


示例8: render

import org.rrd4j.graph.RrdGraph; //导入依赖的package包/类
public void render() {
        try {
            flushRdd();

// then create a graph definition
            RrdGraphDef gDef = new RrdGraphDef();
            gDef.setWidth(800);
            gDef.setHeight(600);
            gDef.setFilename("/tmp/sample.png");
            gDef.setStartTime((System.currentTimeMillis()/1000) - (500));
            gDef.setEndTime(System.currentTimeMillis()/1000);
            gDef.setTitle("My Title");
            gDef.setVerticalLabel("bytes");

            gDef.datasource("speed", "/tmp/test.rrd", "speed", AVERAGE);
            gDef.datasource("batteryPercent", "/tmp/test.rrd", "batteryPercent", AVERAGE);
            gDef.datasource("power", "/tmp/test.rrd", "power", AVERAGE);
            gDef.datasource("estRange", "/tmp/test.rrd", "estRange", AVERAGE);

            gDef.line("speed", Color.GREEN, "speed mph");
            gDef.line("batteryPercent", Color.MAGENTA, "batteryPercent");
            gDef.area("power", Color.YELLOW, "power");
            gDef.line("estRange", Color.RED, null);

            gDef.comment("\\r");


            Variable speedmax = new Variable.MAX();
            Variable powermax = new Variable.MAX();
            gDef.datasource("speedmax", "speed", speedmax);
            gDef.datasource("powermax", "power", powermax);
            gDef.gprint("speedmax", "speedmax = %.3f%s");
            gDef.gprint("powermax", "powermax = %.3f%S\\c");

            gDef.setImageFormat("png");

            RrdGraph graph = new RrdGraph(gDef);

            LOGGER.info("render: graphInfo[{}]", graph.getRrdGraphInfo().dump());
        } catch (IOException ex) {
            LOGGER.error("render: Error rendering graph.", ex);
        }
    }
 
开发者ID:avirtuos,项目名称:teslog,代码行数:44,代码来源:RrdTelemetryStore.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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