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/base/iteration_helpers.html"> | 8 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
9 <link rel="import" href="/tracing/base/range.html"> | 9 <link rel="import" href="/tracing/base/range.html"> |
10 <link rel="import" href="/tracing/ui/base/chart_base.html"> | 10 <link rel="import" href="/tracing/ui/base/chart_base.html"> |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 tr.exportTo('tr.ui.b', function() { | 26 tr.exportTo('tr.ui.b', function() { |
27 var ChartBase = tr.ui.b.ChartBase; | 27 var ChartBase = tr.ui.b.ChartBase; |
28 var ChartBase2D = tr.ui.b.define('chart-base-2d', ChartBase); | 28 var ChartBase2D = tr.ui.b.define('chart-base-2d', ChartBase); |
29 | 29 |
30 ChartBase2D.prototype = { | 30 ChartBase2D.prototype = { |
31 __proto__: ChartBase.prototype, | 31 __proto__: ChartBase.prototype, |
32 | 32 |
33 decorate: function() { | 33 decorate: function() { |
34 ChartBase.prototype.decorate.call(this); | 34 ChartBase.prototype.decorate.call(this); |
35 this.classList.add('chart-base-2d'); | 35 Polymer.dom(this).classList.add('chart-base-2d'); |
36 this.xScale_ = d3.scale.linear(); | 36 this.xScale_ = d3.scale.linear(); |
37 this.yScale_ = d3.scale.linear(); | 37 this.yScale_ = d3.scale.linear(); |
38 this.isYLogScale_ = false; | 38 this.isYLogScale_ = false; |
39 this.yLogScaleMin_ = undefined; | 39 this.yLogScaleMin_ = undefined; |
40 this.dataRange_ = new tr.b.Range(); | 40 this.dataRange_ = new tr.b.Range(); |
41 | 41 |
42 this.data_ = []; | 42 this.data_ = []; |
43 this.seriesKeys_ = []; | 43 this.seriesKeys_ = []; |
44 this.leftMargin_ = 50; | 44 this.leftMargin_ = 50; |
45 | 45 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 }, | 345 }, |
346 | 346 |
347 onMouseDown_: function(mouseEvent) { | 347 onMouseDown_: function(mouseEvent) { |
348 tr.ui.b.trackMouseMovesUntilMouseUp( | 348 tr.ui.b.trackMouseMovesUntilMouseUp( |
349 this.onMouseMove_.bind(this, mouseEvent.button), | 349 this.onMouseMove_.bind(this, mouseEvent.button), |
350 this.onMouseUp_.bind(this, mouseEvent.button)); | 350 this.onMouseUp_.bind(this, mouseEvent.button)); |
351 mouseEvent.preventDefault(); | 351 mouseEvent.preventDefault(); |
352 mouseEvent.stopPropagation(); | 352 mouseEvent.stopPropagation(); |
353 var dataEvent = new tr.b.Event('item-mousedown'); | 353 var dataEvent = new tr.b.Event('item-mousedown'); |
354 dataEvent.button = mouseEvent.button; | 354 dataEvent.button = mouseEvent.button; |
355 this.classList.add('updating-brushing-state'); | 355 Polymer.dom(this).classList.add('updating-brushing-state'); |
356 this.prepareDataEvent_(mouseEvent, dataEvent); | 356 this.prepareDataEvent_(mouseEvent, dataEvent); |
357 this.dispatchEvent(dataEvent); | 357 this.dispatchEvent(dataEvent); |
358 }, | 358 }, |
359 | 359 |
360 onMouseMove_: function(button, mouseEvent) { | 360 onMouseMove_: function(button, mouseEvent) { |
361 if (mouseEvent.buttons !== undefined) { | 361 if (mouseEvent.buttons !== undefined) { |
362 mouseEvent.preventDefault(); | 362 mouseEvent.preventDefault(); |
363 mouseEvent.stopPropagation(); | 363 mouseEvent.stopPropagation(); |
364 } | 364 } |
365 var dataEvent = new tr.b.Event('item-mousemove'); | 365 var dataEvent = new tr.b.Event('item-mousemove'); |
366 dataEvent.button = button; | 366 dataEvent.button = button; |
367 this.prepareDataEvent_(mouseEvent, dataEvent); | 367 this.prepareDataEvent_(mouseEvent, dataEvent); |
368 this.dispatchEvent(dataEvent); | 368 this.dispatchEvent(dataEvent); |
369 }, | 369 }, |
370 | 370 |
371 onMouseUp_: function(button, mouseEvent) { | 371 onMouseUp_: function(button, mouseEvent) { |
372 mouseEvent.preventDefault(); | 372 mouseEvent.preventDefault(); |
373 mouseEvent.stopPropagation(); | 373 mouseEvent.stopPropagation(); |
374 var dataEvent = new tr.b.Event('item-mouseup'); | 374 var dataEvent = new tr.b.Event('item-mouseup'); |
375 dataEvent.button = button; | 375 dataEvent.button = button; |
376 this.prepareDataEvent_(mouseEvent, dataEvent); | 376 this.prepareDataEvent_(mouseEvent, dataEvent); |
377 this.dispatchEvent(dataEvent); | 377 this.dispatchEvent(dataEvent); |
378 this.classList.remove('updating-brushing-state'); | 378 Polymer.dom(this).classList.remove('updating-brushing-state'); |
379 } | 379 } |
380 }; | 380 }; |
381 | 381 |
382 return { | 382 return { |
383 ChartBase2D: ChartBase2D | 383 ChartBase2D: ChartBase2D |
384 }; | 384 }; |
385 }); | 385 }); |
386 </script> | 386 </script> |
OLD | NEW |