OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright 2014 The Chromium Authors. All rights reserved. | |
3 Use of this source code is governed by a BSD-style license that can be | |
4 found in the LICENSE file. | |
5 --> | |
6 | |
7 <script> | |
8 function CQGraph(heading, unit, itemUnit, data, alerts, itemAlertThreshold) { | |
9 this.heading = heading; | |
10 this.unit = unit; | |
11 this.itemUnit = itemUnit; | |
12 this.data = data; | |
13 this.alerts = alerts || {}; | |
14 this.itemAlertThreshold = | |
15 itemAlertThreshold !== undefined ? itemAlertThreshold : Infinity; | |
16 } | |
17 | |
18 CQGraph.prototype.breachedItems = function(col, threshold) { | |
19 return this.data.get().then(function(data) { | |
20 var colIndex = data.cols.indexOf(col); | |
21 var items = []; | |
22 data.rows.forEach(function(row, i) { | |
23 if (row[colIndex] >= threshold) { | |
24 items.push({ | |
25 timestamp: row[0], | |
26 value: row[colIndex], | |
27 index: i, | |
28 }); | |
29 } | |
30 }); | |
31 return items; | |
32 }); | |
33 }; | |
34 </script> | |
OLD | NEW |