};
use color::{AlphaColor, Rgba8, Srgb, palette::css::TRANSPARENT};
+use enum_iterator::Sequence;
use enum_map::{Enum, EnumMap, enum_map};
use quick_xml::{DeError, de::from_str};
use serde::{Deserialize, Serialize, de::Visitor, ser::SerializeStruct};
}
/// The borders on a box.
-#[derive(Copy, Clone, Debug, Enum, PartialEq, Eq, Serialize)]
+#[derive(Copy, Clone, Debug, Enum, PartialEq, Eq, Serialize, Sequence)]
#[serde(rename_all = "snake_case")]
pub enum BoxBorder {
/// Left side.
output::pivot::{
self, Axis2, Axis3, Category, CategoryLocator, Dimension, Group, Leaf, Length, PivotTable,
look::{
- self, Area, AreaStyle, CellStyle, Color, HeadingRegion, HorzAlign, Look, RowParity,
- VertAlign,
+ self, Area, AreaStyle, Border, BorderStyle, BoxBorder, CellStyle, Color, HeadingRegion,
+ HorzAlign, Look, RowColBorder, RowParity, Stroke, VertAlign,
},
value::Value,
},
);
}
+ if a == Axis3::Y
+ && let Some(axis) = axes.get(&base_level)
+ && let Some(gridline) = &axis.major_ticks.gridline
+ && let Some(style) = gridline.style.get(&styles)
+ {
+ dbg!(axis, style);
+ if let Some(border_style) = style.border(BoxBorder::Bottom) {
+ // XXX probably not necessary, the Look is supplied at a higher level
+ look.borders[Border::Dimension(RowColBorder(HeadingRegion::Rows, Axis2::X))] =
+ border_style;
+ }
+ }
if let Some(axis) = axes.get(&base_level)
&& axis.major_ticks.label_angle == -90.0
{
}
}
+ if let Some(style) = graph.style.get(&styles) {
+ // XXX probably not necessary, the Look is supplied at a higher level
+ for box_border in enum_iterator::all::<BoxBorder>() {
+ if let Some(border_style) = style.border(box_border) {
+ look.borders[Border::InnerFrame(box_border)] = border_style;
+ }
+ }
+ }
+ if let Some(style) = &graph.facet_layout.table_layout.style
+ && let Some(style) = style.get(&styles)
+ {
+ // XXX probably not necessary, the Look is supplied at a higher level
+ if let Some(border_style) = style.border(BoxBorder::Right) {
+ look.borders[Border::DataLeft] = border_style;
+ }
+ if let Some(border_style) = style.border(BoxBorder::Bottom) {
+ look.borders[Border::DataTop] = border_style;
+ }
+ }
+
for child in &graph.facet_layout.children {
let FacetLayoutChild::SetCellProperties(scp) = child else {
continue;
label_angle: Option<f64>,
#[serde(rename = "@border-bottom")]
- border_bottom: Option<Border>,
+ border_bottom: Option<Stroke>,
#[serde(rename = "@border-top")]
- border_top: Option<Border>,
+ border_top: Option<Stroke>,
#[serde(rename = "@border-left")]
- border_left: Option<Border>,
+ border_left: Option<Stroke>,
#[serde(rename = "@border-right")]
- border_right: Option<Border>,
+ border_right: Option<Stroke>,
#[serde(rename = "@border-bottom-color")]
border_bottom_color: Option<Color>,
}
impl Style {
+ fn border(&self, which: BoxBorder) -> Option<BorderStyle> {
+ let (stroke, color) = match which {
+ BoxBorder::Left => (self.border_left, self.border_left_color),
+ BoxBorder::Top => (self.border_top, self.border_top_color),
+ BoxBorder::Right => (self.border_right, self.border_right_color),
+ BoxBorder::Bottom => (self.border_bottom, self.border_bottom_color),
+ };
+ stroke
+ .zip(color)
+ .map(|(stroke, color)| BorderStyle { stroke, color })
+ }
+
fn apply_to_value(
value: &mut Value,
sf: Option<&SetFormat>,
}
}
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize)]
-#[serde(rename_all = "camelCase")]
-enum Border {
- Solid,
- Thick,
- Thin,
- Double,
- None,
-}
-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "camelCase")]
enum FontWeight {
- Testcase 1
-╭───────────────────┬─────────┬───────┬─────────────┬──────────────────╮
-│ │Frequency│Percent│Valid Percent│Cumulative Percent│
-├───────────────────┼─────────┼───────┼─────────────┼──────────────────┤
-│Valid >2 years │ 1│ .5│ .5│ .5│
-│ 2-5 years │ 17│ 7.9│ 8.0│ 8.5│
-│ 6-10 years │ 122│ 57.0│ 57.3│ 65.7│
-│ 11-15 years│ 45│ 21.0│ 21.1│ 86.9│
-│ 16-20 years│ 18│ 8.4│ 8.5│ 95.3│
-│ >20 years │ 10│ 4.7│ 4.7│ 100.0│
-│ Total │ 213│ 99.5│ 100.0│ │
-├───────────────────┼─────────┼───────┼─────────────┼──────────────────┤
-│Missing System │ 1│ .5│ │ │
-├───────────────────┼─────────┼───────┼─────────────┼──────────────────┤
-│Total │ 214│ 100.0│ │ │
-╰───────────────────┴─────────┴───────┴─────────────┴──────────────────╯
+ Testcase 1
+ Frequency│Percent│Valid Percent│Cumulative Percent
+─────────────────────────────┼───────┼─────────────┼──────────────────
+Valid >2 years 1│ .5│ .5│ .5
+ ╶─────────────────────┼───────┼─────────────┼──────────────────
+ 2-5 years 17│ 7.9│ 8.0│ 8.5
+ ╶─────────────────────┼───────┼─────────────┼──────────────────
+ 6-10 years 122│ 57.0│ 57.3│ 65.7
+ ╶─────────────────────┼───────┼─────────────┼──────────────────
+ 11-15 years 45│ 21.0│ 21.1│ 86.9
+ ╶─────────────────────┼───────┼─────────────┼──────────────────
+ 16-20 years 18│ 8.4│ 8.5│ 95.3
+ ╶─────────────────────┼───────┼─────────────┼──────────────────
+ >20 years 10│ 4.7│ 4.7│ 100.0
+ ╶─────────────────────┼───────┼─────────────┼──────────────────
+ Total 213│ 99.5│ 100.0│
+─────────────────────────────┼───────┼─────────────┼──────────────────
+Missing System 1│ .5│ │
+─────────────────────────────┼───────┼─────────────┼──────────────────
+Total 214│ 100.0│ │
+─────────────────────────────┴───────┴─────────────┴──────────────────