OLD | NEW |
| (Empty) |
1 // | |
2 // Copyright 2014 Google Inc. All rights reserved. | |
3 // | |
4 // Use of this source code is governed by a BSD-style | |
5 // license that can be found in the LICENSE file or at | |
6 // https://developers.google.com/open-source/licenses/bsd | |
7 // | |
8 | |
9 part of charted.charts; | |
10 | |
11 /// | |
12 /// Configuration of the chart. | |
13 /// | |
14 abstract class ChartConfig { | |
15 /// List of series rendered on this chart. | |
16 /// | |
17 /// If the implementation is observable, setting a new list must broadcast | |
18 /// a change. Additionally, if [series] is set to an [ObservableList], | |
19 /// changes to the list are broadcast too. | |
20 Iterable<ChartSeries> series; | |
21 | |
22 /// List of columns that form the dimensions on the chart. | |
23 /// | |
24 /// If the implementation is observable, setting a new list must broadcast | |
25 /// a change. Additionally, if [dimensions] is set to an [ObservableList], | |
26 /// changes to the list are broadcast too. | |
27 Iterable<int> dimensions; | |
28 | |
29 /// Instance of [ChartLegend] that is used to render legend. | |
30 ChartLegend legend; | |
31 | |
32 /// Recommended minimum size for the chart | |
33 Rect minimumSize; | |
34 | |
35 /// Indicates if the chart has primary dimension on the left axis | |
36 bool isLeftAxisPrimary = false; | |
37 | |
38 /// Registers axis configuration for the axis represented by [id]. | |
39 void registerMeasureAxis(String id, ChartAxisConfig axis); | |
40 | |
41 /// User-set axis configuration for [id], null if not set. | |
42 ChartAxisConfig getMeasureAxis(String id); | |
43 | |
44 /// Register axis configuration of the axis used for dimension [column]. | |
45 void registerDimensionAxis(int column, ChartAxisConfig axis); | |
46 | |
47 /// User set axis configuration for [column], null if not set. | |
48 ChartAxisConfig getDimensionAxis(int column); | |
49 | |
50 /// Measure axes ids that are displayed. If not specified, the first two | |
51 /// measure axes are displayed. If the list is empty, none of the measure | |
52 /// axes are displayed. | |
53 Iterable<String> displayedMeasureAxes; | |
54 | |
55 /// Indicates if the dimension axes should be drawn on this chart. Unless set | |
56 /// to "false", the axes are rendered. | |
57 bool renderDimensionAxes; | |
58 | |
59 /// When set to true, the chart rendering changes to be more suitable for | |
60 /// scripts that are written from right-to-left. | |
61 bool isRTL; | |
62 | |
63 /// Indicate if the horizontal axes and the corresponding scales should | |
64 /// switch direction too. | |
65 /// Example: Time scale on the X axis would progress from right to left. | |
66 bool switchAxesForRTL; | |
67 | |
68 /// Factory method to create an instance of the default implementation | |
69 factory ChartConfig( | |
70 Iterable<ChartSeries> series, Iterable<int> dimensions) = DefaultChartConf
igImpl; | |
71 } | |
72 | |
73 /// | |
74 /// [ChangeRecord] that is used to notify changes to [ChartConfig]. | |
75 /// Currently, changes to list of dimensions and list of series are monitored. | |
76 /// | |
77 class ChartConfigChangeRecord implements ChangeRecord { | |
78 const ChartConfigChangeRecord(); | |
79 } | |
80 | |
81 /// | |
82 /// Configuration for an axis | |
83 /// | |
84 class ChartAxisConfig { | |
85 /// Title for the axis | |
86 String title; | |
87 | |
88 /// Scale to be used with the axis | |
89 Scale scale; | |
90 | |
91 /// For a quantitative scale, values at which ticks should be displayed. | |
92 /// When not specified, the ticks are based on the type of [scale] used. | |
93 Iterable tickValues; | |
94 } | |
OLD | NEW |