MCPcopy Create free account
hub / github.com/Euphrasiologist/nu_plugin_plot / check_chart_shape

Function check_chart_shape

src/lib.rs:118–131  ·  view source on GitHub ↗

Check the chart shape is Okay. If not returns an error.

(
    steps: bool,
    bars: bool,
    points: bool,
    call: &EvaluatedCall,
)

Source from the content-addressed store, hash-verified

116
117/// Check the chart shape is Okay. If not returns an error.
118fn 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`.
134fn min_max(series: &[f32]) -> (f32, f32) {

Callers 1

plot_nestedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected