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 /// Renders the chart on a CartesianArea. | |
13 /// | |
14 abstract class CartesianRenderer extends ChartRenderer { | |
15 /// Returns extent of the series. This extent is used by [ChartArea] to | |
16 /// set the output range of the corresponding scale/axis of the series. | |
17 /// | |
18 /// Extent has valid values only if [prepare] was already called. | |
19 Extent get extent; | |
20 | |
21 /// Returns extent of a given row. | |
22 Extent extentForRow(Iterable row); | |
23 | |
24 /// Indicates if this renderer uses range "band" on any of the dimension | |
25 /// axis. Band is space taken on the dimension axis (if more than a point). | |
26 /// | |
27 /// Examples: | |
28 /// A bar chart takes up space (width of the bar) on the dimension axis. | |
29 /// A line chart does not take any space | |
30 Iterable<int> get dimensionsUsingBand; | |
31 | |
32 /// Hint for padding between two bands that [ChartArea] will use for layout. | |
33 /// This getter is called only for renderers that have [dimensionsUsingBand] | |
34 /// set to non-empty list. | |
35 double get bandInnerPadding; | |
36 | |
37 /// Hint for padding before first and after the last bands | |
38 /// This getter is called only for renderers that have [dimensionsUsingBand] | |
39 /// set to non-empty list. | |
40 double get bandOuterPadding; | |
41 | |
42 /// Render series data on the passed [host]. | |
43 /// Draw will not be successful if [prepare] was not already called. | |
44 void draw(Element host, {Future schedulePostRender}); | |
45 } | |
46 | |
47 /// | |
48 /// Renders layout visualization on a LayoutArea | |
49 /// | |
50 abstract class LayoutRenderer extends ChartRenderer { | |
51 /// Create a layout/visualization from the data. Layout will not be successful | |
52 /// if [prepare] was not already called. | |
53 Iterable<ChartLegendItem> layout(Element host, {Future schedulePostRender}); | |
54 } | |
55 | |
56 /// | |
57 /// Common interface for all renderers in Charted | |
58 /// | |
59 abstract class ChartRenderer extends ChartRendererBehaviorSource { | |
60 /// Name of the renderer. | |
61 /// The name can only include chars that are allowed in the CSS for selectors. | |
62 String get name; | |
63 | |
64 /// Prepare the chart for rendering. | |
65 /// - [area] represents the [ChartArea] on which the chart is rendered. | |
66 /// - [series] represents the [ChartSeries] that is rendered | |
67 bool prepare(ChartArea area, ChartSeries series); | |
68 | |
69 /// Clears DOM created by this renderer and releases | |
70 /// references to passed objects. | |
71 void dispose(); | |
72 } | |
OLD | NEW |