(
traces_list: &[Vec<Box<dyn Trace + 'static>>],
)
| 656 | } |
| 657 | |
| 658 | pub(super) fn determine_box_mode( |
| 659 | traces_list: &[Vec<Box<dyn Trace + 'static>>], |
| 660 | ) -> Option<plotly::layout::BoxMode> { |
| 661 | let mut has_grouped_box = false; |
| 662 | |
| 663 | for traces in traces_list { |
| 664 | if traces.len() > 1 { |
| 665 | for trace in traces { |
| 666 | let json_str = trace.to_json(); |
| 667 | if let Ok(json) = serde_json::from_str::<Value>(&json_str) { |
| 668 | if let Some(trace_type) = json.get("type").and_then(|v| v.as_str()) { |
| 669 | if trace_type == "box" { |
| 670 | has_grouped_box = true; |
| 671 | break; |
| 672 | } |
| 673 | } |
| 674 | } |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | if has_grouped_box { |
| 679 | break; |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | if has_grouped_box { |
| 684 | Some(plotly::layout::BoxMode::Group) |
| 685 | } else { |
| 686 | None |
| 687 | } |
| 688 | } |
| 689 | |
| 690 | #[cfg(test)] |
| 691 | mod tests { |
no test coverage detected