|
26 | 26 | fn draw<F: Fn(&mut Frame)>(&self, size: Size, f: F) -> Geometry { |
27 | 27 | C::draw(self, size, f) |
28 | 28 | } |
29 | | - |
30 | 29 | #[inline] |
31 | 30 | fn update( |
32 | 31 | &self, |
|
37 | 36 | ) -> (Status, Option<Message>) { |
38 | 37 | C::update(self, state, event, bounds, cursor) |
39 | 38 | } |
40 | | - |
| 39 | + #[inline] |
41 | 40 | fn mouse_interaction( |
42 | 41 | &self, |
43 | 42 | state: &Self::State, |
|
56 | 55 | /// use plotters_iced::{Chart,ChartWidget}; |
57 | 56 | /// struct MyChart; |
58 | 57 | /// impl Chart<Message> for MyChart { |
59 | | -/// fn build_chart<DB:DrawingBackend>(&self, builder: ChartBuilder<DB>) { |
| 58 | +/// type State = (); |
| 59 | +/// fn build_chart<DB:DrawingBackend>(&self, state: &Self::State, builder: ChartBuilder<DB>) { |
60 | 60 | /// //build your chart here, please refer to plotters for more details |
61 | 61 | /// } |
62 | 62 | /// } |
@@ -90,8 +90,8 @@ pub trait Chart<Message> { |
90 | 90 | /// |
91 | 91 | /// impl Chart<Message> for MyChart { |
92 | 92 | /// // leave it empty |
93 | | - /// fn build_chart<DB: DrawingBackend>(&self, builder: ChartBuilder<DB>){} |
94 | | - /// fn draw_chart<DB: DrawingBackend>(&self, root: DrawingArea<DB, Shift>){ |
| 93 | + /// fn build_chart<DB: DrawingBackend>(&self, state: &Self::State, builder: ChartBuilder<DB>){} |
| 94 | + /// fn draw_chart<DB: DrawingBackend>(&self, state: &Self::State, root: DrawingArea<DB, Shift>){ |
95 | 95 | /// let children = root.split_evenly((3,3)); |
96 | 96 | /// for (area, color) in children.into_iter().zip(0..) { |
97 | 97 | /// area.fill(&Palette99::pick(color)).unwrap(); |
|
0 commit comments