| 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 /// Interface that is implemented by classes that support | |
| 13 /// displaying legend. | |
| 14 /// | |
| 15 abstract class ChartLegend { | |
| 16 /// Title of the legend, dynamically updates the legend title when set. | |
| 17 String title; | |
| 18 | |
| 19 /// Called by [ChartArea] to notify changes to legend. | |
| 20 update(Iterable<ChartLegendItem> legend, ChartArea chart); | |
| 21 | |
| 22 /// Called by [ChartArea] to dispose selection listeners. | |
| 23 dispose(); | |
| 24 | |
| 25 /// Factory to create an instance of the default implementation. | |
| 26 factory ChartLegend(Element host, | |
| 27 {maxItems: 0, title: '', showValues: false}) => | |
| 28 new DefaultChartLegendImpl(host, maxItems, showValues, title); | |
| 29 } | |
| 30 | |
| 31 /// | |
| 32 /// Class representing an item in the legend. | |
| 33 /// | |
| 34 class ChartLegendItem { | |
| 35 /// Index of the row/column in [ChartData]. Legend uses column based coloring | |
| 36 /// in [CartesianArea] that has useRowColoring set to false and row based | |
| 37 /// coloring in all other cases. | |
| 38 int index; | |
| 39 | |
| 40 /// HTML color used for the row/column in chart | |
| 41 String color; | |
| 42 | |
| 43 /// The label of the item. | |
| 44 String label; | |
| 45 | |
| 46 /// Description of the item. | |
| 47 String description; | |
| 48 | |
| 49 /// Pre-formatted value to use as value. | |
| 50 String value; | |
| 51 | |
| 52 /// List of series that this column is part of | |
| 53 Iterable<ChartSeries> series; | |
| 54 | |
| 55 ChartLegendItem({this.index, this.color, | |
| 56 this.label, this.description, this.series, this.value}); | |
| 57 } | |
| OLD | NEW |