mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-07 14:33:34 +00:00
A graph keeps the paint and stroke weight given to a series' marks, but not
the opacity of their fill or stroke row. An opacity set with
`transparency.set {item}` or `appearance.setItem {opacity}` on a column,
bar, line or other series path was lost the next time the graph was drawn
(a data, type or option change).
- `SeriesPaint` gains `fillOpacity` and `strokeOpacity`. A setItem opacity
on the topmost fill or stroke of a series path stores it, in the same
undo step, and the generator puts it on the topmost fill and stroke of
every path directly in that series' group. Graph designs keep their own
opacity. A value read from a file is held to 0..1.
- The Appearance commands that change the opacity of a series path's
topmost fill or stroke (add, remove, duplicate and move a row, Clear
Appearance, Reduce to Basic Appearance, `appearance.transfer` and the
Eyedropper) update the stored opacity. They do not change the stored
paint, which only `paint.setFill` and `paint.setStroke` set.
- An edit that leaves a series path fully opaque stores nothing for a
series the graph keeps nothing for.
49 lines
1.5 KiB
Rust
49 lines
1.5 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, bool_or, cmd, f64_or, f64_req, has_doc, has_selection, named_id, ok, str_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::{capture_label_styles, capture_series_opacity, capture_series_paints, paint_targets};
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|