OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/ui/base/scatter_chart.html"> | 8 <link rel="import" href="/tracing/ui/base/scatter_chart.html"> |
9 | 9 |
10 <script> | 10 <script> |
(...skipping 21 matching lines...) Expand all Loading... |
32 {x: 40, y: 20, radius: 5, color: 'purple'}, | 32 {x: 40, y: 20, radius: 5, color: 'purple'}, |
33 {x: 50, y: 30, radius: 6, color: 'yellow'}, | 33 {x: 50, y: 30, radius: 6, color: 'yellow'}, |
34 {x: 60, y: 20, radius: 7, color: 'green'}, | 34 {x: 60, y: 20, radius: 7, color: 'green'}, |
35 {x: 70, y: 15, radius: 8, color: 'blue'}, | 35 {x: 70, y: 15, radius: 8, color: 'blue'}, |
36 {x: 80, y: 20, radius: 9, color: 'red'} | 36 {x: 80, y: 20, radius: 9, color: 'red'} |
37 ]; | 37 ]; |
38 | 38 |
39 var mouseDown = undefined; | 39 var mouseDown = undefined; |
40 | 40 |
41 function updateBrushedRange(e) { | 41 function updateBrushedRange(e) { |
42 var xRange = new tr.b.Range(); | 42 var xRange = new tr.b.math.Range(); |
43 if (e.x !== mouseDown.x) { | 43 if (e.x !== mouseDown.x) { |
44 xRange.addValue(mouseDown.x); | 44 xRange.addValue(mouseDown.x); |
45 xRange.addValue(e.x); | 45 xRange.addValue(e.x); |
46 } | 46 } |
47 var yRange = new tr.b.Range(); | 47 var yRange = new tr.b.math.Range(); |
48 if (e.y !== mouseDown.y) { | 48 if (e.y !== mouseDown.y) { |
49 yRange.addValue(mouseDown.y); | 49 yRange.addValue(mouseDown.y); |
50 yRange.addValue(e.y); | 50 yRange.addValue(e.y); |
51 } | 51 } |
52 chart.setBrushedRanges(xRange, yRange); | 52 chart.setBrushedRanges(xRange, yRange); |
53 } | 53 } |
54 | 54 |
55 chart.addEventListener('item-mousedown', function(e) { | 55 chart.addEventListener('item-mousedown', function(e) { |
56 mouseDown = e; | 56 mouseDown = e; |
57 }); | 57 }); |
58 chart.addEventListener('item-mousemove', function(e) { | 58 chart.addEventListener('item-mousemove', function(e) { |
59 updateBrushedRange(e); | 59 updateBrushedRange(e); |
60 }); | 60 }); |
61 chart.addEventListener('item-mouseup', function(e) { | 61 chart.addEventListener('item-mouseup', function(e) { |
62 updateBrushedRange(e); | 62 updateBrushedRange(e); |
63 mouseDown = undefined; | 63 mouseDown = undefined; |
64 }); | 64 }); |
65 }); | 65 }); |
66 }); | 66 }); |
67 </script> | 67 </script> |
OLD | NEW |