Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1743)

Unified Diff: perf/dashboard/ui/js/coordinates.js

Issue 1654813003: Remove old dead perf dashboard pages and js (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « perf/dashboard/ui/generic_plotter.html ('k') | perf/dashboard/ui/js/graph.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: perf/dashboard/ui/js/coordinates.js
===================================================================
--- perf/dashboard/ui/js/coordinates.js (revision 298504)
+++ perf/dashboard/ui/js/coordinates.js (working copy)
@@ -1,136 +0,0 @@
-/*
- Copyright (c) 2012 The Chromium Authors. All rights reserved.
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
-*/
-
-/**
- * 'Understands' plot data positioning.
- * @constructor
- *
- * @param {Array} plotData data that will be displayed
- */
-function Coordinates(plotData, width, height) {
- this.plotData = plotData;
-
- if (!height)
- height = window.innerHeight - 16;
- if (!width)
- width = window.innerWidth - 16;
-
- this.widthMax = width;
- this.heightMax = Math.min(400, height - 85);
-
- this.xMinValue = -0.5;
- this.xMaxValue = (this.plotData[0].length - 1) + 0.5;
- this.processYValues_();
-}
-
-Coordinates.prototype.processYValues_ = function () {
- var merged = [];
- var mergedErr = [];
- for (var i = 0; i < this.plotData.length; i++)
- for (var j = 0; j < this.plotData[i].length; j++) {
- merged.push(parseFloat(this.plotData[i][j][0]));
- mergedErr.push(parseFloat(this.plotData[i][j][1]));
- }
- var max = Math.max.apply( Math, merged );
- var min = Math.min.apply( Math, merged );
- var maxErr = Math.max.apply( Math, mergedErr );
-
- // If we have a missing value, find the real max and min the hard way.
- if (isNaN(min)) {
- for (var i = 0; i < merged.length; ++i) {
- if (isNaN(min) || merged[i] < min)
- min = merged[i];
- if (isNaN(max) || merged[i] > max)
- max = merged[i];
- if (isNaN(maxErr) || mergedErr[i] > maxErr)
- maxErr = mergedErr[i];
- }
- }
-
- this.yMinValue = min - maxErr;
- this.yMaxValue = max + maxErr;
-};
-
-/**
- * Difference between horizontal max min values.
- */
-Coordinates.prototype.xValueRange = function() {
- return this.xMaxValue - this.xMinValue;
-};
-
-/**
- * Difference between vertical max min values.
- */
-Coordinates.prototype.yValueRange = function() {
- return this.yMaxValue - this.yMinValue
-};
-
-/**
- * Converts horizontal data value to pixel value on canvas.
- * @param {number} value horizontal data value
- */
-Coordinates.prototype.xPoints = function(value) {
- return this.widthMax * ((value - this.xMinValue) / this.xValueRange());
-};
-
-/**
- * Converts vertical data value to pixel value on canvas.
- * @param {number} value vertical data value
- */
-Coordinates.prototype.yPoints = function(value) {
- // yValueRange() can be 0. If it is, place |value| in the middle of
- // the region.
- if (this.yValueRange() == 0)
- return this.heightMax / 2;
-
- // Converts value to canvas Y position in pixels.
- return this.heightMax - this.heightMax * (value - this.yMinValue) /
- this.yValueRange();
-};
-
-/**
- * Converts X point on canvas to value it represents.
- * @param {number} position horizontal point on canvas.
- */
-Coordinates.prototype.xValue = function(position) {
- /* Converts canvas X pixels to value. */
- return position / this.widthMax * (this.xValueRange()) + this.xMinValue;
-};
-
-/**
- * Converts Y point on canvas to value it represents.
- * @param {number} position vertical point on canvas.
- */
-Coordinates.prototype.yValue = function(position) {
- /* Converts canvas Y pixels to value.
- position is point value is from top.
- */
- var position = this.heightMax - position;
- var ratio = parseFloat(this.heightMax / position);
- return this.yMinValue + this.yValueRange() / ratio;
-};
-
-/**
- * Converts canvas X pixel to data index.
- * @param {number} xPosition horizontal point on canvas
- */
-Coordinates.prototype.dataSampleIndex = function(xPosition) {
- var xValue = this.xValue(xPosition);
- var index;
- if (xValue < 0) {
- index = 0;
- } else if (xValue > this.plotData[0].length - 1) {
- index = this.plotData[0].length - 1;
- } else {
- index = xValue.toFixed(0);
- }
- return index;
-};
-
-Coordinates.prototype.log = function(val) {
- document.getElementById('log').appendChild(
- document.createTextNode(val + '\n'));
-};
« no previous file with comments | « perf/dashboard/ui/generic_plotter.html ('k') | perf/dashboard/ui/js/graph.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698