1
- /// This library includes a [Chart] Flutter widget for data visualization and classes
2
- /// for it's specification. Besids, it also provides some util classes and functions
1
+ /// Graphic provides a Flutter charting library for data visualization. it has a
2
+ /// chart widget, calsses for specification, and some util classes and funtions
3
3
/// for customization.
4
4
///
5
- /// There are some basic conccepts for this data visualization, most of witch derive
6
- /// from the Grammar of Graphics. they compose the parameters of the [Chart] 's constructor:
7
- ///
8
- /// - **data**, the input data list, can be of any item type.
9
- /// - **variable**, defines the fields of **tuple**, which is the real datum object
10
- /// inside the chart.
11
- /// - **scale**, to scale and normalize the values.
12
- /// - **aesthetic**, to assign values to certain attributes for rendering.
13
- /// - **element**, the graphics visualizing data tuples.
14
- /// - **coordinate**, to locate abstract position values on the canvas.
15
- /// - **shape**, decide how to render the elements.
16
- /// - **signal**, a event that may cause a value changing.
17
- /// - **selection**, the state whether a tuple is selected.
18
- /// - **figure**, which is generated by chart evaluation and carries graphic information
19
- /// for rendering engine to paint.
20
- ///
21
- /// See details and others in the class documents below.
5
+ /// To use this charting library, you only need to do one thing: to create a [Chart]
6
+ /// widget. This widget will evaluate and paint automatically in initial and on
7
+ /// update.
8
+ ///
9
+ /// A start example of bar chart is as below:
10
+ ///
11
+ /// ```dart
12
+ /// Chart(
13
+ /// data: [
14
+ /// { 'genre': 'Sports', 'sold': 275 },
15
+ /// { 'genre': 'Strategy', 'sold': 115 },
16
+ /// { 'genre': 'Action', 'sold': 120 },
17
+ /// { 'genre': 'Shooter', 'sold': 350 },
18
+ /// { 'genre': 'Other', 'sold': 150 },
19
+ /// ],
20
+ /// variables: {
21
+ /// 'genre': Variable(
22
+ /// accessor: (Map map) => map['genre'] as String,
23
+ /// ),
24
+ /// 'sold': Variable(
25
+ /// accessor: (Map map) => map['sold'] as num,
26
+ /// ),
27
+ /// },
28
+ /// elements: [IntervalElement()],
29
+ /// axes: [
30
+ /// Defaults.horizontalAxis,
31
+ /// Defaults.verticalAxis,
32
+ /// ],
33
+ /// )
34
+ /// ```
35
+ ///
36
+ /// All specifications of data visualization are set by parameters of [Chart] 's
37
+ /// constructor as class properties.
38
+ ///
39
+ /// The main processing flow of charting and some important concepts are as below.
40
+ /// Most concepts derive form the Grammar of Graphics. They will help to take full
41
+ /// advantage of this library. These are brif introcuction, and details see into
42
+ /// the Classes and [Chart] properties.
43
+ ///
44
+ /// ```
45
+ /// variable scale aesthetic shape
46
+ /// | | | |
47
+ /// data --> tuples --> scaled tuples --> aesthetic attributes --> figures
48
+ /// ```
49
+ ///
50
+ /// ## Variable
51
+ ///
52
+ /// Variables define the fields of [Tuple] s. The input data of the chart is a [List]
53
+ /// of any generic type. Yet they are not used directly inside the chart, instead,
54
+ /// the data are converted to [Tuple] s.
55
+ ///
56
+ /// They are specified by [Chart.variables] or [Chart.transforms] with [Variable] or
57
+ /// [VariableTransform] .
58
+ ///
59
+ /// ## Algebra
60
+ ///
61
+ /// The graphic algebra determins how variable values are assigned to position dimensions.
62
+ ///
63
+ /// It is specified by [GeomElement.position] with [Varset] . See details of the algebra
64
+ /// rules in [Varset] .
65
+ ///
66
+ /// ## Scale
67
+ ///
68
+ /// Scales convert [Tuple] values to to scaled values, which is easier to prosess
69
+ /// for aesthetic [Attr] s.
70
+ ///
71
+ /// They are specified by [Variable.scale] with [Scale] .
72
+ ///
73
+ /// ## Coordinate
74
+ ///
75
+ /// The coordinate determins how abstract positions are located on the canvas in
76
+ /// painting. The same element may look quite different in [RectCoord] and [PolarCoord] .
77
+ ///
78
+ /// It is specified by [Chart.coord] with [Coord] .
79
+ ///
80
+ /// ## Aesthetic
81
+ ///
82
+ /// Aesthetic means to make [Tuple] s percivable. That is to give them aesthetic attributes
83
+ /// from the scaled values.
84
+ ///
85
+ /// Aesthetic attributes are specified in [GeomElement] with [Attr] . And attributes
86
+ /// values are stored in [Aes] .
87
+ ///
88
+ /// ## Shape
89
+ ///
90
+ /// Shapes render [Tuple] s with [Aes] attributes. Rendering means to get [Figure] s,
91
+ /// which carry the painting information for the rendering engine. Extending a shape
92
+ /// subclass is the way to custom charts.
93
+ ///
94
+ /// Shape is also a aesthetic attribute is self. It is defined with [Shape] , and
95
+ /// generated by [ShapeAttr] wich is defined by [GeomElement.shape] . The [Shape]
96
+ /// type should corresponds to [GeomElement] type.
97
+ ///
98
+ /// ## Interaction
99
+ ///
100
+ /// There are two kinds of interactions: [Signal] and [Selection] . Signal means
101
+ /// a certain specification value changes to [GestureSignal] , [ResizeSignal] , or
102
+ /// [ChangeDataSignal] . Selection means a tuple aesthetic attribute values change
103
+ /// when it is selected or not.
104
+ ///
105
+ /// Signals are used by properties named in "on...Signal" with [SignalUpdate] . Selections
106
+ /// are specified by [Chart.selections] and used by [Attr.onSelection] with [SelectionUpdate] .
107
+ ///
108
+ /// ## Guide
109
+ ///
110
+ /// Guides are various components that helps to read the chart.
111
+ ///
112
+ /// They include [Axis] specified by [Chart.axes] , [Tooltip] specified by [Chart.tooltip] ,
113
+ /// [Crosshair] specified by [Chart.crosshair] , and [Annotation] s specified by [Chart.annotations] ,
22
114
library graphic;
23
115
24
116
export 'src/chart/chart.dart' show Chart;
@@ -27,35 +119,48 @@ export 'src/chart/size.dart' show ResizeSignal;
27
119
export 'src/data/data_set.dart' show ChangeDataSignal;
28
120
29
121
export 'src/variable/variable.dart' show Variable;
122
+ export 'src/variable/transform/transform.dart' show VariableTransform;
30
123
export 'src/variable/transform/filter.dart' show Filter;
31
124
export 'src/variable/transform/map.dart' show MapTrans;
32
125
export 'src/variable/transform/proportion.dart' show Proportion;
33
126
export 'src/variable/transform/sort.dart' show Sort;
34
127
128
+ export 'src/scale/scale.dart' show Scale;
129
+ export 'src/scale/discrete.dart' show DiscreteScale;
130
+ export 'src/scale/continuous.dart' show ContinuousScale;
35
131
export 'src/scale/linear.dart' show LinearScale;
36
132
export 'src/scale/ordinal.dart' show OrdinalScale;
37
133
export 'src/scale/time.dart' show TimeScale;
38
134
135
+ export 'src/geom/element.dart' show GeomElement;
136
+ export 'src/geom/function.dart' show FunctionElement;
137
+ export 'src/geom/partition.dart' show PartitionElement;
39
138
export 'src/geom/area.dart' show AreaElement;
40
139
export 'src/geom/custom.dart' show CustomElement;
41
140
export 'src/geom/interval.dart' show IntervalElement;
42
141
export 'src/geom/line.dart' show LineElement;
43
142
export 'src/geom/point.dart' show PointElement;
44
143
export 'src/geom/polygon.dart' show PolygonElement;
144
+ export 'src/geom/modifier/modifier.dart' show Modifier;
45
145
export 'src/geom/modifier/dodge.dart' show DodgeModifier;
46
146
export 'src/geom/modifier/stack.dart' show StackModifier;
47
147
export 'src/geom/modifier/jitter.dart' show JitterModifier;
48
148
export 'src/geom/modifier/symmetric.dart' show SymmetricModifier;
49
149
150
+ export 'src/aes/aes.dart' show Attr;
151
+ export 'src/aes/channel.dart' show ChannelAttr;
50
152
export 'src/aes/color.dart' show ColorAttr;
51
153
export 'src/aes/elevation.dart' show ElevationAttr;
52
154
export 'src/aes/gradient.dart' show GradientAttr;
53
155
export 'src/aes/label.dart' show LabelAttr;
54
156
export 'src/aes/shape.dart' show ShapeAttr;
55
157
export 'src/aes/size.dart' show SizeAttr;
56
158
57
- export 'src/algebra/varset.dart' show Varset;
159
+ export 'src/algebra/varset.dart' show Varset, AlgForm, AlgTerm ;
58
160
161
+ export 'src/shape/shape.dart' show Shape;
162
+ export 'src/shape/function.dart' show FunctionShape;
163
+ export 'src/shape/partition.dart' show PartitionShape;
59
164
export 'src/shape/area.dart' show AreaShape, BasicAreaShape;
60
165
export 'src/shape/custom.dart' show CustomShape, CandlestickShape;
61
166
export 'src/shape/interval.dart' show IntervalShape, RectShape, FunnelShape;
@@ -67,14 +172,16 @@ export 'src/shape/util/render_basic_item.dart' show renderBasicItem;
67
172
export 'src/graffiti/figure.dart'
68
173
show Figure, PathFigure, ShadowFigure, TextFigure, RotatedTextFigure;
69
174
70
- export 'src/coord/coord.dart' show CoordConv;
175
+ export 'src/coord/coord.dart' show Coord, CoordConv;
71
176
export 'src/coord/polar.dart' show PolarCoord, PolarCoordConv;
72
177
export 'src/coord/rect.dart' show RectCoord, RectCoordConv;
73
178
74
179
export 'src/guide/axis/axis.dart'
75
180
show TickLine, TickLineMapper, LabelMapper, GridMapper, AxisGuide;
76
181
export 'src/guide/interaction/tooltip.dart' show TooltipGuide, RenderTooltip;
77
182
export 'src/guide/interaction/crosshair.dart' show CrosshairGuide;
183
+ export 'src/guide/annotation/annotation.dart' show Annotation;
184
+ export 'src/guide/annotation/figure.dart' show FigureAnnotation;
78
185
export 'src/guide/annotation/line.dart' show LineAnnotation;
79
186
export 'src/guide/annotation/region.dart' show RegionAnnotation;
80
187
export 'src/guide/annotation/mark.dart' show MarkAnnotation;
@@ -83,7 +190,7 @@ export 'src/guide/annotation/custom.dart' show CustomAnnotation;
83
190
84
191
export 'src/interaction/signal.dart' show Signal, SignalType, SignalUpdate;
85
192
export 'src/interaction/gesture.dart' show GestureType, Gesture, GestureSignal;
86
- export 'src/interaction/selection/selection.dart' show SelectionUpdate;
193
+ export 'src/interaction/selection/selection.dart' show Selection, SelectionUpdate;
87
194
export 'src/interaction/selection/interval.dart' show IntervalSelection;
88
195
export 'src/interaction/selection/point.dart' show PointSelection;
89
196
0 commit comments