| OLD | NEW |
| 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'; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = [new ChartSeries("Work", const [1], new PieChartRenderer( |
| 56 sortDataByValue: false | 56 sortDataByValue: false |
| 57 ))]; | 57 ))]; |
| 58 final areaHost = new DivElement()..classes = const ['host']; | 58 final areaHost = new DivElement()..classes = ['host']; |
| 59 final legendHost = new DivElement()..classes = const ['legend']; | 59 final legendHost = new DivElement()..classes = ['legend']; |
| 60 children = [areaHost, legendHost]; | 60 children = [areaHost, legendHost]; |
| 61 final rect = areaHost.getBoundingClientRect(); | 61 final rect = areaHost.getBoundingClientRect(); |
| 62 final minSize = new Rect.size(rect.width, rect.height); | 62 final minSize = new Rect.size(rect.width, rect.height); |
| 63 final config = new ChartConfig(_series, const [0]) | 63 final config = new ChartConfig(_series, const [0]) |
| 64 ..minimumSize = minSize | 64 ..minimumSize = minSize |
| 65 ..legend = new ChartLegend(legendHost, showValues: true); | 65 ..legend = new ChartLegend(legendHost, showValues: true); |
| 66 final data = new ChartData(_columns, _counters.keys | 66 final data = new ChartData(_columns, _counters.keys |
| 67 .map((key) => [key, double.parse(_counters[key].split('%')[0])]) | 67 .map((key) => [key, double.parse(_counters[key].split('%')[0])]) |
| 68 .toList()); | 68 .toList()); |
| 69 | 69 |
| 70 new LayoutArea(areaHost, data, config, state: new ChartState(), | 70 new LayoutArea(areaHost, data, config, state: new ChartState(), |
| 71 autoUpdate: false) | 71 autoUpdate: false) |
| 72 ..addChartBehavior(new Hovercard()) | 72 ..addChartBehavior(new Hovercard()) |
| 73 ..addChartBehavior(new AxisLabelTooltip()) | 73 ..addChartBehavior(new AxisLabelTooltip()) |
| 74 ..draw(); | 74 ..draw(); |
| 75 } | 75 } |
| 76 } | 76 } |
| OLD | NEW |