Skip to main content

euv_chart/chart/
enum.rs

1use super::*;
2
3/// A command for a chart.
4///
5/// The commands are what a handle sends to a chart. They are the same
6/// actions a chart takes on itself — drawing a new option, resizing,
7/// performing an action — and they travel through a signal, the way
8/// the rest of euv talks to its parts.
9///
10/// The option is boxed: an option is thousands of bytes, and a queue
11/// of commands should not be as big as the options it carries.
12///
13/// Every variant carries data, and `#[derive(Default)]` needs one
14/// without any, so this enum has no default.
15#[derive(Clone, Debug, PartialEq)]
16pub enum ChartCommand {
17    /// Draws the chart with the given option.
18    SetOption(Box<ChartOption>),
19    /// Draws the chart at the given size, in CSS pixels.
20    Resize(f64, f64),
21    /// Performs an action on the chart.
22    Action(ChartAction),
23}