Merge pull request #7764 from dotCooCoo/feat/dataset-import-graph-columns

Variables: Import Data Sets reads % columns of graph data files
This commit is contained in:
BFlat
2026-11-18 10:15:07 +07:00
committed by GitHub
26 changed files with 560 additions and 119 deletions
+28 -11
View File
@@ -3689,7 +3689,7 @@ already walks Image Trace. Short agent entry points:
- Data sets: `dataset.list`, `dataset.new {name, values?}`, `dataset.set {name, newName?, values?}` (`newName` also
renames the row, in the same undo step; Edit Data Set's Name field sends it), `dataset.rename`,
`dataset.delete`, `dataset.capture`, `dataset.update`, `dataset.select {name}`, `dataset.next` /
`dataset.prev` (each `dataset.select` / next / prev is one undo step over every bound object), `dataset.import {path|data|dataBase64|csv}` /
`dataset.prev` (each `dataset.select` / next / prev is one undo step over every bound object), `dataset.import {path|data|dataBase64|csv, base?}` /
`dataset.export {path?}` (CSV: one column per variable, and no column of data set names). `dataset.import` also
reads tab-separated files. Every header cell is a variable, whatever its case (`name` and `Name` included). The
first row holds the field names, as the
@@ -3697,16 +3697,33 @@ already walks Image Trace. Short agent entry points:
describes. The rows replace every data set of the document and are named `Data Set 1`, `Data Set 2` and so on, in file order;
the document's variables and their bindings stay, and the reply's `deletedDataSets` lists the data sets that were replaced. An import error
about a row's values gives the file line the row starts on. A header cell that names no variable defines one, unbound, in the same undo step as the
rows. `#Shown` defines a visibility variable `Shown`, `@Photo` defines an image variable `Photo`, and a cell without
a prefix defines a text variable. `dataset.export` writes a visibility variable's header as `#Shown` and an image
variable's as `@Photo`, and a text or graph variable's as its name alone. Its reply's `warning` names the variables
whose header or values make an import into a document without them refuse the file (a `%` header, a `#` header
whose values aren't true or false). Otherwise it names the variables that such an import does not read back with
their kind: text variables whose names start with `#` or `@`, and graph variables. Export is refused, naming both variables, when a variable's header is
another variable's name (a visibility variable `Show` next to a text variable `#Show`). A prefixed cell whose name
is already a variable of the prefix's kind names it;
one whose name is a variable of another kind fails the import. A `%` cell that isn't a variable's exact name (graph
data files) is refused, and so are two cells that name one variable (`City` twice, or `Shown` and `#Shown`). The
rows. `#Shown` defines a visibility variable `Shown`, `@Photo` defines an image variable `Photo`, `%Sales` defines a
graph variable `Sales`, and a cell without a prefix defines a text variable. The cells of a `%` column are paths of
graph data files, as the set-up page's example shows. Each file is read as the Graph Data window's Import Data reads
one ([add graph data](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/visualize-data/add-graph-data.html)):
at most 1 MB; tab-separated when any line holds a tab, else comma-separated; the first row holds the series labels
and the first column the category labels; UTF-16 by the rule below, else UTF-8. The data becomes the data set's
graph value, which `dataset.select` applies as `graph.setData` applies it, so the graph gets the data that Import
Data and Apply give it. The files are read at import. A relative path is taken from `dataset.import`'s `base`
folder, else from the folder of the CSV file at `path`; with neither (`csv`, `data` or `dataBase64` and no `base`),
it fails the import. This is VectorCraft's own rule, and it differs from an `@` column's: an image path is kept as
the cell gives it, and a relative one is taken from the document's folder when a data set is selected. A `%` path is
followed as an image path is: a path on another computer, or on a network share other than the one `base` or the
CSV file is on, a device, and a URL other than a `file:` URL without a host fail the import with the line, the
column and the reason, and no file is read. A file that is missing, can't be read or is larger than 1 MB, a file
that gives a graph value longer than 256 KB, and `%` columns whose files and graph values hold more than 256 MB in all fail the import with
the line and the column, and the document is left as it was. Each file is read once per import, however many cells
name it, and counts once toward the 256 MB; each cell's graph value counts every time. `dataset.export` writes a
visibility variable's header as `#Shown` and an image variable's as `@Photo`, and a text or graph variable's as its
name alone. Its reply's `warning` names the variables whose header or values make an import into a document without
them refuse the file (a `%` header over values, which such an import reads as file paths, and a `#` header whose
values aren't true or false). Otherwise it names the variables that such an import does not read back with their
kind: variables whose names start with `#`, `@` or `%` and aren't of that prefix's kind, and graph variables. Export
is refused, naming both variables, when a variable's header is another variable's name (a visibility variable
`Show` next to a text variable `#Show`). A prefixed cell whose name is already a variable of the prefix's kind names
it; one whose name is a variable of another kind fails the import, and so do two cells that name one variable
(`City` twice, or `Shown` and `#Shown`). A cell that is a variable's exact name, prefix included, names that
variable, so the cells under a graph variable named `%Sales` are read as graph data in CSV form. The
reply's `defined` lists the variables the import defined. While the variables are
locked, an import whose header would define a variable fails with "variables are locked".
A `dataset.import` file that isn't UTF-8 is read as Windows-1252, unless it starts with the UTF-8 byte-order mark.
+1
View File
@@ -903,6 +903,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- Graphs: the Graph Data window's Import Data reads a UTF-16 text file without a byte-order mark by the same rule as Import Data Sets…, instead of filling the cells with NUL characters. It reads a file cut short by one byte, or with an unpaired surrogate, as it reads one after a byte-order mark.
- Graphs: in the Graph Data window, the pointer becomes a column-resize arrow over a column's right edge, and dragging the edge sets that column's width in whole digits, from 0 to 20 as Cell Style's Column Width allows. The columns after it move along. Cell Style's Column Width still sets every column, the dragged ones included ([Adjust decimal digits and column width](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/visualize-data/adjust-column-width.html)).
- Variables: Import Data Sets… (`dataset.import`) defines the variables a file's header names that the document lacks, unbound. `#Shown` defines a visibility variable, `@Photo` defines an image variable, and a header without a prefix defines a text variable. A header that is a variable's exact name keeps naming it, and any other `%` header (graph data files) is refused.
- Variables: Import Data Sets… (`dataset.import`) reads `%` columns instead of refusing them: `%Sales` defines or names the graph variable `Sales`, and each cell is the path of a graph data file, read as the Graph Data window's Import Data reads one and kept as the data set's graph value. A relative path is taken from the CSV file's folder, or from `base`. A missing, unreadable or larger than 1 MB file fails the import with its line and column, and the document is left as it was (`crates/engine/src/tests/variables.rs`).
- Variables: Load Variable Library… in the Variables panel menu (`variable.loadLibrary`) replaces the document's variables and data sets with a variable library's, read from its XML file, in one undo step: every data set is deleted, and every variable is deleted with its bindings and values, except a variable the library also declares with the same kind, which stays bound so the library's data sets change its objects (#4136); then the library's other variables are defined, unbound: text, visibility, image (linked file) and graph variables, and variables without a known `trait` as unknown. Its data sets take text values from each value's `p` elements, one paragraph each, visibility values from `true` or `false`, image values from a file's absolute path or `file:` URL, and graph values from a `data` element of series names and rows.
- Variables: Save Variable Library… in the Variables panel menu (`variable.saveLibrary`) writes the document's variables of every kind and its data sets as a variable library's XML file, which Load Variable Library reads back with the same variables, kinds, data set names and values.
- Variables: Variable Options… in the Variables panel menu, or a double click on a variable, shows the variable's name and kind, and OK changes either or both in one undo step (`variable.rename {name, newName?, kind?}`), as the [Work with variables](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/work-with-variables.html) page describes. VectorCraft's own rule for a kind change: objects that can't hold the new kind are unbound, and the variable's values in every data set are dropped.