colorimetry_plot/chart/
delegate.rs1#[macro_export]
8macro_rules! delegate_xy_chart_methods {
9 ($struct_type:ty, $field:ident) => {
10 impl $struct_type {
11 pub fn plot_grid(
14 mut self,
15 x_step: f64,
16 y_step: f64,
17 style_attr: Option<StyleAttr>,
18 ) -> Self {
19 self.$field = self.$field.plot_grid(x_step, y_step, style_attr);
20 self
21 }
22
23 pub fn plot_poly_line(
24 mut self,
25 points: impl IntoIterator<Item = (f64, f64)>,
26 style_attr: Option<StyleAttr>,
27 ) -> Self {
28 self.$field = self.$field.plot_poly_line(points, style_attr);
29 self
30 }
31
32 pub fn plot_shape(
33 mut self,
34 points: impl IntoIterator<Item = (f64, f64)>,
35 style_attr: Option<StyleAttr>,
36 ) -> Self {
37 self.$field = self.$field.plot_shape(points, style_attr);
38 self
39 }
40
41 pub fn draw_data(
42 mut self,
43 layer: &str,
44 data: svg::node::element::path::Data,
45 style_attr: Option<StyleAttr>,
46 ) -> Self {
47 self.$field = self.$field.draw_data(layer, data, style_attr);
48 self
49 }
50
51 pub fn draw_path(
52 mut self,
53 layer: &str,
54 path: svg::node::element::Path,
55 style_attr: Option<StyleAttr>,
56 ) -> Self {
57 self.$field = self.$field.draw_path(layer, path, style_attr);
58 self
59 }
60
61 pub fn plot_image(
62 mut self,
63 image: impl Into<svg::node::element::Image>,
64 style_attr: Option<StyleAttr>,
65 ) -> Self {
66 self.$field = self.$field.plot_image(image, style_attr);
67 self
68 }
69 pub fn ticks(
70 mut self,
71 x_step: f64,
72 y_step: f64,
73 length: i32,
74 style_attr: Option<StyleAttr>,
75 ) -> Self {
76 self.$field = self.$field.ticks(x_step, y_step, length, style_attr);
77 self
78 }
79
80 pub fn x_labels(
81 mut self,
82 step: f64,
83 offset: usize,
84 style_attr: Option<StyleAttr>,
85 ) -> Self {
86 self.$field = self.$field.x_labels(step, offset, style_attr);
87 self
88 }
89
90 pub fn y_labels(
91 mut self,
92 step: f64,
93 offset: usize,
94 style_attr: Option<StyleAttr>,
95 ) -> Self {
96 self.$field = self.$field.y_labels(step, offset, style_attr);
97 self
98 }
99
100 pub fn x_axis_description(
101 mut self,
102 description: &str,
103 style_attr: Option<StyleAttr>,
104 ) -> Self {
105 self.$field = self.$field.x_axis_description(description, style_attr);
106 self
107 }
108
109 pub fn y_axis_description(
110 mut self,
111 description: &str,
112 style_attr: Option<StyleAttr>,
113 ) -> Self {
114 self.$field = self.$field.y_axis_description(description, style_attr);
115 self
116 }
117
118 pub fn label_pin(
120 mut self,
121 cxy: (f64, f64),
122 r: f64,
123 angle_and_length: (i32, i32),
124 text: impl AsRef<str>,
125 style_attr: Option<StyleAttr>,
126 ) -> Self {
127 self.$field = self
128 .$field
129 .label_pin(cxy, r, angle_and_length, text, style_attr);
130 self
131 }
132 }
133 };
134}