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

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

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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
11 class QuantumChartTheme extends ChartTheme { 11 class QuantumChartTheme extends ChartTheme {
12 static const List OTHER_COLORS = 12 static const List OTHER_COLORS = const ['#EEEEEE', '#BDBDBD', '#9E9E9E'];
13 const['#EEEEEE', '#BDBDBD', '#9E9E9E'];
14 13
15 static const List<List<String>> COLORS = const[ 14 static const List<List<String>> COLORS = const [
16 const [ '#C5D9FB', '#4184F3', '#2955C5' ], 15 const ['#C5D9FB', '#4184F3', '#2955C5'],
17 const [ '#F3C6C2', '#DB4437', '#A52714' ], 16 const ['#F3C6C2', '#DB4437', '#A52714'],
18 const [ '#FBE7B1', '#F4B400', '#EF9200' ], 17 const ['#FBE7B1', '#F4B400', '#EF9200'],
19 const [ '#B6E0CC', '#0F9D58', '#0A7F42' ], 18 const ['#B6E0CC', '#0F9D58', '#0A7F42'],
20 const [ '#E0BDE6', '#AA46BB', '#691A99' ], 19 const ['#E0BDE6', '#AA46BB', '#691A99'],
21 const [ '#B1EAF1', '#00ABC0', '#00828E' ], 20 const ['#B1EAF1', '#00ABC0', '#00828E'],
22 const [ '#FFCBBB', '#FF6F42', '#E54918' ], 21 const ['#FFCBBB', '#FF6F42', '#E54918'],
23 const [ '#EFF3C2', '#9D9C23', '#817616' ], 22 const ['#EFF3C2', '#9D9C23', '#817616'],
24 const [ '#C4C9E8', '#5B6ABF', '#3848AA' ], 23 const ['#C4C9E8', '#5B6ABF', '#3848AA'],
25 const [ '#F7BACF', '#EF6191', '#E81D62' ], 24 const ['#F7BACF', '#EF6191', '#E81D62'],
26 const [ '#B1DEDA', '#00786A', '#004C3F' ], 25 const ['#B1DEDA', '#00786A', '#004C3F'],
27 const [ '#F38EB0', '#C1175A', '#870D4E' ], 26 const ['#F38EB0', '#C1175A', '#870D4E'],
28 ]; 27 ];
29 28
30 static const List<List<String>> COLORS_ASSIST = const[ 29 static const List<List<String>> COLORS_ASSIST = const [
31 const [ '#C5D9FB', '#4184F3', '#2955C5' ], 30 const ['#C5D9FB', '#4184F3', '#2955C5'],
32 const [ '#F3C6C2', '#DB4437', '#A52714' ], 31 const ['#F3C6C2', '#DB4437', '#A52714'],
33 const [ '#FBE7B1', '#F4B400', '#EF9200' ], 32 const ['#FBE7B1', '#F4B400', '#EF9200'],
34 const [ '#B6E0CC', '#0F9D58', '#0A7F42' ], 33 const ['#B6E0CC', '#0F9D58', '#0A7F42'],
35 const [ '#E0BDE6', '#AA46BB', '#691A99' ], 34 const ['#E0BDE6', '#AA46BB', '#691A99'],
36 const [ '#B1EAF1', '#00ABC0', '#00828E' ], 35 const ['#B1EAF1', '#00ABC0', '#00828E'],
37 const [ '#FFCBBB', '#FF6F42', '#E54918' ], 36 const ['#FFCBBB', '#FF6F42', '#E54918'],
38 const [ '#EFF3C2', '#9D9C23', '#817616' ] 37 const ['#EFF3C2', '#9D9C23', '#817616']
39 ]; 38 ];
40 39
41 final OrdinalScale _scale = new OrdinalScale()..range = COLORS; 40 final OrdinalScale _scale = new OrdinalScale()..range = COLORS;
42 41
43 @override 42 @override
44 String getColorForKey(key, [int state = 0]) { 43 String getColorForKey(key, [int state = 0]) {
45 var result = _scale.scale(key); 44 var result = _scale.scale(key);
46 return result is Iterable ? colorForState(result, state) : result; 45 return result is Iterable ? colorForState(result, state) : result;
47 } 46 }
48 47
49 colorForState(Iterable colors, int state) { 48 colorForState(Iterable colors, int state) {
50 // Inactive color when another key is active or selected. 49 // Inactive color when another key is active or selected.
51 if (state & ChartState.COL_UNSELECTED != 0 || 50 if (state & ChartState.COL_UNSELECTED != 0 ||
52 state & ChartState.VAL_UNHIGHLIGHTED != 0) { 51 state & ChartState.VAL_UNHIGHLIGHTED != 0) {
53 return colors.elementAt(0); 52 return colors.elementAt(0);
54 } 53 }
55 54
56 // Active color when this key is being hovered upon 55 // Active color when this key is being hovered upon
57 if (state & ChartState.COL_PREVIEW != 0 || 56 if (state & ChartState.COL_PREVIEW != 0 ||
58 state & ChartState.VAL_HOVERED != 0) { 57 state & ChartState.VAL_HOVERED != 0) {
59 return colors.elementAt(2); 58 return colors.elementAt(2);
60 } 59 }
61 60
62 // All others are normal. 61 // All others are normal.
63 return colors.elementAt(1); 62 return colors.elementAt(1);
64 } 63 }
65 64
66 @override 65 @override
67 String getFilterForState(int state) => 66 String getFilterForState(int state) => state & ChartState.COL_PREVIEW != 0 ||
68 state & ChartState.COL_PREVIEW != 0 ||
69 state & ChartState.VAL_HOVERED != 0 || 67 state & ChartState.VAL_HOVERED != 0 ||
70 state & ChartState.COL_SELECTED != 0 || 68 state & ChartState.COL_SELECTED != 0 ||
71 state & ChartState.VAL_HIGHLIGHTED != 0 69 state & ChartState.VAL_HIGHLIGHTED != 0 ? 'url(#drop-shadow)' : '';
72 ? 'url(#drop-shadow)'
73 : '';
74 70
75 @override 71 @override
76 String getOtherColor([int state = 0]) => 72 String getOtherColor([int state = 0]) => OTHER_COLORS is Iterable
77 OTHER_COLORS is Iterable 73 ? colorForState(OTHER_COLORS, state)
78 ? colorForState(OTHER_COLORS, state) 74 : OTHER_COLORS;
79 : OTHER_COLORS;
80 75
81 @override 76 @override
82 ChartAxisTheme getMeasureAxisTheme([Scale _]) => 77 ChartAxisTheme getMeasureAxisTheme([Scale _]) =>
83 const QuantumChartAxisTheme(ChartAxisTheme.FILL_RENDER_AREA, 5); 78 const QuantumChartAxisTheme(ChartAxisTheme.FILL_RENDER_AREA, 5);
84 79
85 @override 80 @override
86 ChartAxisTheme getDimensionAxisTheme([Scale scale]) => 81 ChartAxisTheme getDimensionAxisTheme([Scale scale]) =>
87 scale == null || scale is OrdinalScale 82 scale == null || scale is OrdinalScale
88 ? const QuantumChartAxisTheme(0, 10) 83 ? const QuantumChartAxisTheme(0, 10)
89 : const QuantumChartAxisTheme(4, 10); 84 : const QuantumChartAxisTheme(4, 10);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 final horizontalAxisAutoResize = false; 134 final horizontalAxisAutoResize = false;
140 135
141 @override 136 @override
142 final horizontalAxisHeight = 50; 137 final horizontalAxisHeight = 50;
143 138
144 @override 139 @override
145 final ticksFont = '12px Roboto'; 140 final ticksFont = '12px Roboto';
146 141
147 const QuantumChartAxisTheme(this.axisTickSize, this.axisTickCount); 142 const QuantumChartAxisTheme(this.axisTickSize, this.axisTickCount);
148 } 143 }
OLDNEW
« no previous file with comments | « packages/charted/lib/charts/src/layout_area_impl.dart ('k') | packages/charted/lib/core/interpolators.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698