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

Side by Side Diff: runtime/observatory/lib/src/elements/isolate/counter_chart.dart

Issue 2345023003: Use dartfmt on Observatory code (Closed)
Patch Set: merge Created 4 years, 3 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 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:charted/charted.dart'; 7 import 'package:charted/charted.dart';
8 import "package:charted/charts/charts.dart"; 8 import "package:charted/charts/charts.dart";
9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
10 import 'package:observatory/src/elements/helpers/tag.dart'; 10 import 'package:observatory/src/elements/helpers/tag.dart';
11 11
12 class IsolateCounterChartElement extends HtmlElement implements Renderable { 12 class IsolateCounterChartElement extends HtmlElement implements Renderable {
13 static const tag = 13 static const tag =
14 const Tag<IsolateCounterChartElement>('isolate-counter-chart'); 14 const Tag<IsolateCounterChartElement>('isolate-counter-chart');
15 15
16 RenderingScheduler<IsolateCounterChartElement> _r; 16 RenderingScheduler<IsolateCounterChartElement> _r;
17 17
18 Stream<RenderedEvent<IsolateCounterChartElement>> get onRendered => 18 Stream<RenderedEvent<IsolateCounterChartElement>> get onRendered =>
19 _r.onRendered; 19 _r.onRendered;
20 20
21 Map _counters; 21 Map _counters;
22 StreamSubscription _subscription; 22 StreamSubscription _subscription;
23 23
24 factory IsolateCounterChartElement(Map counters, {RenderingQueue queue}) { 24 factory IsolateCounterChartElement(Map counters, {RenderingQueue queue}) {
(...skipping 20 matching lines...) Expand all
45 _r.disable(notify: true); 45 _r.disable(notify: true);
46 _subscription.cancel(); 46 _subscription.cancel();
47 } 47 }
48 48
49 static final _columns = [ 49 static final _columns = [
50 new ChartColumnSpec(label: 'Type', type: ChartColumnSpec.TYPE_STRING), 50 new ChartColumnSpec(label: 'Type', type: ChartColumnSpec.TYPE_STRING),
51 new ChartColumnSpec(label: 'Percent', formatter: (v) => v.toString()) 51 new ChartColumnSpec(label: 'Percent', formatter: (v) => v.toString())
52 ]; 52 ];
53 53
54 void render() { 54 void render() {
55 final _series = [new ChartSeries("Work", const [1], new PieChartRenderer( 55 final _series = [
56 sortDataByValue: false 56 new ChartSeries(
57 ))]; 57 "Work", const [1], new PieChartRenderer(sortDataByValue: false))
58 ];
58 final areaHost = new DivElement()..classes = ['host']; 59 final areaHost = new DivElement()..classes = ['host'];
59 final legendHost = new DivElement()..classes = ['legend']; 60 final legendHost = new DivElement()..classes = ['legend'];
60 children = [areaHost, legendHost]; 61 children = [areaHost, legendHost];
61 final rect = areaHost.getBoundingClientRect(); 62 final rect = areaHost.getBoundingClientRect();
62 final minSize = new Rect.size(rect.width, rect.height); 63 final minSize = new Rect.size(rect.width, rect.height);
63 final config = new ChartConfig(_series, const [0]) 64 final config = new ChartConfig(_series, const [0])
64 ..minimumSize = minSize 65 ..minimumSize = minSize
65 ..legend = new ChartLegend(legendHost, showValues: true); 66 ..legend = new ChartLegend(legendHost, showValues: true);
66 final data = new ChartData(_columns, _counters.keys 67 final data = new ChartData(
67 .map((key) => [key, double.parse(_counters[key].split('%')[0])]) 68 _columns,
68 .toList()); 69 _counters.keys
70 .map((key) => [key, double.parse(_counters[key].split('%')[0])])
71 .toList());
69 72
70 new LayoutArea(areaHost, data, config, state: new ChartState(), 73 new LayoutArea(areaHost, data, config,
71 autoUpdate: false) 74 state: new ChartState(), autoUpdate: false)
72 ..addChartBehavior(new Hovercard()) 75 ..addChartBehavior(new Hovercard())
73 ..addChartBehavior(new AxisLabelTooltip()) 76 ..addChartBehavior(new AxisLabelTooltip())
74 ..draw(); 77 ..draw();
75 } 78 }
76 } 79 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/instance_view.dart ('k') | runtime/observatory/lib/src/elements/isolate/location.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698