OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library chart; | 5 library chart; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'package:js/js.dart'; | 8 import 'package:js/js.dart'; |
9 | 9 |
10 @Js() | 10 @JS() |
11 class Chart { | 11 class Chart { |
12 external Chart(CanvasRenderingContext2D ctx); | 12 external Chart(CanvasRenderingContext2D ctx); |
13 | 13 |
14 external dynamic Line(Data data, Options options); | 14 external dynamic Line(Data data, Options options); |
15 } | 15 } |
16 | 16 |
17 @Js() | 17 @JS() |
18 class Data { | 18 class Data { |
19 external List get labels; | 19 external List get labels; |
20 external List<DataSet> get datasets; | 20 external List<DataSet> get datasets; |
21 | 21 |
22 external factory Data({List<String> labels, List<DataSet> datasets}); | 22 external factory Data({List<String> labels, List<DataSet> datasets}); |
23 } | 23 } |
24 | 24 |
25 /// Minimal implementation of dataset for line chart | 25 /// Minimal implementation of dataset for line chart |
26 /// | 26 /// |
27 /// http://www.chartjs.org/docs/#line-chart-data-structure | 27 /// http://www.chartjs.org/docs/#line-chart-data-structure |
28 @Js() | 28 @JS() |
29 class DataSet { | 29 class DataSet { |
30 external String get label; | 30 external String get label; |
31 external String get fillColor; | 31 external String get fillColor; |
32 external String get strokeColor; | 32 external String get strokeColor; |
33 external String get pointColor; | 33 external String get pointColor; |
34 external String get pointStrokeColor; | 34 external String get pointStrokeColor; |
35 external String get pointHighlightFill; | 35 external String get pointHighlightFill; |
36 external String get pointHighlightStroke; | 36 external String get pointHighlightStroke; |
37 | 37 |
38 external List<num> get data; | 38 external List<num> get data; |
39 | 39 |
40 external factory DataSet( | 40 external factory DataSet( |
41 {String label, | 41 {String label, |
42 String fillColor, | 42 String fillColor, |
43 String strokeColor, | 43 String strokeColor, |
44 String pointColor, | 44 String pointColor, |
45 String pointStrokeColor, | 45 String pointStrokeColor, |
46 String pointHighlightFill, | 46 String pointHighlightFill, |
47 String pointHighlightStroke, | 47 String pointHighlightStroke, |
48 List<num> data}); | 48 List<num> data}); |
49 } | 49 } |
50 | 50 |
51 /// Minimal implementation of options | 51 /// Minimal implementation of options |
52 /// | 52 /// |
53 /// http://www.chartjs.org/docs/#getting-started-global-chart-configuration | 53 /// http://www.chartjs.org/docs/#getting-started-global-chart-configuration |
54 @Js() | 54 @JS() |
55 class Options { | 55 class Options { |
56 external bool get responsive; | 56 external bool get responsive; |
57 | 57 |
58 external factory Options({bool responsive}); | 58 external factory Options({bool responsive}); |
59 } | 59 } |
OLD | NEW |