| OLD | NEW |
| (Empty) |
| 1 // | |
| 2 // Copyright 2014 Google Inc. All rights reserved. | |
| 3 // | |
| 4 // Use of this source code is governed by a BSD-style | |
| 5 // license that can be found in the LICENSE file or at | |
| 6 // https://developers.google.com/open-source/licenses/bsd | |
| 7 // | |
| 8 | |
| 9 part of charted.charts; | |
| 10 | |
| 11 /// | |
| 12 /// A [ChartSeries] represents one or more columns in ChartData that are | |
| 13 /// rendered together. | |
| 14 /// | |
| 15 /// Examples: | |
| 16 /// 1. For bar-chart or line-chart, a series consists of one column | |
| 17 /// 2. For stacked chart or grouped bar chart, a series has more than columns | |
| 18 /// | |
| 19 class ChartSeries { | |
| 20 /// Name of the series | |
| 21 final String name; | |
| 22 | |
| 23 /// Optional Ids of measure axes. | |
| 24 /// | |
| 25 /// When specified renderers scale the column values against the ranges | |
| 26 /// of the given axes. If an axis with a matching Id does not exist in | |
| 27 /// [ChartArea] a new axis is created. | |
| 28 /// | |
| 29 /// When not specified, renderers may use [ChartArea.defaultMeasureAxis] | |
| 30 /// where ever necessary. Refer to the implementation of [CartesianRenderer]
for | |
| 31 /// more information on defaults and how the measure axes are used. | |
| 32 /// | |
| 33 /// If the implementation is [Observable] and [measureAxisIds] is set to an | |
| 34 /// [ObservableList], changes to the list must be broadcasted. | |
| 35 Iterable<String> measureAxisIds; | |
| 36 | |
| 37 /// List of columns in ChartData that are measures of this series. | |
| 38 /// | |
| 39 /// A series may include more than one measure if the renderer supports it. | |
| 40 /// When there are more measures than what the renderer can handle, a renderer | |
| 41 /// only renders the first "supported number" of columns. If the number of | |
| 42 /// columns is less than the minimum that the renderer supports, the remaining | |
| 43 /// measures are assumed to have zeros. | |
| 44 /// | |
| 45 /// If the implementation is [Observable] and [measures] is set to an | |
| 46 /// [ObservableList], changes to the list must be broadcasted. | |
| 47 Iterable<int> measures; | |
| 48 | |
| 49 /// Instance of the renderer used to render the series. | |
| 50 /// | |
| 51 /// [ChartArea] creates a renderer using [ChartRender.create] and uses it | |
| 52 /// to compute range of the measure axis and to render the chart. | |
| 53 ChartRenderer renderer; | |
| 54 | |
| 55 /// Factory function to create an instance of internal implementation of | |
| 56 /// [ChartSeries]. | |
| 57 factory ChartSeries(String name, Iterable<int> measures, | |
| 58 ChartRenderer renderer, { Iterable<String> measureAxisIds : null }) => | |
| 59 new DefaultChartSeriesImpl(name, measures, renderer, measureAxisIds); | |
| 60 } | |
| 61 | |
| 62 | |
| 63 /// | |
| 64 /// Implementation of [ChangeRecord] that is used to notify changes to | |
| 65 /// [ChartSeries]. Currently, only changes to measures and measureAxisIds | |
| 66 /// are supported. | |
| 67 /// | |
| 68 class ChartSeriesChangeRecord implements ChangeRecord { | |
| 69 /// Reference to series that changed | |
| 70 final ChartSeries series; | |
| 71 | |
| 72 const ChartSeriesChangeRecord(this.series); | |
| 73 } | |
| OLD | NEW |