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

Side by Side Diff: packages/charted/lib/charts/behaviors/chart_tooltip.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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 _tooltipRoot.append('div') 85 _tooltipRoot.append('div')
86 ..classed('tooltip-total') 86 ..classed('tooltip-total')
87 ..text((formatter != null) ? formatter(total) : total.toString()); 87 ..text((formatter != null) ? formatter(total) : total.toString());
88 } 88 }
89 89
90 // Find the currently selectedMeasures and hoveredMeasures and show 90 // Find the currently selectedMeasures and hoveredMeasures and show
91 // tooltip for them, if none is selected/hovered, show all. 91 // tooltip for them, if none is selected/hovered, show all.
92 var activeMeasures = []; 92 var activeMeasures = [];
93 if (showSelectedMeasure) { 93 if (showSelectedMeasure) {
94 if(_state != null) { 94 if (_state != null) {
95 activeMeasures.addAll(_state.selection); 95 activeMeasures.addAll(_state.selection);
96 activeMeasures 96 activeMeasures.add(
97 .add(_state.preview != null 97 _state.preview != null ? _state.preview : _state.hovered.first);
98 ? _state.preview
99 : _state.hovered.first);
100 } else { 98 } else {
101
102 // If state is null, chart tooltip will not capture selection, but only 99 // If state is null, chart tooltip will not capture selection, but only
103 // display for the currently hovered measure column. 100 // display for the currently hovered measure column.
104 activeMeasures.add(e.column); 101 activeMeasures.add(e.column);
105 } 102 }
106 if (activeMeasures.isEmpty) { 103 if (activeMeasures.isEmpty) {
107 for (var series in _area.config.series) { 104 for (var series in _area.config.series) {
108 activeMeasures.addAll(series.measures); 105 activeMeasures.addAll(series.measures);
109 } 106 }
110 } 107 }
111 activeMeasures.sort(); 108 activeMeasures.sort();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 : orientation; 157 : orientation;
161 158
162 if (direction == ORIENTATION_LEFT) { 159 if (direction == ORIENTATION_LEFT) {
163 x = coord.x - rect.width - _TOOLTIP_OFFSET; 160 x = coord.x - rect.width - _TOOLTIP_OFFSET;
164 y = coord.y + _TOOLTIP_OFFSET; 161 y = coord.y + _TOOLTIP_OFFSET;
165 } else { 162 } else {
166 x = coord.x + _TOOLTIP_OFFSET; 163 x = coord.x + _TOOLTIP_OFFSET;
167 y = coord.y + _TOOLTIP_OFFSET; 164 y = coord.y + _TOOLTIP_OFFSET;
168 } 165 }
169 return boundTooltipPosition( 166 return boundTooltipPosition(
170 new math.Rectangle(x, y, rect.width, rect.height)); 167 new math.Rectangle(x as num, y as num, rect.width, rect.height));
171 } 168 }
172 169
173 /// Positions the tooltip to be inside of the chart boundary. 170 /// Positions the tooltip to be inside of the chart boundary.
174 math.Point boundTooltipPosition(math.Rectangle rect) { 171 math.Point boundTooltipPosition(math.Rectangle rect) {
175 var hostRect = _area.host.getBoundingClientRect(); 172 var hostRect = _area.host.getBoundingClientRect();
176 173
177 var top = rect.top; 174 var top = rect.top;
178 var left = rect.left; 175 var left = rect.left;
179 176
180 // Checks top and bottom. 177 // Checks top and bottom.
(...skipping 14 matching lines...) Expand all
195 } 192 }
196 193
197 FormatFunction _getFormatterForColumn(int column) => 194 FormatFunction _getFormatterForColumn(int column) =>
198 _area.data.columns.elementAt(column).formatter; 195 _area.data.columns.elementAt(column).formatter;
199 196
200 hide(ChartEvent e) { 197 hide(ChartEvent e) {
201 if (_tooltipRoot == null) return; 198 if (_tooltipRoot == null) return;
202 _tooltipRoot.style('opacity', '0'); 199 _tooltipRoot.style('opacity', '0');
203 } 200 }
204 } 201 }
OLDNEW
« no previous file with comments | « packages/charted/examples/layout/treemap_demo.dart ('k') | packages/charted/lib/charts/behaviors/hovercard.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698