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

Function chart_shape

src/lib.rs:101–115  ·  view source on GitHub ↗

The shape of the plot. Default is `Shape::Lines`, but also includes `Shape::Bars` and `Shape::Steps`.

(
    steps: bool,
    bars: bool,
    points: bool,
    call: &EvaluatedCall,
    v: &'a [(f32, f32)],
)

Source from the content-addressed store, hash-verified

99/// The shape of the plot. Default is `Shape::Lines`,
100/// but also includes `Shape::Bars` and `Shape::Steps`.
101fn chart_shape<'a>(
102 steps: bool,
103 bars: bool,
104 points: bool,
105 call: &EvaluatedCall,
106 v: &'a [(f32, f32)],
107) -> Result<Shape<'a>, LabeledError> {
108 match (steps, bars, points) {
109 (true, false, false) => Ok(Shape::Steps(v)),
110 (false, true, false) => Ok(Shape::Bars(v)),
111 (false, false, true) => Ok(Shape::Points(v)),
112 (false, false, false) => Ok(Shape::Lines(v)),
113 _ => 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)),
114 }
115}
116
117/// Check the chart shape is Okay. If not returns an error.
118fn check_chart_shape<'a>(

Callers 2

plotMethod · 0.85
plot_nestedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected