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

Side by Side Diff: tracing/tracing/ui/base/bar_chart_test.html

Issue 2771723003: [tracing] Move math utilities from base into their own subdirectory (attempt 2) (Closed)
Patch Set: rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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/base/assert_utils.html"> 8 <link rel="import" href="/tracing/base/assert_utils.html">
9 <link rel="import" href="/tracing/ui/base/bar_chart.html"> 9 <link rel="import" href="/tracing/ui/base/bar_chart.html">
10 <link rel="import" href="/tracing/ui/base/deep_utils.html"> 10 <link rel="import" href="/tracing/ui/base/deep_utils.html">
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 test('instantiation_twoSeries', function() { 54 test('instantiation_twoSeries', function() {
55 var chart = new tr.ui.b.BarChart(); 55 var chart = new tr.ui.b.BarChart();
56 this.addHTMLOutput(chart); 56 this.addHTMLOutput(chart);
57 chart.data = [ 57 chart.data = [
58 {x: 10, alpha: 100, beta: 50}, 58 {x: 10, alpha: 100, beta: 50},
59 {x: 20, alpha: 110, beta: 75}, 59 {x: 20, alpha: 110, beta: 75},
60 {x: 30, alpha: 100, beta: 125}, 60 {x: 30, alpha: 100, beta: 125},
61 {x: 40, alpha: 50, beta: 125} 61 {x: 40, alpha: 50, beta: 125}
62 ]; 62 ];
63 chart.brushedRange = tr.b.Range.fromExplicitRange(20, 40); 63 chart.brushedRange = tr.b.math.Range.fromExplicitRange(20, 40);
64 }); 64 });
65 65
66 test('instantiation_twoSparseSeriesWithFirstValueSparse', function() { 66 test('instantiation_twoSparseSeriesWithFirstValueSparse', function() {
67 var chart = new tr.ui.b.BarChart(); 67 var chart = new tr.ui.b.BarChart();
68 this.addHTMLOutput(chart); 68 this.addHTMLOutput(chart);
69 chart.data = [ 69 chart.data = [
70 {x: 10, alpha: 20, beta: undefined}, 70 {x: 10, alpha: 20, beta: undefined},
71 {x: 20, alpha: undefined, beta: 10}, 71 {x: 20, alpha: undefined, beta: 10},
72 {x: 30, alpha: 10, beta: undefined}, 72 {x: 30, alpha: 10, beta: undefined},
73 {x: 45, alpha: undefined, beta: 20}, 73 {x: 45, alpha: undefined, beta: 20},
(...skipping 25 matching lines...) Expand all
99 {x: 60, value: 20}, 99 {x: 60, value: 20},
100 {x: 70, value: 15}, 100 {x: 70, value: 15},
101 {x: 80, value: 20} 101 {x: 80, value: 20}
102 ]; 102 ];
103 103
104 var mouseDownX = undefined; 104 var mouseDownX = undefined;
105 var curMouseX = undefined; 105 var curMouseX = undefined;
106 106
107 function updateBrushedRange() { 107 function updateBrushedRange() {
108 if (mouseDownX === undefined || (mouseDownX === curMouseX)) { 108 if (mouseDownX === undefined || (mouseDownX === curMouseX)) {
109 chart.brushedRange = new tr.b.Range(); 109 chart.brushedRange = new tr.b.math.Range();
110 return; 110 return;
111 } 111 }
112 var r = new tr.b.Range(); 112 var r = new tr.b.math.Range();
113 r.min = Math.min(mouseDownX, curMouseX); 113 r.min = Math.min(mouseDownX, curMouseX);
114 r.max = Math.max(mouseDownX, curMouseX); 114 r.max = Math.max(mouseDownX, curMouseX);
115 chart.brushedRange = r; 115 chart.brushedRange = r;
116 } 116 }
117 117
118 chart.addEventListener('item-mousedown', function(e) { 118 chart.addEventListener('item-mousedown', function(e) {
119 mouseDownX = e.x; 119 mouseDownX = e.x;
120 curMouseX = e.x; 120 curMouseX = e.x;
121 updateBrushedRange(); 121 updateBrushedRange();
122 }); 122 });
123 chart.addEventListener('item-mousemove', function(e) { 123 chart.addEventListener('item-mousemove', function(e) {
124 if (e.button === undefined) 124 if (e.button === undefined)
125 return; 125 return;
126 curMouseX = e.x; 126 curMouseX = e.x;
127 updateBrushedRange(); 127 updateBrushedRange();
128 }); 128 });
129 chart.addEventListener('item-mouseup', function(e) { 129 chart.addEventListener('item-mouseup', function(e) {
130 curMouseX = e.x; 130 curMouseX = e.x;
131 updateBrushedRange(); 131 updateBrushedRange();
132 }); 132 });
133 }); 133 });
134 134
135 test('instantiation_overrideDataRange', function() { 135 test('instantiation_overrideDataRange', function() {
136 var chart = new tr.ui.b.BarChart(); 136 var chart = new tr.ui.b.BarChart();
137 chart.overrideDataRange = tr.b.Range.fromExplicitRange(10, 90); 137 chart.overrideDataRange = tr.b.math.Range.fromExplicitRange(10, 90);
138 this.addHTMLOutput(chart); 138 this.addHTMLOutput(chart);
139 chart.data = [ 139 chart.data = [
140 {x: 0, value: -20}, 140 {x: 0, value: -20},
141 {x: 1, value: 100}, 141 {x: 1, value: 100},
142 {x: 2, value: -40}, 142 {x: 2, value: -40},
143 {x: 3, value: 100}, 143 {x: 3, value: 100},
144 ]; 144 ];
145 145
146 chart = new tr.ui.b.BarChart(); 146 chart = new tr.ui.b.BarChart();
147 chart.overrideDataRange = tr.b.Range.fromExplicitRange(-10, 100); 147 chart.overrideDataRange = tr.b.math.Range.fromExplicitRange(-10, 100);
148 this.addHTMLOutput(chart); 148 this.addHTMLOutput(chart);
149 chart.data = [ 149 chart.data = [
150 {x: 0, value: 0}, 150 {x: 0, value: 0},
151 {x: 1, value: 50}, 151 {x: 1, value: 50},
152 ]; 152 ];
153 }); 153 });
154 }); 154 });
155 </script> 155 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/ui/analysis/single_thread_time_slice_sub_view.html ('k') | tracing/tracing/ui/base/camera.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698