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

Unified Diff: packages/charted/lib/charts/src/chart_axis_impl.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 side-by-side diff with in-line comments
Download patch
Index: packages/charted/lib/charts/src/chart_axis_impl.dart
diff --git a/packages/charted/lib/charts/src/chart_axis_impl.dart b/packages/charted/lib/charts/src/chart_axis_impl.dart
index 3f5d12d8259d3c6207a1cfe920b4c39bfdb7b682..345d537d28bd8bec46a980ff09b6ae2e147edc75 100644
--- a/packages/charted/lib/charts/src/chart_axis_impl.dart
+++ b/packages/charted/lib/charts/src/chart_axis_impl.dart
@@ -55,16 +55,16 @@ class DefaultChartAxisImpl {
if (scale is OrdinalScale) {
var usingBands = _area.dimensionsUsingBands.contains(_column),
innerPadding = usingBands ? _theme.axisBandInnerPadding : 1.0,
- outerPadding = usingBands ?
- _theme.axisBandOuterPadding : _theme.axisOuterPadding;
+ outerPadding =
+ usingBands ? _theme.axisBandOuterPadding : _theme.axisOuterPadding;
// This is because when left axis is primary the first data row should
// appear on top of the y-axis instead of on bottom.
if (_area.config.isLeftAxisPrimary) {
range = range.toList().reversed;
}
- (scale as OrdinalScale).
- rangeRoundBands(range, innerPadding, outerPadding);
+ (scale as OrdinalScale)
+ .rangeRoundBands(range, innerPadding, outerPadding);
} else {
scale.range = range;
scale.ticksCount = _theme.axisTickCount;
@@ -97,8 +97,9 @@ class DefaultChartAxisImpl {
var width = textMetrics.getLongestTextWidth(formattedTicks).ceil();
if (width > _theme.verticalAxisWidth) {
width = _theme.verticalAxisWidth;
- shortenedTicks = formattedTicks.map(
- (x) => textMetrics.ellipsizeText(x, width)).toList();
+ shortenedTicks = formattedTicks
+ .map((x) => textMetrics.ellipsizeText(x, width))
+ .toList();
}
if (_theme.verticalAxisAutoResize) {
size.width =
@@ -115,7 +116,7 @@ class DefaultChartAxisImpl {
var rect = _area.layout.axes[_orientation],
renderAreaRect = _area.layout.renderArea,
- range = _isVertical ? [rect.height, 0] : [0, rect.width],
+ range = _isVertical ? [rect.height, 0] : [0, rect.width],
innerTickSize = _theme.axisTickSize <= ChartAxisTheme.FILL_RENDER_AREA
? 0 - (_isVertical ? renderAreaRect.width : renderAreaRect.height)
: _theme.axisTickSize,
@@ -126,24 +127,25 @@ class DefaultChartAxisImpl {
element.attributes['transform'] = 'translate(${rect.x}, ${rect.y})';
if (!_isVertical) {
- _axisTicksPlacement =
- new RotateHorizontalAxisTicks(rect,
- _theme.ticksFont, _theme.axisTickSize + _theme.axisTickPadding);
+ _axisTicksPlacement = new RotateHorizontalAxisTicks(
+ rect, _theme.ticksFont, _theme.axisTickSize + _theme.axisTickPadding);
}
initAxisScale(range);
- var axis = new SvgAxis(orientation: _orientation,
- innerTickSize: innerTickSize, outerTickSize: 0,
+ var axis = new SvgAxis(
+ orientation: _orientation,
+ innerTickSize: innerTickSize,
+ outerTickSize: 0,
tickPadding: _theme.axisTickPadding,
- tickFormat: _columnSpec.formatter, tickValues: tickValues,
+ tickFormat: _columnSpec.formatter,
+ tickValues: tickValues,
scale: scale);
axis.create(element, scope,
axisTicksBuilder: _axisTicksPlacement, isRTL: _area.config.isRTL);
}
- void clear() {
- }
+ void clear() {}
// Scale passed through configuration takes precedence
Scale get scale =>
@@ -175,8 +177,7 @@ class RotateHorizontalAxisTicks implements SvgAxisTicks {
RotateHorizontalAxisTicks(this.rect, this.ticksFont, this.tickLineLength);
void init(SvgAxis axis) {
- assert(
- axis.orientation == ORIENTATION_BOTTOM ||
+ assert(axis.orientation == ORIENTATION_BOTTOM ||
axis.orientation == ORIENTATION_TOP);
assert(ticksFont != null);
ticks = axis.tickValues;
@@ -190,16 +191,16 @@ class RotateHorizontalAxisTicks implements SvgAxisTicks {
// Check if we need rotation
if (0.90 * allowedWidth < maxLabelWidth) {
- var rectHeight = tickLineLength > 0
- ? rect.height - tickLineLength
- : rect.height;
+ var rectHeight =
+ tickLineLength > 0 ? rect.height - tickLineLength : rect.height;
rotation = 45;
// Check if we have enough space to render full chart
allowedWidth = (1.4142 * (rectHeight)) - (textMetrics.fontSize / 1.4142);
if (maxLabelWidth > allowedWidth) {
- shortenedTicks = formattedTicks.map(
- (x) => textMetrics.ellipsizeText(x, allowedWidth)).toList();
+ shortenedTicks = formattedTicks
+ .map((x) => textMetrics.ellipsizeText(x, allowedWidth))
+ .toList();
}
}
}
« no previous file with comments | « packages/charted/lib/charts/src/cartesian_area_impl.dart ('k') | packages/charted/lib/charts/src/chart_config_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698