PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/details/compare.js

http://showslow.googlecode.com/
JavaScript | 61 lines | 49 code | 10 blank | 2 comment | 11 complexity | aab2d67022ec35fdaa2d32e49215571d MD5 | raw file
 1/*jslint browser: true*/
 2/*global Timeplot, YAHOO*/
 3var timeplot;
 4
 5YAHOO.util.Event.onDOMReady(function() { 
 6	var timeGeometry = new Timeplot.DefaultTimeGeometry({
 7		gridColor: "#000000",
 8		axisLabelsPlacement: "bottom"
 9	});
10
11	var valueGeometryGrades = new Timeplot.DefaultValueGeometry({
12		max: 100,
13		min: 0,
14		gridColor: "#000000",
15		axisLabelsPlacement: "left"
16	});
17
18	var plotInfo = [];
19	for (var url in data) {
20		data[url].eventsource = new Timeplot.DefaultEventSource();
21
22		var column = 2; // second for yslow and pagespeed, first for dynatrace
23		if (ranker == 'dynatrace') {
24			column = 1;
25		}
26
27		plotInfo[plotInfo.length] = Timeplot.createPlotInfo({
28			id: url,
29			label: url,
30			dataSource: new Timeplot.ColumnSource(data[url].eventsource,column),
31			timeGeometry: timeGeometry,
32			valueGeometry: valueGeometryGrades,
33			lineColor: data[url].color,
34			showValues: true
35		});
36	}
37
38	timeplot = Timeplot.create(document.getElementById("my-timeplot"), plotInfo);
39
40	for (var url in data) {
41		if (ranker == 'pagespeed') {
42			timeplot.loadText('data_pagespeed.php?smooth&subset=graph&url=' + encodeURIComponent(url) + '&ver=' + data[url].version, ",", data[url].eventsource);
43		} else if (ranker == 'dynatrace') {
44			timeplot.loadText('data_dynatrace.php?smooth&subset=graph&url=' + encodeURIComponent(url) + '&ver=' + data[url].version, ",", data[url].eventsource);
45		} else {
46			timeplot.loadText('data.php?smooth&subset=graph&profile=ydefault&url=' + encodeURIComponent(url) + '&ver=' + data[url].version, ",", data[url].eventsource);
47		}
48	}
49
50});
51
52var resizeTimerID = null;
53
54YAHOO.util.Event.addListener(document, 'resize', function() {
55	if (resizeTimerID === null) {
56		resizeTimerID = window.setTimeout(function() {
57			resizeTimerID = null;
58			timeplot.repaint();
59		}, 100);
60	}
61});