Skip to main content

euv_chart/event/
struct.rs

1use super::*;
2
3/// An event a chart emits.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct ChartEvent {
6    /// The kind of the event.
7    pub event_type: ChartEventType,
8    /// The index of the series the event happened on.
9    pub series_index: Option<usize>,
10    /// The index of the data point the event happened on.
11    pub data_index: Option<usize>,
12    /// The name of the series the event happened on.
13    pub series_name: String,
14    /// The name of the data point the event happened on.
15    pub name: String,
16    /// The value of the data point the event happened on.
17    pub value: Option<f64>,
18    /// The horizontal position of the pointer, in canvas pixels.
19    pub x: f64,
20    /// The vertical position of the pointer, in canvas pixels.
21    pub y: f64,
22    /// The horizontal position of the pointer, relative to the canvas.
23    pub offset_x: f64,
24    /// The vertical position of the pointer, relative to the canvas.
25    pub offset_y: f64,
26}
27
28/// A registered handler, together with the kind of event it listens for.
29#[derive(Clone)]
30pub(crate) struct EventRegistration {
31    /// The kind of event the handler listens for.
32    pub(crate) event_type: ChartEventType,
33    /// The handler itself.
34    pub(crate) handler: EventHandler,
35}