Files
vectorcraft/crates/engine/src/cmd/graph.rs
T
dotCooCoo 0b207f4e85 Graphs: axis lines, tick marks and radar rings keep the paint set on them
A graph drew its axis lines and tick marks in 0.5 pt black and a radar
graph's rings in 0.25 pt gray every time, with nothing stored for them. A
stroke, fill, weight, recolor, Appearance row, graphic style, Eyedropper
pick or opacity given to them was lost when the graph was drawn again.

- The graph now stores the rows of its axis lines and tick marks
  (axisRows) and, separately, of a radar graph's rings (ringRows): the
  paint, weight, opacity and blend mode of the topmost visible fill and
  stroke row, their order, and the line's object opacity and blend mode.
  Every line of the kind is drawn with them. Dashes, caps, joins and
  arrowheads are not stored.
- These commands store a line's rows: paint.setFill, paint.setStroke,
  the stroke, gradient and recolor commands, paint.swap, paint.default,
  Apply Fill to Stroke and Stroke to Fill, the appearance commands with
  the Eyedropper, graphic styles, transparency.set and object.setProps.
  paint.setFill, paint.setStroke and the recolor commands given a whole
  graph now also store what they give its lines.
- When one command reaches several lines of a kind, the frontmost line in
  paint order sets what the kind keeps. A gradient is stored without its
  placement.
- Lines that show their default stroke store nothing, and a global swatch
  edit or a document color conversion reaches the stored paint.

Docs: docs/mcp.md, the params text of these commands,
docs/target-app-parity.md.
2026-11-13 18:06:25 -08:00

56 lines
1.9 KiB
Rust

//! Graphs: the nine graph tools and Object → Graph (Type…, Data…).
//!
//! A graph is a group carrying a [`GraphSpec`]; its children (axes, labels, one group per series
//! with that series' legend swatch, like Illustrator's group-selectable series) are generated from
//! the spec. Editing the data or the type regenerates them in place, keeping any move/scale the
//! user applied to the graph since it was generated.
use std::collections::HashMap;
use std::sync::Arc;
use serde_json::{Value, json};
use vectorcraft_color::{Color, Paint};
use vectorcraft_doc::{
Appearance, CharStyle, ColumnDesign, ColumnType, Document, Fractions, GraphDesign, GraphKind, GraphSpec, Justify, Node, NodeId, NodeKind,
TextObject, TickLength, ValueAxisSide,
};
use vectorcraft_geom::{Affine, BezPath, FillRule, PathData, Point, Rect, shapes};
use super::typecmd::refresh_bounds;
use super::{
CommandSpec, EngineError, Result, Session, bad, cmd, f64_req, has_doc, has_selection, named_id, number_or, ok, str_param, switch_or, text_param,
};
mod axis;
mod columns;
mod commands;
mod data;
mod designs;
mod edit;
mod generate;
mod labels;
mod markers;
mod series;
#[cfg(test)]
use axis::{nice_axis, tick_values};
#[cfg(test)]
use columns::{fill_totals, total_text};
pub use commands::specs;
pub(crate) use data::apply_csv;
#[cfg(test)]
use data::{fmt_value, parse_csv, to_csv};
#[cfg(test)]
use generate::generate;
#[cfg(test)]
use series::default_series_color;
pub(crate) use series::{
LabelTextChange, capture_label_anti_alias, capture_label_changes, capture_label_object_opacity, capture_label_paragraphs, capture_label_rows,
capture_label_styles, capture_label_text, capture_line_rows, capture_series_object_opacity, capture_series_opacity, capture_series_top_paints,
label_object_opacity_differs, labels_in, paint_targets, series_group_marks, series_group_marks_where, series_marks_in,
series_object_opacity_differs, shown_paint,
};
#[cfg(test)]
mod tests;