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 /// Theme used to render the chart area, specifically colors and axes. | |
12 /// | |
13 /// Typical implementations of ChartTheme also implement theme interfaces | |
14 /// used by the renderers, tooltips, legends and any other behaviors. | |
15 abstract class ChartTheme { | |
16 static ChartTheme current = new QuantumChartTheme(); | |
17 | |
18 /// Column/series when it is disabled, possibly because another is active | |
19 static const int STATE_INACTIVE = 0; | |
20 | |
21 /// Column/Series that is normal | |
22 static const int STATE_NORMAL = 1; | |
23 | |
24 /// Column/series that is active, possibly by a click | |
25 static const int STATE_ACTIVE = 2; | |
26 | |
27 /// Color that can be used for key. | |
28 /// For a given input key, the output is always the same. | |
29 String getColorForKey(key, [int state]); | |
30 | |
31 /// Markup for filters that is added to all chart elements. These filters | |
32 /// can be referenced using url() in values returned by [getFilterForState]. | |
33 String filters; | |
34 | |
35 /// Returns any filters that must be applied based on the element's state | |
36 String getFilterForState(int state); | |
37 | |
38 /// Color for overflow and other items. | |
39 /// For example, the collect all bucket used by pie-chart. | |
40 String getOtherColor([int state]); | |
41 | |
42 /// Width of the separator between two chart elements. | |
43 /// Used to separate pies in pie-chart, bars in grouped and stacked charts. | |
44 int get defaultSeparatorWidth => 1; | |
45 | |
46 /// Stroke width used by all shapes. | |
47 int get defaultStrokeWidth => 2; | |
48 | |
49 /// Default font for computation of text metrics | |
50 String get defaultFont; | |
51 | |
52 /// Easing function for the transition | |
53 EasingFunction get transitionEasingType => Transition.defaultEasingType; | |
54 | |
55 /// Easing mode for the transition | |
56 EasingModeFunction get transitionEasingMode => Transition.defaultEasingMode; | |
57 | |
58 /// Total duration of the transition in milli-seconds | |
59 int get transitionDurationMilliseconds => 250; | |
60 | |
61 /// Theme passed to the measure axes - only used by cartesian charts | |
62 ChartAxisTheme getMeasureAxisTheme([Scale scale]) => null; | |
63 | |
64 /// Theme passed to the dimension axes - only used by cartesian charts | |
65 ChartAxisTheme getDimensionAxisTheme([Scale scale]) => null; | |
66 | |
67 /// Padding around the rendered chart. Defaults to 10px in all directions | |
68 AbsoluteRect get padding => const AbsoluteRect(10, 10, 10, 10); | |
69 } | |
70 | |
71 abstract class ChartAxisTheme { | |
72 /// Treshold for tick length. Setting [axisTickSize] <= [FILL_RENDER_AREA] | |
73 /// will make the axis span the entire height/width of the rendering area. | |
74 static const int FILL_RENDER_AREA = SMALL_INT_MIN; | |
75 | |
76 /// Number of ticks displayed on the axis - only used when an axis is | |
77 /// using a quantitative scale. | |
78 int get axisTickCount; | |
79 | |
80 /// Size of ticks on the axis. When [measureTickSize] <= [FILL_RENDER_AREA], | |
81 /// the painted tick will span complete height/width of the rendering area. | |
82 int get axisTickSize; | |
83 | |
84 /// Space between axis and label for dimension axes | |
85 int get axisTickPadding; | |
86 | |
87 /// Space between the first tick and the measure axes. | |
88 /// Only used on charts that don't have renderers that use "bands" of space | |
89 /// on the dimension axes | |
90 /// | |
91 /// Represented as a percentage of space between two consecutive ticks. The | |
92 /// space between two consecutive ticks is also known as the segment size. | |
93 double get axisOuterPadding; | |
94 | |
95 /// Space between the two bands in the chart. | |
96 /// Only used on charts that have renderers that use "bands" of space on the | |
97 /// dimension axes. | |
98 /// | |
99 /// Represented as a percentage of space between two consecutive ticks. The | |
100 /// space between two consecutive ticks is also known as the segment size. | |
101 double get axisBandInnerPadding; | |
102 | |
103 /// Space between the first band and the measure axis. | |
104 /// Only used on charts that have renderers that use "bands" of space on the | |
105 /// dimension axes. | |
106 /// | |
107 /// Represented as a percentage of space between two consecutive ticks. The | |
108 /// space between two consecutive ticks is also known as the segment size. | |
109 double get axisBandOuterPadding; | |
110 | |
111 /// When set to true, the vertical axes resize to fit the labels. | |
112 bool get verticalAxisAutoResize => true; | |
113 | |
114 /// Width of vertical axis when it is not resizing automatically. If | |
115 /// [autoResizeAxis] is set to true, [verticalAxisWidth] will be used as the | |
116 /// maximum width of the vertical axis. | |
117 /// | |
118 /// Height of vertical axis is automatically computed based on height of the | |
119 /// visualization. | |
120 int get verticalAxisWidth => 200; | |
121 | |
122 /// Height of horizontal axis. Width of horizontal axis is automatically | |
123 /// computed based on width of the visualization. | |
124 int get horizontalAxisHeight => 200; | |
125 | |
126 /// Font used by axis ticks. When specified, axis uses efficient off-screen | |
127 /// computation of text metrics. | |
128 /// | |
129 /// Font string must be of the following form: | |
130 /// "bold italic 16px Roboto" | |
131 /// "bold 16px Roboto" | |
132 /// "italic 16px Roboto" | |
133 /// "16px Roboto" | |
134 /// | |
135 /// When not specified, SVGTextElement's metrics API will be used. | |
136 String get ticksFont => null; | |
137 } | |
OLD | NEW |