Add an axis-aligned span. Spans fill the space between two values on one axis. If both the fill and border colors are transparent, a color is auto-assigned.
(&mut self, mut span: Span)
| 2112 | /// Spans fill the space between two values on one axis. If both the fill |
| 2113 | /// and border colors are transparent, a color is auto-assigned. |
| 2114 | pub fn span(&mut self, mut span: Span) { |
| 2115 | let fill_is_transparent = span.fill_color() == Color32::TRANSPARENT; |
| 2116 | let border_is_transparent = span.border_color_value() == Color32::TRANSPARENT; |
| 2117 | |
| 2118 | // If no color was provided, automatically assign a color to the span |
| 2119 | if fill_is_transparent && border_is_transparent { |
| 2120 | let auto_color = self.auto_color(); |
| 2121 | span = span.fill(auto_color.gamma_multiply(0.15)).border_color(auto_color); |
| 2122 | } else if border_is_transparent && !fill_is_transparent { |
| 2123 | let fill_color = span.fill_color(); |
| 2124 | span = span.border_color(fill_color); |
| 2125 | } |
| 2126 | |
| 2127 | self.items.push(Box::new(span)); |
| 2128 | } |
| 2129 | |
| 2130 | /// Add a box plot diagram. |
| 2131 | pub fn box_plot(&mut self, mut box_plot: crate::BoxPlot) { |
no test coverage detected