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

Side by Side Diff: packages/charted/lib/charts/themes/quantum_theme.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 /* 1 /*
2 * Copyright 2014 Google Inc. All rights reserved. 2 * Copyright 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style 4 * Use of this source code is governed by a BSD-style
5 * license that can be found in the LICENSE file or at 5 * license that can be found in the LICENSE file or at
6 * https://developers.google.com/open-source/licenses/bsd 6 * https://developers.google.com/open-source/licenses/bsd
7 */ 7 */
8 8
9 part of charted.charts; 9 part of charted.charts;
10 10
(...skipping 19 matching lines...) Expand all
30 const ['#C5D9FB', '#4184F3', '#2955C5'], 30 const ['#C5D9FB', '#4184F3', '#2955C5'],
31 const ['#F3C6C2', '#DB4437', '#A52714'], 31 const ['#F3C6C2', '#DB4437', '#A52714'],
32 const ['#FBE7B1', '#F4B400', '#EF9200'], 32 const ['#FBE7B1', '#F4B400', '#EF9200'],
33 const ['#B6E0CC', '#0F9D58', '#0A7F42'], 33 const ['#B6E0CC', '#0F9D58', '#0A7F42'],
34 const ['#E0BDE6', '#AA46BB', '#691A99'], 34 const ['#E0BDE6', '#AA46BB', '#691A99'],
35 const ['#B1EAF1', '#00ABC0', '#00828E'], 35 const ['#B1EAF1', '#00ABC0', '#00828E'],
36 const ['#FFCBBB', '#FF6F42', '#E54918'], 36 const ['#FFCBBB', '#FF6F42', '#E54918'],
37 const ['#EFF3C2', '#9D9C23', '#817616'] 37 const ['#EFF3C2', '#9D9C23', '#817616']
38 ]; 38 ];
39 39
40 static final _MEASURE_AXIS_THEME =
41 new QuantumChartAxisTheme(ChartAxisTheme.FILL_RENDER_AREA, 5);
42 static final _ORDINAL_DIMENSION_AXIS_THEME =
43 new QuantumChartAxisTheme(0, 10);
44 static final _DEFAULT_DIMENSION_AXIS_THEME =
45 new QuantumChartAxisTheme(4, 10);
46
40 final OrdinalScale _scale = new OrdinalScale()..range = COLORS; 47 final OrdinalScale _scale = new OrdinalScale()..range = COLORS;
41 48
42 @override 49 @override
43 String getColorForKey(key, [int state = 0]) { 50 String getColorForKey(key, [int state = 0]) {
44 var result = _scale.scale(key); 51 var result = _scale.scale(key);
45 return result is Iterable ? colorForState(result, state) : result; 52 return result is Iterable ? colorForState(result, state) : result;
46 } 53 }
47 54
48 colorForState(Iterable colors, int state) { 55 colorForState(Iterable colors, int state) {
49 // Inactive color when another key is active or selected. 56 // Inactive color when another key is active or selected.
(...skipping 17 matching lines...) Expand all
67 state & ChartState.VAL_HOVERED != 0 || 74 state & ChartState.VAL_HOVERED != 0 ||
68 state & ChartState.COL_SELECTED != 0 || 75 state & ChartState.COL_SELECTED != 0 ||
69 state & ChartState.VAL_HIGHLIGHTED != 0 ? 'url(#drop-shadow)' : ''; 76 state & ChartState.VAL_HIGHLIGHTED != 0 ? 'url(#drop-shadow)' : '';
70 77
71 @override 78 @override
72 String getOtherColor([int state = 0]) => OTHER_COLORS is Iterable 79 String getOtherColor([int state = 0]) => OTHER_COLORS is Iterable
73 ? colorForState(OTHER_COLORS, state) 80 ? colorForState(OTHER_COLORS, state)
74 : OTHER_COLORS; 81 : OTHER_COLORS;
75 82
76 @override 83 @override
77 ChartAxisTheme getMeasureAxisTheme([Scale _]) => 84 ChartAxisTheme getMeasureAxisTheme([Scale _]) => _MEASURE_AXIS_THEME;
78 const QuantumChartAxisTheme(ChartAxisTheme.FILL_RENDER_AREA, 5);
79 85
80 @override 86 @override
81 ChartAxisTheme getDimensionAxisTheme([Scale scale]) => 87 ChartAxisTheme getDimensionAxisTheme([Scale scale]) =>
82 scale == null || scale is OrdinalScale 88 scale == null || scale is OrdinalScale
83 ? const QuantumChartAxisTheme(0, 10) 89 ? _ORDINAL_DIMENSION_AXIS_THEME
84 : const QuantumChartAxisTheme(4, 10); 90 : _DEFAULT_DIMENSION_AXIS_THEME;
85 91
86 @override 92 @override
87 AbsoluteRect get padding => const AbsoluteRect(10, 40, 0, 0); 93 AbsoluteRect get padding => const AbsoluteRect(10, 40, 0, 0);
88 94
89 @override 95 @override
90 String get filters => ''' 96 String get filters => '''
91 <filter id="drop-shadow" height="300%" width="300%" y="-100%" x="-100%"> 97 <filter id="drop-shadow" height="300%" width="300%" y="-100%" x="-100%">
92 <feGaussianBlur stdDeviation="2" in="SourceAlpha"></feGaussianBlur> 98 <feGaussianBlur stdDeviation="2" in="SourceAlpha"></feGaussianBlur>
93 <feOffset dy="1" dx="0"></feOffset> 99 <feOffset dy="1" dx="0"></feOffset>
94 <feComponentTransfer> 100 <feComponentTransfer>
95 <feFuncA slope="0.4" type="linear"></feFuncA> 101 <feFuncA slope="0.4" type="linear"></feFuncA>
96 </feComponentTransfer> 102 </feComponentTransfer>
97 <feMerge> 103 <feMerge>
98 <feMergeNode></feMergeNode> 104 <feMergeNode></feMergeNode>
99 <feMergeNode in="SourceGraphic"></feMergeNode> 105 <feMergeNode in="SourceGraphic"></feMergeNode>
100 </feMerge> 106 </feMerge>
101 </filter> 107 </filter>
102 '''; 108 ''';
103 109
104 @override 110 @override
105 String get defaultFont => '14px Roboto'; 111 String get defaultFont => '14px Roboto';
106 } 112 }
107 113
108 class QuantumChartAxisTheme implements ChartAxisTheme { 114 class QuantumChartAxisTheme implements ChartAxisTheme {
109 @override 115 @override
110 final axisOuterPadding = 0.1; 116 final double axisOuterPadding;
111 117
112 @override 118 @override
113 final axisBandInnerPadding = 0.35; 119 final double axisBandInnerPadding;
114 120
115 @override 121 @override
116 final axisBandOuterPadding = 0.175; 122 final double axisBandOuterPadding;
117 123
118 @override 124 @override
119 final axisTickPadding = 6; 125 final int axisTickPadding;
120 126
121 @override 127 @override
122 final axisTickSize; 128 final int axisTickSize;
123 129
124 @override 130 @override
125 final axisTickCount; 131 final int axisTickCount;
126 132
127 @override 133 @override
128 final verticalAxisAutoResize = true; 134 final bool verticalAxisAutoResize;
129 135
130 @override 136 @override
131 final verticalAxisWidth = 75; 137 final int verticalAxisWidth;
132 138
133 @override 139 @override
134 final horizontalAxisAutoResize = false; 140 final bool horizontalAxisAutoResize;
135 141
136 @override 142 @override
137 final horizontalAxisHeight = 50; 143 final int horizontalAxisHeight;
138 144
139 @override 145 @override
140 final ticksFont = '12px Roboto'; 146 final String ticksFont;
141 147
142 const QuantumChartAxisTheme(this.axisTickSize, this.axisTickCount); 148 QuantumChartAxisTheme(this.axisTickSize, this.axisTickCount,
149 {this.axisOuterPadding: 12.0,
150 this.axisBandInnerPadding: 0.35,
151 this.axisBandOuterPadding: 12.0,
152 this.axisTickPadding: 6,
153 this.verticalAxisAutoResize: true,
154 this.verticalAxisWidth: 75,
155 this.horizontalAxisAutoResize: false,
156 this.horizontalAxisHeight: 50,
157 this.ticksFont: '12px Roboto'});
143 } 158 }
OLDNEW
« no previous file with comments | « packages/charted/lib/charts/src/chart_state_impl.dart ('k') | packages/charted/lib/core/scales.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698