Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions docs/design/canvas-net-vega-lite.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,9 @@ input:
and the parameter names from the tree; `FeatureCatalog.Visit` lists the recognized-but-unsupported constructs (the
functions, view state, and operators that the compiled expressions collected among them). The
parse warnings and the catalog reports are merged once, sorted by line and column (stable), and kept as the
document's reports.
document's reports. A render with a caller's `Config` visits the catalog again with the effective configuration
(`VegaLiteDocument.ReportsFor`), so that the reports that depend on the configuration (the overlays of a path mark,
which say whether the points or the line of an area draw a channel) are those of what is drawn.
5. **Output**: an immutable `VegaLiteDocument`, safe to share between threads.

**Measure and render path (`Measure`, `Render(options)`):**
Expand Down Expand Up @@ -1214,8 +1216,12 @@ The following decisions differ from, or are stricter than, the Vega-Lite referen
51. **Overlays (P9-D6)**: the `point` overlay of a line, area, trail, or rule and the `line` overlay of an area follow the
overlay mark definitions of Vega-Lite (`true`, an object, `"transparent"` for invisible points, and the
configuration of the mark; an area with an overlay and without an opacity gets the opacity 0.7), with these
differences: an `encoding.shape` does **not** switch the point overlay on (the channel stays reported as not drawn
by the mark), a `size` channel is applied to the overlay points through the scale of the base mark (for a line that
differences: an `encoding.shape` **switches the point overlay on** when the mark has no `point` and the configuration
does not decide (Vega-Lite's `getPointOverlay`; the shape is then drawn by the overlay points and is not reported),
the overlay marks draw the channels of their mark that the path does not (the points a `shape`, `angle`, `strokeDash`,
and `size`, the line overlay of an area its `strokeDash` and its `size` as the width; the legend of a line with
points shows filled symbols), a `size` channel is applied to the overlay points through the scale of the base mark
(for a line that
is its range of stroke widths read as the area of a symbol), the overlay line of an area groups as a line, and an
`{"expr": ...}` inside an overlay object is not evaluated (`vl-expr-ref`).
52. **Impute (P9-D7, P9-D8)**: the `impute` of `x` or `y` runs the impute engine after the aggregate and before the
Expand Down
6 changes: 5 additions & 1 deletion docs/design/canvas-net-vega-lite/guides/legend-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ unit's behavior is specified by the `CanvasNetVegaLite-Guides-LegendBuilder-*` r
- `LegendMarkFacts` - what the symbols stand for: whether the mark is filled (a **trail is never filled for its legend**,
see the paragraph on the path, area, arc, and text marks below), its fixed fill and stroke (the same rules
the marks use), the opacity (0.7 for point-like marks, or the constant opacity channel), the fixed shape, the stroke
width, dash, fill and stroke opacity, and whether a field drives the fill or the stroke.
width, dash, fill and stroke opacity, and whether a field drives the fill or the stroke. For a path mark with a **point
overlay** (`SpecNormalizer.PointOverlayDefinition`) the facts are those of the overlay mark, a filled `point` with an
opacity of 1 (whatever the overlay object replaces): Vega-Lite normalizes the mark into the path and a filled point
layer, and the merge of the legends prefers the circle of the points to the stroke of the path (`mergeSymbolType`), so
the legend of a line with points shows filled symbols (the color is their fill), not the hollow symbols of the line.
- `LegendSettings` - property lookup: the `legend` objects of the members (the first member that has a property wins,
which is Vega-Lite's explicit-over-implicit and first-channel rule), then `config.legend` with the Vega-Lite and Vega
defaults, then the `guide-label` and `guide-title` styles.
Expand Down
18 changes: 14 additions & 4 deletions docs/design/canvas-net-vega-lite/marks/mark-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,15 @@ opacity of 0); the line overlay is a `line` mark with the `clip`, `interpolate`,
run has no `x2` and `y2` (the line is drawn at the edge of the area), reads the stacked end of a stacked channel, skips
a channel that has a field but no scale (a channel that the overlaid mark does not draw), and groups its rows as a line
does. An `area` that has an overlay and names no `opacity`, `fillOpacity`, or configured opacity has the opacity 0.7.
Every overlay item is charged like the items of any run (a line overlay as a path, each point as an item).
The overlay definitions are built by `SpecNormalizer.PointOverlayDefinition` and `LineOverlayDefinition`, which the scale
resolver and the legend planner share. The point overlay is also enabled by an **encoding with a `shape` channel** when
the mark has no `point` property and `config.<mark>.point` is not truthy (Vega-Lite's `getPointOverlay`; `point: false`
or null keeps it off). The base run never reads the `shape` (nor an `angle`, or a `strokeDash` of an area or trail:
`ScaleResolver.ChannelIsDrawn` of the mark type is false, as Vega-Lite drops the shape from the path layer), so the shape
does not group the paths. The overlay runs read every channel that has a scale, so the scales that the resolver builds
for the overlays give the points their shapes, rotations, dashes, and sizes (a `shape`, an `angle`, a `strokeDash`, the
`size` of an area), and the line overlay of an area its dash and its width (the `size`, with the range of the stroke
widths). Every overlay item is charged like the items of any run (a line overlay as a path, each point as an item).

**Draw order** (`MarkBuilder.Order.cs`). The `order` channel decides the drawing order of `bar`, `rect`, `tick`, `rule`,
`point`, `circle`, `square`, `text`, and `arc` (Vega-Lite sorts the marks by it) when the encoding is **not stacked**:
Expand Down Expand Up @@ -337,9 +345,11 @@ reports the exhausted evaluation steps, and the text limits name `VegaLiteLimits

**Documented deviations from Vega-Lite and the plan** (each pinned by a test or reported by the feature catalog):

1. **No `shape` overlay trigger**: Vega-Lite enables the point overlay for an encoding with a `shape` channel; here the
`shape` channel of a line is not drawn and the overlay is not enabled by it. A `size` channel of the overlaid mark is
applied through the scale of that mark to the overlay points as well.
1. **Overlay differences** (the point overlay otherwise follows Vega-Lite's `getPointOverlay`, including the **`shape`
trigger**: an `encoding.shape` enables the overlay when `point` is missing and the configuration does not decide, see
`SpecNormalizer.HasPointOverlay`): the overlay is a second run of this builder and not a layer, so the `size` channel
of a line is applied through the scale of the line (its range of stroke widths read as the area of a symbol) to the
overlay points as well, and an `{"expr": ...}` inside an overlay object is not evaluated.
2. **Invalid-mode domains**: the scale domains are never filtered by the `invalid` mode (reported by the warning
`vl-mark-invalid-domains`); `show` is not supported (`vl-mark-invalid-show`).
3. **An area without a measure channel** draws nothing.
Expand Down
7 changes: 6 additions & 1 deletion docs/design/canvas-net-vega-lite/scales/scale-resolver.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ transform) for a
<!-- markdownlint-enable MD013 -->

A channel that a mark does not draw has no scale: `ResolveChannel` returns none for it, and the feature catalog
reports it (see _FeatureCatalog_).
reports it (see _FeatureCatalog_). The exception is a `line`, `area`, `trail`, or `rule` with an **overlay**
(`SpecNormalizer.HasPointOverlay` and `HasLineOverlay`, held in `Context.PointOverlay` and `Context.LineOverlay`): its
overlay marks draw the channels that they draw (`SpecNormalizer.OverlayDrawsChannel`), so `ResolveChannel` builds the
scale of a `shape`, an `angle`, a `strokeDash`, or a `size` for the points (`ChannelIsDrawn(channel, "point")`), and the
`strokeDash` and `size` of an `area` for its line overlay (`ChannelIsDrawn(channel, "line")`). The size range of an
`area` is that of the stroke widths when it has a line overlay (the line layer comes first), else that of a point.
- **Domain.** The fields a channel reads come from the `EncodingPlan`. A linear domain is the extent of the valid values
(numbers, booleans as 1 and 0, numeric strings; null and
NaN are ignored; an empty extent is 0 to 1) of the **Main** table, over the channel's field and its second field: for
Expand Down
5 changes: 3 additions & 2 deletions docs/design/canvas-net-vega-lite/spec-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ the other subsystems, and, through `InternalsVisibleTo`, the test assembly. It c
_FeatureCatalog Unit Design_ (`spec-model/feature-catalog.md`)
- **ConfigResolver** - the internal static `ConfigResolver`, `ResolvedConfig`, `ConfigNode`, and `ConfigNodeKind`; see
_ConfigResolver Unit Design_ (`spec-model/config-resolver.md`)
- **SpecNormalizer** - the internal static partial `SpecNormalizer` (`SpecNormalizer.cs`, `SpecNormalizer.Composition.cs`,
`SpecNormalizer.Repeat.cs`, `SpecNormalizer.Composite.cs`, `SpecNormalizer.BoxPlot.cs`, and `SpecNormalizer.ErrorBar.cs`),
- **SpecNormalizer** - the internal static partial `SpecNormalizer` (`SpecNormalizer.cs`,
`SpecNormalizer.Composition.cs`, `SpecNormalizer.Repeat.cs`, `SpecNormalizer.Composite.cs`,
`SpecNormalizer.BoxPlot.cs`, `SpecNormalizer.ErrorBar.cs`, and `SpecNormalizer.PathOverlay.cs`),
the tree types `LayerTree`, `LayerNode`, `LayerResolve`, `ResolveMode`, `ViewKind`, `CompositionSettings`,
`CompositionAlign`, `FacetDefinition`, and `RepeaterValues`, `ExpandedLayers`, and the `CompositeBuilder` and
`CompositeAxis` helpers: it turns the views of a specification into the tree of views (layers, concatenations, facets,
Expand Down
13 changes: 12 additions & 1 deletion docs/design/canvas-net-vega-lite/spec-model/feature-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,18 @@ sentinel unsupported channel), where `arc` and `theta` were before. The identifi
`angle` by `point`, `circle`, `square`, and `text`, `strokeDash` by every mark but `rect`, `area`, `trail`, `text`, and
`arc`, and `size` by every mark but `rect`, `area`, `arc`, and `image` (so `size` on an `area` or an `arc` is newly
reported; the `rect` size stays unreported as before). `vl-channel-x2` and `vl-channel-y2` are narrowed too: a bar,
rect, rule, and (new) area that has the channel they extend accepts them.
rect, rule, and (new) area that has the channel they extend accepts them. A `shape` of a `line`, `area`, `trail`, or
`rule` that has a point overlay (`SpecNormalizer.HasPointOverlay`: an `encoding.shape` switches the overlay on unless
`point` is `false` or null) is **not** reported, because the overlay points draw it and Vega-Lite drops it from the path
layer before it checks the channels; an `angle`, a `strokeDash` or a `size` that the path mark does not draw but its
overlay points do is still reported (the path layer warns about it in Vega-Lite) with the message that only the point
overlay draws it. The catalog reads `config.<mark>.point` and `config.area.line` from the effective configuration:
`FeatureCatalog.Visit(tree, config)` takes it (the renderer passes the configuration with the caller's, see
`VegaLiteDocument.ReportsFor`), and `Visit(tree)` reads the configuration of the specification alone. The channels of
the overlays are `SpecNormalizer.OverlayDrawsChannel` (a point draws shape, angle, size and dash; the line overlay of
an area draws size and dash); the message names the overlay that draws it ("only its point overlay", "its line overlay",
"its point and line overlays"). A `shape` is reported only when there is no point overlay, whatever the configuration
(the shape itself switches the overlay on).
- `vl-encoding-impute` is narrowed to a channel other than `x` and `y`: the impute of a position channel is run by the
pipeline, and the impute of any other channel is ignored and reported.
- `vl-encoding-bandposition` no longer reports the `bandPosition` of the **stacked** `theta` or `radius` of a text mark
Expand Down
25 changes: 23 additions & 2 deletions docs/design/canvas-net-vega-lite/spec-model/spec-normalizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

![SpecModel Structure](VegaLiteSpecModelView.svg)

The `SpecNormalizer` unit is the fourth software unit in the `SpecModel` subsystem. It is six partial files of the
The `SpecNormalizer` unit is the fourth software unit in the `SpecModel` subsystem. It is seven partial files of the
internal static class `SpecNormalizer` in the `DemaConsulting.CanvasNet.VegaLite.SpecModel` namespace:
`SpecNormalizer.cs` (the view tree and its walk), `SpecNormalizer.Composition.cs` (concatenations, facets, the faceted
unit view, and the layout settings), `SpecNormalizer.Repeat.cs` (the expansion of `repeat` and the replacement of the
repeat references), `SpecNormalizer.Composite.cs` (`Expand`, `ExpandedLayers`, `CompositeAxis`, and the
`CompositeBuilder` helper), `SpecNormalizer.BoxPlot.cs`, and `SpecNormalizer.ErrorBar.cs` (the expansion of the composite
marks, with the `ErrorInput` enumeration). The tree types `LayerTree`, `LayerNode`, `LayerResolve`, `ResolveMode`, and
marks, with the `ErrorInput` enumeration), and `SpecNormalizer.PathOverlay.cs` (the decision of Vega-Lite's path overlay
normalizer that the other stages share, see _Path overlay decision_). The tree types `LayerTree`, `LayerNode`,
`LayerResolve`, `ResolveMode`, and
`ViewKind` are declared in `SpecNormalizer.cs`; `CompositionSettings`, `CompositionAlign`, and `FacetDefinition` in
`SpecNormalizer.Composition.cs`; `RepeaterValues` and `RepeatLayers` in `SpecNormalizer.Repeat.cs`. Its supporting node
factories, `SpecNode.Overlay` and `SpecNode.Synthetic`, are in `SpecNode.cs`, and `SpecExpressions.With` in
Expand Down Expand Up @@ -169,6 +171,25 @@ object of the mark definition), `Orient` and `TryOrient`, `ContinuousAxis`, `Pos
node and are applied by the data stage.
- `TryOrientation(type, definition, encoding, out orient, out problem)` - decides the orientation of a composite mark
without throwing, for the catalog and the expansion.
- **Path overlay decision** (`SpecNormalizer.PathOverlay.cs`; Vega-Lite's `getPointOverlay` and `getLineOverlay` in its
path overlay normalizer). `HasPointOverlay` and `PointOverlayDefinition(markType, mark, encoding, configPoint)`
decide and build the point overlay of a `line`, `area`, `trail`, or `rule`: its `point` is `true`, an object, or
`"transparent"`; or its `point` is **missing** and `config.<mark>.point` is truthy **or the encoding has a `shape`
channel** (`HasShapeChannel`); `false` and null switch it off. `HasLineOverlay` and
`LineOverlayDefinition(markType, mark, configLine)` do the same for the line overlay of an `area` (`line` true or an
object, else `config.area.line`; the `clip`, `interpolate`, and `tension` of the area are inherited), and
`OverlayDrawsChannel(channel, pointOverlay, lineOverlay)` tells whether an overlay draws a channel (`ChannelIsDrawn`
for `point` and for `line`). The mark builder (which builds the overlay runs from the definitions), the scale resolver
(`Context.PointOverlay` and `Context.LineOverlay`), the legend planner (the symbols of a path mark with a point
overlay are those of the filled overlay `point`), and the feature catalog all ask it, so that the points, the lines,
the scales and legends of the channels they draw, and the reports agree. Vega-Lite normalizes such a mark into
layers: the path (`omit(encoding, ['shape'])`: the shape is dropped **before** the channels are checked against the
mark, so it raises no `incompatibleChannel` warning there and does not group the path), the line overlay of an area,
and the overlay `point` (each with the whole encoding without `x2` and `y2`, so the points draw the shape, angle,
stroke dash, and size, and the line overlay the stroke dash and the size as the width). Every other channel goes to
all the layers, so the path layer still warns about an `angle`, a `strokeDash` on an area or trail, and a `size` on
an area (`initEncoding` in `encoding.ts`); the feature catalog reports them with a message that says which overlay
draws them. `IsTruthyConfig` is the JavaScript truthiness of a configuration value.

**Boxplot expansion** (Vega-Lite's `normalizeBoxPlot`, without tooltips). The orientation is the continuous
(quantitative or temporal, as written or as `ChannelDefinitions.TypeOf` infers it) channel; a plot with both
Expand Down
3 changes: 2 additions & 1 deletion docs/design/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,8 @@ src/DemaConsulting.CanvasNet.VegaLite/
│ ├── SpecNormalizer.Repeat.cs — SpecNormalizer: repeat expansion and repeat references
│ ├── SpecNormalizer.Composite.cs — SpecNormalizer: Expand and the composite-mark expansion into layers
│ ├── SpecNormalizer.BoxPlot.cs — SpecNormalizer: the boxplot expansion
│ └── SpecNormalizer.ErrorBar.cs — SpecNormalizer: the errorbar and errorband expansion
│ ├── SpecNormalizer.ErrorBar.cs — SpecNormalizer: the errorbar and errorband expansion
│ └── SpecNormalizer.PathOverlay.cs — SpecNormalizer: the point overlay decision of the path marks
├── Data/ — Data subsystem (internal)
│ ├── NamespaceDoc.cs — Data: namespace-level XML documentation
│ ├── DataTable.cs — DataTable: DataValue, JsNumber, FieldPath, and DataTable
Expand Down
11 changes: 9 additions & 2 deletions docs/reqstream/canvas-net-vega-lite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1343,14 +1343,21 @@ sections:
title: >-
The library shall draw the point overlay of a line, area, trail, or rule (a symbol at every row)
and the line overlay of an area (a line along its top edge), from the mark definition or the
configuration, with the base encoding and the documented default opacity.
configuration, with the base encoding and the documented default opacity; and shall give the overlay
points the shape channel of the mark (which switches the overlay on unless the point property is
false or null) without a report, and the legend of that shape with filled symbols; shall give the line
overlay of an area the dash and the width of its encoding; and shall report what it draws, also when
the caller's configuration decides the overlays.
tags: [system]
justification: |
A line with points and an area with a line are common forms of the path marks.
A line with points and an area with a line are common forms of the path marks, and Vega-Lite draws
the points of a line by group with the shape channel.
children:
- CanvasNetVegaLite-Marks-MarkBuilder-Overlays
tests:
- CanvasNetVegaLite_SystemIntegration_Overlays_LinePointsAndAreaLineAreDrawn
- CanvasNetVegaLite_SystemIntegration_Overlays_ShapeChannelShapesTheOverlayPointsInStrictMode
- CanvasNetVegaLite_SystemIntegration_Overlays_CallerConfigurationAndLineOverlayAgreeWithTheReports

- id: CanvasNetVegaLite-InvalidData
title: >-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,15 @@ sections:
explicitly not merged but given a legend each, the
channels of different layers whose domains agree merging into one legend, the symbols of a
member drawn as the mark of the layer that the member comes from, and a disabled legend of
the layer honored; and shall give a view with one layer the same plan as the plan of that view.
the layer honored; shall give a view with one layer the same plan as the plan of that view; and
shall plan the shape of a path mark that has a point overlay as the points draw it, in one legend
with the color of the same field (with filled symbols, those of the overlay points) and in a
legend of its own for another field.
justification: |
A color that two layers share must give one legend, not two, and a legend that a layer keeps
apart must stay apart; a single view must not change.
tests:
- LegendPlan_Create_ShapeOfALineWithAPointOverlayHasALegendMergedWithTheColorOfTheSameField
- LegendPlan_Create_SameFieldInTwoLayersIsOneLegend
- LegendPlan_Create_TitlesOfDifferentFieldsJoin
- LegendPlan_Create_WrittenTitleOfAnyLayerWinsOverDerivedTitles
Expand Down
Loading
Loading