From 5ed7d129272ce0ef50cb63cac71cf84251ba4749 Mon Sep 17 00:00:00 2001 From: Victor Choueiri Date: Sun, 5 Nov 2017 20:28:28 +0200 Subject: [PATCH] Document data entry classes --- lib/src/entry.dart | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/src/entry.dart b/lib/src/entry.dart index 7005a17..04ab966 100644 --- a/lib/src/entry.dart +++ b/lib/src/entry.dart @@ -1,10 +1,28 @@ import 'dart:ui'; +/// Data object defining a segment in a circular chart. +/// +/// In radial charts a [CircularSegmentEntry] corresponds to an arc segment of +/// the current ring, for pie charts it is an individual slice. +/// +/// The portion of the stack this segment will occupy is calculated from the given +/// [value], what proportion of a stack this corresponds to depends on the [percentageValues] +/// property of the chart. class CircularSegmentEntry { const CircularSegmentEntry(this.value, this.color, {this.rankKey}); + /// The value of this data point, defines the sweep angle of the arc + /// that is drawn. If the chart being drawn has [percentageValues] set to false + /// then this segment is drawn in proportion to the total value of all segments + /// in the stack. Otherwise the value is considered the exact percentage of the + /// stack that this segment occupies. final double value; + + /// The color drawn in the stack for this segment. final Color color; + + /// An optional String key, used when animating charts to preserve semantics when + /// transitioning between data points. final String rankKey; String toString() { @@ -12,9 +30,20 @@ class CircularSegmentEntry { } } +/// Data object defining a stack in a circular chart. +/// +/// Each [CircularStackEntry] corresponds to a complete circle in the chart. +/// For radial charts that is one of the rings, for pie charts it is the whole pie. +/// +/// A stack is composed of [entries], a List containing 1 or more [CircularSegmentEntries] +/// and an optional [rankKey] String. class CircularStackEntry { const CircularStackEntry(this.entries, {this.rankKey}); + /// List of [CircularSegmentEntry]s that make up this stack. final List entries; + + /// An optional String key, used when animating charts to preserve semantics when + /// transitioning between data points. final String rankKey; }