コード例 #1
0
ファイル: RrdGraph.cs プロジェクト: vdaron/robin.net
	/**
	 * Creates graph from the corresponding {@link RrdGraphDef} object.
	 *
	 * @param gdef Graph definition
	 * @throws IOException  Thrown in case of I/O error
	 * @throws RrdException Thrown in case of JRobin related error
	 */
	public RrdGraph(RrdGraphDef gdef) {
		this.gdef = gdef;
		signature = gdef.getSignature();
		worker = new ImageWorker(100, 100); // Dummy worker, just to start with something
		try {
			createGraph();
		}
		finally {
			worker.dispose();
			worker = null;
			dproc = null;
		}
	}
コード例 #2
0
ファイル: RRD.cs プロジェクト: ccampo133/PlotPing
        public static void saveAsPng(string filename, List<DateTime> dates, string hostOrIp, 
            string routeToDestination, string networkInteface, string userNotes)
        {
            // RrdGraph output is not perfect, but it does produce a graph.
            // For better results, use some other graph library, eg
            // could try Java https://code.google.com/p/rrd4j/
            // or http://oldwww.jrobin.org/api/graphingapi.html
            // or possibly https://code.google.com/p/rrd4net/source/browse/#svn%2Ftrunk%2Frrd4n.Graph

            RrdGraphDef def = new RrdGraphDef();
            def.setTimeSpan(dates[0].GetTimestamp(), dates[dates.Count - 1].GetTimestamp());

            def.setVerticalLabel("ms");
            def.setTitle("Ping times to " + hostOrIp + " via " + routeToDestination);
            def.datasource("in", filename, "input", ConsolidationFunction.AVERAGE);
            def.line("in", Color.Green, "ping time");

            def.imageFormat="png";
            def.filename=filename+"."+def.imageFormat;
            if (File.Exists(def.filename))
            {
                File.Delete(def.filename);
            }
            RrdGraph g = new RrdGraph(def);
        }