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 implemented by a [CartesianRenderer] that supports behaviors. | |
13 /// | |
14 abstract class ChartRendererBehaviorSource { | |
15 /// Stream to notify when a rendered value is clicked. | |
16 Stream<ChartEvent> get onValueClick; | |
17 | |
18 /// Stream to notify when user moves mouse over a rendered value | |
19 Stream<ChartEvent> get onValueMouseOver; | |
20 | |
21 /// Stream to notify when user moves mouse out of rendered value | |
22 Stream<ChartEvent> get onValueMouseOut; | |
23 } | |
24 | |
25 /// | |
26 /// Interface implemented by a [ChartArea] that supports behaviors. | |
27 /// | |
28 abstract class ChartAreaBehaviorSource implements ChartRendererBehaviorSource { | |
29 /// Stream to notify when a mouse button is pressed on [ChartArea]. | |
30 Stream<ChartEvent> get onMouseDown; | |
31 | |
32 /// Stream to notify when a pressed mouse button is released on [ChartArea]. | |
33 Stream<ChartEvent> get onMouseUp; | |
34 | |
35 /// Stream to notify when mouse pointer enters [ChartArea]. | |
36 Stream<ChartEvent> get onMouseOver; | |
37 | |
38 /// Stream to notify when mouse pointer leaves [ChartArea]. | |
39 Stream<ChartEvent> get onMouseOut; | |
40 | |
41 /// Stream of events that notify when mouse is moved on [ChartArea]. | |
42 Stream<ChartEvent> get onMouseMove; | |
43 | |
44 /// A pane that is rendered below all the chart elements - for use with | |
45 /// behaviors that add elements to chart. | |
46 Selection get lowerBehaviorPane; | |
47 | |
48 /// A pane that is rendered above all the chart elements - for use with | |
49 /// behaviors that add elements to chart. | |
50 Selection get upperBehaviorPane; | |
51 | |
52 /// Add a behavior to the chart. | |
53 void addChartBehavior(ChartBehavior behavior); | |
54 | |
55 /// Remove a behavior from the chart. | |
56 void removeChartBehavior(ChartBehavior behavior); | |
57 } | |
58 | |
59 /// | |
60 /// Class representing an event emitted by ChartEventSource | |
61 /// | |
62 abstract class ChartEvent { | |
63 /// DOM source event that caused this event | |
64 Event get source; | |
65 | |
66 /// ChartSeries if any on which this event occurred | |
67 ChartSeries get series; | |
68 | |
69 /// Column in ChartData on which this event occurred | |
70 int get column; | |
71 | |
72 /// Row in ChartData on which this event occurred | |
73 int get row; | |
74 | |
75 /// Value from ChartData on which the event occurred | |
76 num get value; | |
77 | |
78 /// X position relative to the rendered chart | |
79 num get chartX; | |
80 | |
81 /// Y position relative to the rendered chart | |
82 num get chartY; | |
83 | |
84 factory ChartEvent(Event source, ChartArea area, | |
85 [ChartSeries series, int row, int column, value]) = DefaultChartEventImpl; | |
86 } | |
87 | |
88 /// Interface implemented by chart behaviors. | |
89 /// During initialization, the behaviors subscribe to any necessary events and | |
90 /// handle them appropriately. | |
91 abstract class ChartBehavior { | |
92 /// Called while ChartArea is being initialized. | |
93 /// - [area] is the ChartArea on which this behavior is installed | |
94 /// - [upperRenderPane] is the Selection that is rendered on top of the | |
95 /// chart. Behaviors can use it to draw any visualization in response | |
96 /// to user actions. | |
97 /// - [lowerRenderPane] is the Selection that is rendered below the chart. | |
98 void init( | |
99 ChartArea area, Selection upperRenderPane, Selection lowerRenderPane); | |
100 | |
101 /// Clears all DOM created by this behavior, unsubscribes to event listeners | |
102 /// and clears any state. | |
103 void dispose(); | |
104 } | |
OLD | NEW |