示例#1
0
	public TimeAxis(RrdGraph rrdGraph) {
		this.rrdGraph = rrdGraph;
		if (rrdGraph.im.xsize > 0) {
			this.secPerPix = (rrdGraph.im.end - rrdGraph.im.start) / ((Double)(rrdGraph.im.xsize));
		}
		this.calendar = DateTime.Now;
	}
示例#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);
        }