Collect unique x-string labels from scatter/line traces for category/date axes.
(traces: &[TraceIR])
| 199 | |
| 200 | /// Collect unique x-string labels from scatter/line traces for category/date axes. |
| 201 | pub(super) fn collect_string_x_labels(traces: &[TraceIR]) -> Vec<String> { |
| 202 | let mut labels = Vec::new(); |
| 203 | for trace in traces { |
| 204 | let col = match trace { |
| 205 | TraceIR::ScatterPlot(ir) => Some(&ir.x), |
| 206 | TraceIR::LinePlot(ir) => Some(&ir.x), |
| 207 | _ => None, |
| 208 | }; |
| 209 | if let Some(col) = col { |
| 210 | labels.extend(extract_strings(col)); |
| 211 | } |
| 212 | } |
| 213 | let mut seen = std::collections::HashSet::new(); |
| 214 | labels.retain(|s| seen.insert(s.clone())); |
| 215 | labels |
| 216 | } |
| 217 | |
| 218 | /// Convert string x-values + f64 y-values into (index, y) pairs using a category map. |
| 219 | pub(super) fn category_xy_pairs( |
no test coverage detected