Check the chart shape is Okay. If not returns an error.
(
steps: bool,
bars: bool,
points: bool,
call: &EvaluatedCall,
)
| 116 | |
| 117 | /// Check the chart shape is Okay. If not returns an error. |
| 118 | fn check_chart_shape<'a>( |
| 119 | steps: bool, |
| 120 | bars: bool, |
| 121 | points: bool, |
| 122 | call: &EvaluatedCall, |
| 123 | ) -> Result<(), LabeledError> { |
| 124 | match (steps, bars, points) { |
| 125 | (true, false, false) => Ok(()), |
| 126 | (false, true, false) => Ok(()), |
| 127 | (false, false, true) => Ok(()), |
| 128 | (false, false, false) => Ok(()), |
| 129 | _ => Err(LabeledError::new("Shape must be either steps or bars or points, not more than one. Check your flags!").with_label("Chart shape error", call.head)), |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /// Return the minimum and the maximum of a slice of `f32`. |
| 134 | fn min_max(series: &[f32]) -> (f32, f32) { |