graph rust
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 12 Jan 2026 16:54:54 +0000 (08:54 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 12 Jan 2026 16:54:54 +0000 (08:54 -0800)
rust/pspp/src/spv/read/graph.rs

index 5b2616006464818fadcf334f067c24f38dbed694..578539124394212bcac3afd7a86c203d0d8c969b 100644 (file)
@@ -214,6 +214,7 @@ enum VisChild {
     SourceVariable(SourceVariable),
     DerivedVariable(DerivedVariable),
     CategoricalDomain(CategoricalDomain),
+    IntervalDomain(IntervalDomain),
     Graph(Graph),
     LabelFrame(LabelFrame),
     Container(Container),
@@ -467,6 +468,17 @@ struct CategoricalDomain {
     id: Option<String>,
 
     variable_reference: VariableReference,
+    categories: Categories,
+}
+
+#[derive(Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct Categories {
+    #[serde(rename = "@remove")]
+    remove: bool,
+
+    #[serde(rename = "$text")]
+    categories: String,
 }
 
 #[derive(Deserialize, Debug)]
@@ -884,6 +896,12 @@ struct Style {
     #[serde(rename = "@color")]
     color: Option<Color>,
 
+    #[serde(rename = "@color2")]
+    color2: Option<Color>,
+
+    #[serde(rename = "@font-family")]
+    font_family: Option<String>,
+
     #[serde(rename = "@font-size")]
     font_size: Option<String>,
 
@@ -907,6 +925,12 @@ struct Style {
 
     #[serde(rename = "@decimal-offset")]
     decimal_offset: Option<Length>,
+
+    #[serde(rename = "@symbol")]
+    symbol: Option<String>,
+
+    #[serde(default, rename = "$value")]
+    children: Vec<Style>,
 }
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize)]
@@ -961,11 +985,47 @@ impl From<LabelLocation> for VertAlign {
 #[derive(Deserialize, Debug)]
 #[serde(rename_all = "camelCase")]
 struct Graph {
+    #[serde(default, rename = "location")]
+    locations: Vec<Location>,
     faceting: Option<Faceting>,
     facet_layout: Option<FacetLayout>,
+    coordinates: Coordinates,
     interval: Interval,
 }
 
+#[derive(Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct Location {
+    #[serde(rename = "@method")]
+    method: LocationMethod,
+    #[serde(rename = "@part")]
+    part: Part,
+    #[serde(rename = "@target")]
+    target: Option<String>,
+    #[serde(rename = "@value")]
+    value: Option<String>,
+}
+
+#[derive(Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+enum LocationMethod {
+    Fixed,
+    SizeToContent,
+    Same,
+    Attach,
+}
+
+#[derive(Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+enum Part {
+    Left,
+    Right,
+    Top,
+    Bottom,
+    Width,
+    Height,
+}
+
 #[derive(Deserialize, Debug)]
 #[serde(rename_all = "camelCase")]
 struct Faceting {
@@ -1125,7 +1185,69 @@ enum SetFormatChild {
 
 #[derive(Deserialize, Debug)]
 #[serde(rename_all = "camelCase")]
-struct Interval {}
+struct Coordinates {
+    #[serde(rename = "dimension")]
+    dimensions: Vec<Dimension>,
+}
+
+#[derive(Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct Dimension {
+    scale: Option<Scale>,
+    axis: Axis,
+}
+
+#[derive(Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct Scale {
+    #[serde(rename = "@method")]
+    method: Method,
+}
+
+#[derive(Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+enum Method {
+    Linear,
+    Log,
+    Power,
+    #[serde(rename = "@log.safe")]
+    LogSafe,
+    #[serde(rename = "@power.safe")]
+    PowerSafe,
+    Logit,
+    Probit,
+    Asn,
+    Atanh,
+    Prob,
+    #[serde(rename = "@cLoglog")]
+    CLoglog,
+}
+
+#[derive(Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct Interval {
+    #[serde(rename = "@dot")]
+    dot: bool,
+
+    #[serde(rename = "@style")]
+    style: Ref<Style>,
+
+    #[serde(default)]
+    position: Vec<Coordinate>,
+    x: Option<Coordinate>,
+    y: Option<Coordinate>,
+    z: Option<Coordinate>,
+}
+
+#[derive(Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
+struct Coordinate {
+    #[serde(rename = "@id")]
+    id: Option<String>,
+
+    #[serde(rename = "@variable")]
+    variable: String,
+}
 
 #[derive(Deserialize, Debug)]
 #[serde(rename_all = "camelCase")]
@@ -1280,6 +1402,8 @@ impl Text {
 #[derive(Deserialize, Debug)]
 #[serde(rename_all = "camelCase")]
 struct LabelFrame {
+    #[serde(default, rename = "location")]
+    locations: Vec<Location>,
     label: Option<Label>,
 }