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

Unified Diff: charted/lib/layout/src/pie_layout.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « charted/lib/layout/src/hierarchy_layout.dart ('k') | charted/lib/layout/src/treemap_layout.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: charted/lib/layout/src/pie_layout.dart
diff --git a/charted/lib/layout/src/pie_layout.dart b/charted/lib/layout/src/pie_layout.dart
deleted file mode 100644
index 6d3382afd7ab94d172af97f9c0192220fd4bb3c9..0000000000000000000000000000000000000000
--- a/charted/lib/layout/src/pie_layout.dart
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file or at
- * https://developers.google.com/open-source/licenses/bsd
- */
-part of charted.layout;
-
-/**
- * Utility class to create arc definitions that can be used by the SvgArc
- * to generate arcs for pie and donut charts
- */
-class PieLayout {
- /**
- * Callback to convert datum to values used for layout
- * Defaults to [defaultValueAccessor]
- */
- SelectionValueAccessor<num> accessor = defaultValueAccessor;
-
- /**
- * Callback to get the start angle for the pie. This callback is
- * called once per list of value (i.e once per call to [layout])
- * Defaults to [defaultStartAngleCallback]
- */
- SelectionCallback<num> startAngleCallback = defaultStartAngleCallback;
-
- /**
- * Callback to get the start angle for the pie. This callback is
- * called once per list of value (i.e once per call to [layout])
- * Defaults to [defaultEndAngleCallback]
- */
- SelectionCallback<num> endAngleCallback = defaultEndAngleCallback;
-
- /**
- * Comparator that is used to set the sort order of values. If not
- * specified, the input order is used.
- */
- Comparator<num> compare = null;
-
- /**
- * Return a list of SvgArcData objects that could be used to create
- * arcs in a pie-chart or donut-chart.
- */
- List layout(List data, [int ei, Element e]) {
- var values = new List.generate(data.length,
- (int i) => accessor(data[i], i)),
- startAngle = startAngleCallback(data, ei, e),
- endAngle = endAngleCallback(data, ei, e),
- total = sum(values),
- scaleFactor = (endAngle - startAngle) / (total > 0 ? total : 1),
- index = new Range.integers(values.length).toList(),
- arcs = new List(data.length);
-
- if (compare != null) {
- index.sort((left, right) => compare(data[left], data[right]));
- }
-
- int count = 0;
- index.forEach((i) {
- endAngle = startAngle + values[i] * scaleFactor;
- arcs[count++] = new SvgArcData(data[i], values[i], startAngle, endAngle);
- startAngle = endAngle;
- });
-
- return arcs;
- }
-
- /** Sets a constant value to start angle of the layout */
- set startAngle(num value) =>
- startAngleCallback = toCallback(value);
-
- /** Sets a constant value to end angle of the layout */
- set endAngle(num value) =>
- endAngleCallback = toCallback(value);
-
- /** Default value accessor */
- static num defaultValueAccessor(num d, i) => d;
-
- /** Default start angle callback - returns 0 */
- static num defaultStartAngleCallback(d, i, _) => 0;
-
- /** Default end angle callback - returns 2 * PI */
- static num defaultEndAngleCallback(d, i, _) => 2 * PI;
-}
« no previous file with comments | « charted/lib/layout/src/hierarchy_layout.dart ('k') | charted/lib/layout/src/treemap_layout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698