ggaction 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -0
- package/README.md +20 -11
- package/knowledge/action-cards.json +1 -1
- package/knowledge/intent-taxonomy.json +1 -1
- package/knowledge/mcp-resources.json +1 -1
- package/package.json +8 -3
- package/src/actions/basic.js +2 -2
- package/src/actions/boxPlots/components.js +14 -4
- package/src/actions/boxPlots/edit.js +31 -5
- package/src/actions/boxPlots/materialize.js +11 -3
- package/src/actions/boxPlots/options.js +48 -16
- package/src/actions/categoryOrder/index.js +15 -4
- package/src/actions/charts/area.js +5 -1
- package/src/actions/charts/bar.js +2 -1
- package/src/actions/charts/density.js +6 -2
- package/src/actions/charts/ecdf.js +4 -1
- package/src/actions/charts/endpoints.js +25 -3
- package/src/actions/charts/heatmap.js +2 -1
- package/src/actions/charts/histogram.js +4 -3
- package/src/actions/charts/horizon.js +3 -1
- package/src/actions/charts/interval-regression.js +5 -2
- package/src/actions/charts/line.js +3 -1
- package/src/actions/charts/parallel.js +8 -2
- package/src/actions/charts/pie.js +10 -2
- package/src/actions/charts/polar.js +15 -4
- package/src/actions/charts/radar.js +8 -2
- package/src/actions/charts/radial.js +10 -2
- package/src/actions/charts/rug-strip.js +6 -2
- package/src/actions/charts/scatter.js +3 -1
- package/src/actions/composition/actions.js +13 -4
- package/src/actions/coordinates/actions.js +1 -1
- package/src/actions/coordinates/edit.js +76 -0
- package/src/actions/data/bin.js +1 -1
- package/src/actions/data/bin2d.js +57 -185
- package/src/actions/data/complete.js +26 -0
- package/src/actions/data/computed.js +2 -2
- package/src/actions/data/create.js +2 -2
- package/src/actions/data/density.js +12 -20
- package/src/actions/data/derived.js +47 -17
- package/src/actions/data/edit.js +539 -0
- package/src/actions/data/filter.js +14 -2
- package/src/actions/data/impute.js +26 -0
- package/src/actions/data/index.js +14 -0
- package/src/actions/data/normalize.js +27 -0
- package/src/actions/data/regression.js +16 -21
- package/src/actions/data/revisionBindings.js +145 -0
- package/src/actions/data/shared.js +20 -4
- package/src/actions/data/summary.js +1 -1
- package/src/actions/data/timeUnit.js +4 -1
- package/src/actions/data/window.js +1 -1
- package/src/actions/encodings/channels.js +415 -0
- package/src/actions/encodings/color/index.js +2 -1
- package/src/actions/encodings/density.js +5 -2
- package/src/actions/encodings/histogram.js +3 -2
- package/src/actions/encodings/index.js +4 -0
- package/src/actions/encodings/offset.js +20 -13
- package/src/actions/encodings/position/apply.js +53 -7
- package/src/actions/encodings/position/index.js +10 -2
- package/src/actions/encodings/position/policies/bar.js +9 -0
- package/src/actions/encodings/position/resolve.js +24 -7
- package/src/actions/encodings/remove.js +9 -4
- package/src/actions/encodings/ruleAppearance.js +1 -23
- package/src/actions/encodings/seriesLayout.js +1 -0
- package/src/actions/encodings/shared.js +82 -14
- package/src/actions/encodings/stroke.js +226 -0
- package/src/actions/errorBands/create.js +23 -3
- package/src/actions/errorBands/edit.js +21 -6
- package/src/actions/errorBars/create.js +35 -7
- package/src/actions/errorBars/edit.js +19 -4
- package/src/actions/facets/actions.js +237 -57
- package/src/actions/facets/derive.js +91 -26
- package/src/actions/gradientPlots/components.js +10 -2
- package/src/actions/gradientPlots/edit.js +14 -4
- package/src/actions/gradientPlots/materialize.js +3 -1
- package/src/actions/gradientPlots/options.js +10 -2
- package/src/actions/guides/applicability.js +8 -2
- package/src/actions/guides/axes/labels.js +58 -12
- package/src/actions/guides/axes/lines.js +6 -2
- package/src/actions/guides/axes/parallel/resolve.js +6 -2
- package/src/actions/guides/axes/tickGroups.js +2 -1
- package/src/actions/guides/axes/ticks.js +6 -2
- package/src/actions/guides/axes/titles.js +11 -3
- package/src/actions/guides/grids/resolve.js +7 -2
- package/src/actions/guides/guides.js +19 -3
- package/src/actions/guides/legends/blocks.js +426 -0
- package/src/actions/guides/legends/categorical/actions.js +134 -48
- package/src/actions/guides/legends/categorical/components.js +17 -12
- package/src/actions/guides/legends/categorical/index.js +37 -33
- package/src/actions/guides/legends/categorical/layout.js +97 -15
- package/src/actions/guides/legends/categorical/options.js +2 -2
- package/src/actions/guides/legends/categorical/recipes.js +111 -20
- package/src/actions/guides/legends/categorical/resolve.js +12 -8
- package/src/actions/guides/legends/categorical/symbols.js +85 -30
- package/src/actions/guides/legends/continuous/common.js +30 -12
- package/src/actions/guides/legends/continuous/gradient.js +10 -7
- package/src/actions/guides/legends/continuous/index.js +2 -0
- package/src/actions/guides/legends/continuous/interval.js +8 -3
- package/src/actions/guides/legends/continuous/opacity.js +8 -5
- package/src/actions/guides/legends/continuous/stroke.js +525 -0
- package/src/actions/guides/legends/creation.js +14 -1
- package/src/actions/guides/legends/edit.js +158 -59
- package/src/actions/guides/legends/index.js +2 -0
- package/src/actions/guides/legends/lane.js +54 -19
- package/src/actions/guides/legends/lifecycle.js +19 -8
- package/src/actions/guides/legends/remove.js +13 -3
- package/src/actions/guides/legends/sampling.js +140 -0
- package/src/actions/guides/legends/size.js +93 -40
- package/src/actions/guides/legends/strokeWidth.js +34 -28
- package/src/actions/guides/legends/target.js +112 -1
- package/src/actions/guides/legends/transition.js +165 -16
- package/src/actions/guides/polar/axes/facade.js +4 -4
- package/src/actions/guides/polar/axes/labels.js +24 -5
- package/src/actions/guides/polar/axes/lines.js +10 -4
- package/src/actions/guides/polar/axes/shared.js +16 -0
- package/src/actions/guides/polar/axes/ticks.js +1 -1
- package/src/actions/guides/polar/axes/titles.js +1 -1
- package/src/actions/guides/polar/grids.js +1 -1
- package/src/actions/guides/polar/resolve.js +12 -8
- package/src/actions/index.js +14 -3
- package/src/actions/marks/arc/actions.js +77 -19
- package/src/actions/marks/area/actions.js +34 -9
- package/src/actions/marks/area/materialize.js +17 -1
- package/src/actions/marks/bar/create.js +11 -2
- package/src/actions/marks/bar/edit.js +20 -3
- package/src/actions/marks/bar/materialize.js +22 -2
- package/src/actions/marks/index.js +10 -1
- package/src/actions/marks/line/actions.js +37 -14
- package/src/actions/marks/line/materialize.js +29 -10
- package/src/actions/marks/point/create.js +8 -2
- package/src/actions/marks/point/edit.js +18 -6
- package/src/actions/marks/point/materialize.js +49 -15
- package/src/actions/marks/rect/actions.js +33 -12
- package/src/actions/marks/references.js +601 -30
- package/src/actions/marks/remove.js +71 -1
- package/src/actions/marks/rule/actions.js +47 -10
- package/src/actions/marks/shared.js +1 -1
- package/src/actions/marks/text/actions.js +74 -9
- package/src/actions/marks/text/index.js +4 -0
- package/src/actions/marks/text/layout.js +154 -6
- package/src/actions/marks/text/removal.js +173 -0
- package/src/actions/marks/text/selection.js +73 -0
- package/src/actions/marks/tick/actions.js +22 -5
- package/src/actions/primitives/editGraphics.js +26 -0
- package/src/actions/primitives/semantic.js +2 -1
- package/src/actions/primitives/semanticAction.js +83 -10
- package/src/actions/primitives/semanticValidation/guide.js +1 -1
- package/src/actions/primitives/semanticValidation/index.js +9 -1
- package/src/actions/primitives/semanticValidation/layer.js +5 -0
- package/src/actions/primitives/semanticValidation/scale.js +28 -7
- package/src/actions/regression/components.js +26 -11
- package/src/actions/regression/create.js +10 -2
- package/src/actions/regression/edit.js +21 -7
- package/src/actions/resources/index.js +7 -0
- package/src/actions/resources/remove.js +172 -0
- package/src/actions/scales/channels.js +212 -0
- package/src/actions/scales/consumers/common.js +1 -1
- package/src/actions/scales/consumers/families.js +3 -2
- package/src/actions/scales/consumers/index.js +19 -2
- package/src/actions/scales/consumers/seriesLayout.js +28 -14
- package/src/actions/scales/create.js +54 -22
- package/src/actions/scales/definitions.js +94 -40
- package/src/actions/scales/edit.js +66 -11
- package/src/actions/scales/editPolicy.js +81 -11
- package/src/actions/scales/index.js +6 -0
- package/src/actions/scales/materialize.js +4 -3
- package/src/actions/scales/offset.js +48 -0
- package/src/actions/scales/parallel.js +71 -0
- package/src/actions/scales/preview.js +111 -10
- package/src/actions/selection/actions.js +154 -30
- package/src/actions/selection/index.js +3 -0
- package/src/actions/theme/actions.js +68 -13
- package/src/actions/theme/composition.js +238 -0
- package/src/actions/theme/index.js +9 -2
- package/src/actions/theme/reconcile.js +315 -67
- package/src/actions/theme/state.js +160 -0
- package/src/actions/violinPlots/create.js +5 -2
- package/src/actions/violinPlots/edit.js +1 -0
- package/src/core/action.js +10 -0
- package/src/core/compositionState.js +6 -1
- package/src/core/programState.js +20 -0
- package/src/core/resourceReferences.js +332 -0
- package/src/core/vocabulary.js +16 -3
- package/src/grammar/bars/aggregate.js +4 -1
- package/src/grammar/bars/geometry.js +44 -0
- package/src/grammar/bin.js +54 -9
- package/src/grammar/complete.js +279 -0
- package/src/grammar/computed.js +265 -64
- package/src/grammar/coordinates.js +37 -0
- package/src/grammar/density.js +239 -37
- package/src/grammar/displayLabels.js +57 -0
- package/src/grammar/facets/dependencies.js +133 -1
- package/src/grammar/facets/guides.js +3 -0
- package/src/grammar/facets/index.js +7 -47
- package/src/grammar/facets/scales.js +15 -18
- package/src/grammar/impute.js +340 -0
- package/src/grammar/markLabelSelection.js +57 -0
- package/src/grammar/markLabels.js +18 -1
- package/src/grammar/normalize.js +366 -0
- package/src/grammar/pathSeries.js +26 -8
- package/src/grammar/pointShapes.js +13 -4
- package/src/grammar/polar.js +90 -8
- package/src/grammar/regression/index.js +1 -0
- package/src/grammar/regression/parameters.js +23 -0
- package/src/grammar/roundedRect.js +180 -0
- package/src/grammar/rules.js +1 -0
- package/src/grammar/scales/colorConsumers.js +20 -1
- package/src/grammar/scales/continuous.js +2 -2
- package/src/grammar/scales/definition.js +27 -4
- package/src/grammar/scales/index.js +1 -0
- package/src/grammar/scales/ordinal.js +12 -3
- package/src/grammar/scales/policies.js +2 -2
- package/src/grammar/scales/size.js +456 -0
- package/src/grammar/schemas/concreteGraphic.js +14 -2
- package/src/grammar/schemas/graphic.js +15 -0
- package/src/grammar/schemas/graphicBounds.js +179 -30
- package/src/grammar/schemas/semanticPath.js +7 -2
- package/src/grammar/statisticalReference.js +103 -0
- package/src/grammar/strokeStyle.js +77 -0
- package/src/grammar/summary.js +78 -16
- package/src/grammar/timeUnit.js +216 -5
- package/src/grammar/transformTopology.js +4 -0
- package/src/grammar/transforms.js +394 -28
- package/src/grammar/weightedStatistics.js +374 -0
- package/src/grammar/window.js +221 -16
- package/src/layout/aspect.js +80 -0
- package/src/layout/facets.js +59 -5
- package/src/layout/labels.js +343 -0
- package/src/materialization/bars/aggregate.js +25 -2
- package/src/materialization/bars/histogram.js +84 -24
- package/src/materialization/bars/ranged.js +19 -3
- package/src/materialization/bars/resolve.js +7 -4
- package/src/materialization/composition.js +3 -1
- package/src/materialization/coordinateBounds.js +204 -0
- package/src/materialization/dependencies.js +36 -0
- package/src/materialization/facetGuides/legacyCategorical.js +3 -0
- package/src/materialization/facetGuides/placement.js +8 -2
- package/src/materialization/facetGuides/preparation.js +12 -7
- package/src/materialization/facetHeaders.js +346 -0
- package/src/materialization/facets.js +15 -65
- package/src/materialization/guides/resources.js +26 -0
- package/src/materialization/legends.js +1 -1
- package/src/materialization/marks/index.js +11 -5
- package/src/materialization/marks/policies.js +2 -1
- package/src/materialization/rect.js +25 -12
- package/src/materialization/rectConfig.js +5 -1
- package/src/materialization/scales/map.js +5 -3
- package/src/materialization/scales/policies/binnedPosition.js +2 -2
- package/src/materialization/scales/policies/offset.js +50 -8
- package/src/materialization/scales/policies/series.js +4 -1
- package/src/materialization/scales/resolve.js +22 -6
- package/src/materialization/selection/items/arc.js +28 -4
- package/src/materialization/selection/items/bar.js +30 -3
- package/src/materialization/selection/items/common.js +19 -4
- package/src/materialization/selection/items/rect.js +28 -4
- package/src/materialization/selection/path.js +1 -1
- package/src/materialization/selection/point.js +3 -1
- package/src/materialization/text.js +265 -14
- package/src/renderers/canvas/circle.js +2 -3
- package/src/renderers/canvas/line.js +2 -3
- package/src/renderers/canvas/native.js +4 -4
- package/src/renderers/canvas/path.js +2 -3
- package/src/renderers/canvas/rect.js +2 -3
- package/src/renderers/canvas/stroke.js +11 -0
- package/src/renderers/svg.js +19 -0
- package/src/selectors/datasets.js +32 -1
- package/src/selectors/layers.js +4 -0
- package/src/theme/defaults.js +101 -0
- package/types/basic.d.ts +6 -0
- package/types/index.d.ts +85 -0
- package/types/program.d.ts +910 -117
|
@@ -7,6 +7,14 @@ import {
|
|
|
7
7
|
validateUnitInterval
|
|
8
8
|
} from "../../core/validation.js";
|
|
9
9
|
import { validatePointShape } from "../../grammar/pointShapes.js";
|
|
10
|
+
import {
|
|
11
|
+
requestedRectStyleDetails,
|
|
12
|
+
RECT_STYLE_PROPERTIES
|
|
13
|
+
} from "../../grammar/roundedRect.js";
|
|
14
|
+
import {
|
|
15
|
+
requestedStrokeDetails,
|
|
16
|
+
STROKE_STYLE_PROPERTIES
|
|
17
|
+
} from "../../grammar/strokeStyle.js";
|
|
10
18
|
import { DEFAULT_COLORS } from "../../theme/defaults.js";
|
|
11
19
|
import { normalizeGuides } from "../charts/shared.js";
|
|
12
20
|
|
|
@@ -45,24 +53,30 @@ function plainOptions(value, keys, label, operation = "createBoxPlot") {
|
|
|
45
53
|
return value;
|
|
46
54
|
}
|
|
47
55
|
|
|
48
|
-
function resolveAppearance(value, defaults, label, operation) {
|
|
56
|
+
function resolveAppearance(value, defaults, label, operation, details) {
|
|
49
57
|
const options = plainOptions(
|
|
50
58
|
value,
|
|
51
|
-
|
|
59
|
+
[
|
|
60
|
+
...Object.keys(defaults),
|
|
61
|
+
...(details === requestedRectStyleDetails
|
|
62
|
+
? RECT_STYLE_PROPERTIES
|
|
63
|
+
: STROKE_STYLE_PROPERTIES)
|
|
64
|
+
],
|
|
52
65
|
label,
|
|
53
66
|
operation
|
|
54
67
|
);
|
|
55
|
-
return Object.freeze(
|
|
56
|
-
Object.entries(defaults).map(([key, fallback]) => [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
return Object.freeze({
|
|
69
|
+
...Object.fromEntries(Object.entries(defaults).map(([key, fallback]) => [
|
|
70
|
+
key,
|
|
71
|
+
options[key] === undefined
|
|
72
|
+
? fallback
|
|
73
|
+
: APPEARANCE_VALIDATORS[key](
|
|
74
|
+
options[key],
|
|
75
|
+
`${operation} ${label}.${key}`
|
|
76
|
+
)
|
|
77
|
+
])),
|
|
78
|
+
...details(options, `${operation} ${label}`)
|
|
79
|
+
});
|
|
66
80
|
}
|
|
67
81
|
|
|
68
82
|
export function resolveBoxPosition(value, label, operation = "createBoxPlot") {
|
|
@@ -122,13 +136,31 @@ export function resolveBoxWidth(value, operation = "createBoxPlot") {
|
|
|
122
136
|
}
|
|
123
137
|
|
|
124
138
|
export function resolveBoxAppearance(value, operation = "createBoxPlot") {
|
|
125
|
-
return resolveAppearance(
|
|
139
|
+
return resolveAppearance(
|
|
140
|
+
value,
|
|
141
|
+
DEFAULT_BOX,
|
|
142
|
+
"box",
|
|
143
|
+
operation,
|
|
144
|
+
requestedRectStyleDetails
|
|
145
|
+
);
|
|
126
146
|
}
|
|
127
147
|
|
|
128
148
|
export function resolveBoxMedianAppearance(value, operation = "createBoxPlot") {
|
|
129
|
-
return resolveAppearance(
|
|
149
|
+
return resolveAppearance(
|
|
150
|
+
value,
|
|
151
|
+
DEFAULT_MEDIAN,
|
|
152
|
+
"median",
|
|
153
|
+
operation,
|
|
154
|
+
requestedStrokeDetails
|
|
155
|
+
);
|
|
130
156
|
}
|
|
131
157
|
|
|
132
158
|
export function resolveBoxOutlierAppearance(value, operation = "createBoxPlot") {
|
|
133
|
-
return resolveAppearance(
|
|
159
|
+
return resolveAppearance(
|
|
160
|
+
value,
|
|
161
|
+
DEFAULT_OUTLIER,
|
|
162
|
+
"outlier",
|
|
163
|
+
operation,
|
|
164
|
+
requestedStrokeDetails
|
|
165
|
+
);
|
|
134
166
|
}
|
|
@@ -8,7 +8,10 @@ import {
|
|
|
8
8
|
applyMaterializationPlan,
|
|
9
9
|
planScaleGuideRematerialization
|
|
10
10
|
} from "../../materialization/dependencies.js";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
getMarkMaterializationStep,
|
|
13
|
+
getSourceDependentMarkSteps
|
|
14
|
+
} from "../../materialization/marks/index.js";
|
|
12
15
|
import { buildMaterializationPlan } from "../../materialization/planner.js";
|
|
13
16
|
import {
|
|
14
17
|
CATEGORY_ORDER_CHANNELS,
|
|
@@ -56,14 +59,22 @@ function resolveAssignment(program, args, operation, { activeOnly = false } = {}
|
|
|
56
59
|
|
|
57
60
|
function rematerializeAssignment(program, scaleId) {
|
|
58
61
|
const consumers = findScaleConsumers(program, scaleId);
|
|
62
|
+
const directMarks = consumers.map(consumer =>
|
|
63
|
+
getMarkMaterializationStep(program, consumer.layer)
|
|
64
|
+
);
|
|
59
65
|
return applyMaterializationPlan(program, buildMaterializationPlan({
|
|
60
66
|
scales: [{
|
|
61
67
|
op: "rematerializeScale",
|
|
62
68
|
args: { id: scaleId, guides: false, marks: false }
|
|
63
69
|
}],
|
|
64
|
-
marks:
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
marks: [
|
|
71
|
+
...directMarks,
|
|
72
|
+
...directMarks.flatMap(step =>
|
|
73
|
+
step === undefined
|
|
74
|
+
? []
|
|
75
|
+
: getSourceDependentMarkSteps(program, step.args.id)
|
|
76
|
+
)
|
|
77
|
+
],
|
|
67
78
|
guides: planScaleGuideRematerialization(program, scaleId)
|
|
68
79
|
}));
|
|
69
80
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
2
3
|
import { normalizeGroupFields } from "../../grammar/pathSeries.js";
|
|
3
4
|
import { normalizeAreaBound, validateAreaEndpointPair } from "../../grammar/areaEndpoints.js";
|
|
4
5
|
import {
|
|
@@ -31,7 +32,10 @@ export const createAreaPlot = action({ op: OPERATION, description: "Create a sim
|
|
|
31
32
|
const upper = ranged ? measurement.upper : { datum: args.baseline ?? 0 };
|
|
32
33
|
validateAreaEndpointPair(normalizeAreaBound(lower), normalizeAreaBound(upper));
|
|
33
34
|
const groupBy = args.groupBy === undefined ? undefined : normalizeGroupFields(args.groupBy);
|
|
34
|
-
const area = omitUndefinedOptions(normalizeAppearance(args.area, [
|
|
35
|
+
const area = omitUndefinedOptions(normalizeAppearance(args.area, [
|
|
36
|
+
"fill", "opacity", "stroke", "strokeWidth", "curve",
|
|
37
|
+
...STROKE_STYLE_PROPERTIES
|
|
38
|
+
], `${OPERATION} area`));
|
|
35
39
|
const color = args.color === undefined ? undefined : normalizeCategoricalColor(args.color, `${OPERATION} color`);
|
|
36
40
|
if (color !== undefined && area.fill !== undefined) throw new Error("createAreaPlot area.fill cannot be combined with color.");
|
|
37
41
|
const guides = normalizeCategoricalGuides(args.guides, OPERATION, color);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
2
|
import { isBarCategoryEncoding } from "../../grammar/bars/policy.js";
|
|
3
|
+
import { RECT_STYLE_PROPERTIES } from "../../grammar/roundedRect.js";
|
|
3
4
|
import {
|
|
4
5
|
applyFacadeGuides,
|
|
5
6
|
inferFacadeFieldType,
|
|
@@ -19,7 +20,7 @@ const OPTIONS = Object.freeze([
|
|
|
19
20
|
"id", "data", "coordinate", "x", "y", "color", "width", "bar", "guides"
|
|
20
21
|
]);
|
|
21
22
|
const BAR_OPTIONS = Object.freeze([
|
|
22
|
-
"fill", "opacity", "stroke", "strokeWidth"
|
|
23
|
+
"fill", "opacity", "stroke", "strokeWidth", ...RECT_STYLE_PROPERTIES
|
|
23
24
|
]);
|
|
24
25
|
|
|
25
26
|
export const createBarPlot = action(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
2
3
|
import { validateNonEmptyString, validateOptionObject } from "../../core/validation.js";
|
|
3
4
|
import {
|
|
4
5
|
applyFacadeGuides, normalizeAppearance, normalizeCategoricalColor, normalizeCategoricalGuides,
|
|
@@ -7,8 +8,11 @@ import {
|
|
|
7
8
|
|
|
8
9
|
const OPERATION = "createDensityPlot";
|
|
9
10
|
const OPTIONS = ["id", "data", "coordinate", "field", "groupBy", "bandwidth", "extent", "steps",
|
|
10
|
-
"kernel", "normalization", "as", "densityChannel", "valueScale", "densityScale", "color", "area", "guides"];
|
|
11
|
-
const AREA_OPTIONS = [
|
|
11
|
+
"kernel", "normalization", "weight", "as", "densityChannel", "valueScale", "densityScale", "color", "area", "guides"];
|
|
12
|
+
const AREA_OPTIONS = [
|
|
13
|
+
"fill", "opacity", "stroke", "strokeWidth", "curve",
|
|
14
|
+
...STROKE_STYLE_PROPERTIES
|
|
15
|
+
];
|
|
12
16
|
|
|
13
17
|
export const createDensityPlot = action({
|
|
14
18
|
op: OPERATION, description: "Create a baseline kernel-density area plot with optional explicit groups."
|
|
@@ -2,6 +2,7 @@ import { action } from "../../core/action.js";
|
|
|
2
2
|
import { validateUserId } from "../../core/identifiers.js";
|
|
3
3
|
import { validateNonEmptyString, validateOptionObject } from "../../core/validation.js";
|
|
4
4
|
import { normalizeGroupFields } from "../../grammar/pathSeries.js";
|
|
5
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
5
6
|
import {
|
|
6
7
|
applyFacadeGuides,
|
|
7
8
|
normalizeAppearance,
|
|
@@ -20,7 +21,9 @@ const OPTIONS = Object.freeze([
|
|
|
20
21
|
const EDIT_OPTIONS = Object.freeze([
|
|
21
22
|
"target", "data", "coordinate", "field", "groupBy", "weight", "missing", "as", "color"
|
|
22
23
|
]);
|
|
23
|
-
const LINE_OPTIONS = Object.freeze([
|
|
24
|
+
const LINE_OPTIONS = Object.freeze([
|
|
25
|
+
"strokeWidth", "stroke", "opacity", ...STROKE_STYLE_PROPERTIES
|
|
26
|
+
]);
|
|
24
27
|
const LABEL_OPTIONS = Object.freeze([
|
|
25
28
|
"field", "value", "content", "normalizeBy", "format", "layout", "fill",
|
|
26
29
|
"opacity", "fontSize", "fontFamily", "fontWeight", "align", "baseline",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
2
3
|
import { isPlainObject } from "../../core/immutable.js";
|
|
3
4
|
import { validateUserId } from "../../core/identifiers.js";
|
|
4
5
|
import { isNominalValue } from "../../grammar/scales/fields.js";
|
|
@@ -31,9 +32,12 @@ const DUMBBELL_OPTIONS = Object.freeze([
|
|
|
31
32
|
const CATEGORY_OPTIONS = Object.freeze(["field", "fieldType", "scale"]);
|
|
32
33
|
const VALUE_OPTIONS = Object.freeze(["field", "fieldType", "scale"]);
|
|
33
34
|
const POINT_OPTIONS = Object.freeze([
|
|
34
|
-
"shape", "fill", "opacity", "stroke", "strokeWidth", "radius"
|
|
35
|
+
"shape", "fill", "opacity", "stroke", "strokeWidth", "radius",
|
|
36
|
+
...STROKE_STYLE_PROPERTIES
|
|
37
|
+
]);
|
|
38
|
+
const RULE_OPTIONS = Object.freeze([
|
|
39
|
+
"stroke", "strokeWidth", "strokeDash", "opacity", ...STROKE_STYLE_PROPERTIES
|
|
35
40
|
]);
|
|
36
|
-
const RULE_OPTIONS = Object.freeze(["stroke", "strokeWidth", "strokeDash", "opacity"]);
|
|
37
41
|
const LABEL_OPTIONS = Object.freeze([
|
|
38
42
|
"endpoint", "field", "value", "content", "normalizeBy", "format", "layout",
|
|
39
43
|
"fill", "opacity", "fontSize", "fontFamily", "fontWeight", "align", "baseline",
|
|
@@ -210,6 +214,24 @@ function normalizeLabels(value, operation, allowEndpoint) {
|
|
|
210
214
|
return { ...value };
|
|
211
215
|
}
|
|
212
216
|
|
|
217
|
+
function normalizeDumbbellGuides(value, orientation, operation) {
|
|
218
|
+
const guides = normalizeGuides(value, operation);
|
|
219
|
+
if (guides === false || guides.axes === false) return guides;
|
|
220
|
+
const channel = orientation === "horizontal" ? "x" : "y";
|
|
221
|
+
const axes = guides.axes ?? {};
|
|
222
|
+
const axis = axes[channel];
|
|
223
|
+
if (axis === false || isPlainObject(axis) && Object.hasOwn(axis, "title")) {
|
|
224
|
+
return guides;
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
...guides,
|
|
228
|
+
axes: {
|
|
229
|
+
...axes,
|
|
230
|
+
[channel]: { ...(axis ?? {}), title: false }
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
213
235
|
function labelOptions(labels, defaultField) {
|
|
214
236
|
const { endpoint: _endpoint, ...options } = labels;
|
|
215
237
|
const hasContent = ["field", "value", "content"].some(key => Object.hasOwn(options, key));
|
|
@@ -325,7 +347,7 @@ export const createDumbbellPlot = action(
|
|
|
325
347
|
const startPoint = normalizePoint(args.startPoint, operation, "startPoint");
|
|
326
348
|
const endPoint = normalizePoint(args.endPoint, operation, "endPoint");
|
|
327
349
|
const connector = normalizeRule(args.connector, operation, "connector");
|
|
328
|
-
const guides =
|
|
350
|
+
const guides = normalizeDumbbellGuides(args.guides, orientation, operation);
|
|
329
351
|
const labels = normalizeLabels(args.labels, operation, true);
|
|
330
352
|
const sharedScale = start.scale ?? end.scale;
|
|
331
353
|
const prepared = prepareData(this, {
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
validateOptionObject
|
|
6
6
|
} from "../../core/validation.js";
|
|
7
7
|
import { requireDataset } from "../../selectors/datasets.js";
|
|
8
|
+
import { RECT_STYLE_PROPERTIES } from "../../grammar/roundedRect.js";
|
|
8
9
|
import {
|
|
9
10
|
applyFacadeGuides,
|
|
10
11
|
normalizeAppearance,
|
|
@@ -22,7 +23,7 @@ const OPTIONS = [
|
|
|
22
23
|
"id", "data", "coordinate", "x", "y", "bin", "color", "rect", "guides"
|
|
23
24
|
];
|
|
24
25
|
const RECT_OPTIONS = [
|
|
25
|
-
"opacity", "stroke", "strokeWidth"
|
|
26
|
+
"opacity", "stroke", "strokeWidth", ...RECT_STYLE_PROPERTIES
|
|
26
27
|
];
|
|
27
28
|
const BIN_OPTIONS = [
|
|
28
29
|
"bins", "extent", "includeEmpty"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
2
|
import { validateNonEmptyString } from "../../core/validation.js";
|
|
3
|
+
import { RECT_STYLE_PROPERTIES } from "../../grammar/roundedRect.js";
|
|
3
4
|
import {
|
|
4
5
|
applyFacadeGuides,
|
|
5
6
|
normalizeAppearance,
|
|
@@ -13,13 +14,13 @@ import {
|
|
|
13
14
|
|
|
14
15
|
const OPTIONS = Object.freeze([
|
|
15
16
|
"id", "data", "coordinate", "field", "maxBins", "binStep",
|
|
16
|
-
"binBoundaries", "stack", "xScale", "yScale", "color", "bar", "guides"
|
|
17
|
+
"binBoundaries", "stack", "xScale", "yScale", "weight", "color", "bar", "guides"
|
|
17
18
|
]);
|
|
18
19
|
const BAR_OPTIONS = Object.freeze([
|
|
19
|
-
"fill", "opacity", "stroke", "strokeWidth"
|
|
20
|
+
"fill", "opacity", "stroke", "strokeWidth", ...RECT_STYLE_PROPERTIES
|
|
20
21
|
]);
|
|
21
22
|
const HISTOGRAM_OPTIONS = Object.freeze([
|
|
22
|
-
"maxBins", "binStep", "binBoundaries", "stack", "xScale", "yScale"
|
|
23
|
+
"maxBins", "binStep", "binBoundaries", "stack", "xScale", "yScale", "weight"
|
|
23
24
|
]);
|
|
24
25
|
|
|
25
26
|
export const createHistogram = action(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
2
3
|
import { validateNonEmptyString, validateOptionObject, validateUnitInterval } from "../../core/validation.js";
|
|
3
4
|
import {
|
|
4
5
|
applyFacadeGuides, normalizeAppearance, normalizeFieldEncoding, normalizeGuides,
|
|
@@ -51,7 +52,8 @@ export const createHorizonPlot = action({
|
|
|
51
52
|
const { id: requestedId, data: requestedData, coordinate, x: requestedX, y: requestedY,
|
|
52
53
|
area: requestedArea, guides: requestedGuides, ...horizon } = omitUndefinedOptions(args);
|
|
53
54
|
const { opacity, ...area } = omitUndefinedOptions(normalizeAppearance(requestedArea,
|
|
54
|
-
["opacity", "stroke", "strokeWidth", "curve"],
|
|
55
|
+
["opacity", "stroke", "strokeWidth", "curve", ...STROKE_STYLE_PROPERTIES],
|
|
56
|
+
`${OPERATION} area`));
|
|
55
57
|
for (const [key, value] of Object.entries({ ...horizon, ...area })) {
|
|
56
58
|
if (value === null) throw new TypeError(`${OPERATION} ${key} cannot be null.`);
|
|
57
59
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
2
|
import { validateNonNegativeFinite } from "../../core/validation.js";
|
|
3
3
|
import { findDataset } from "../../selectors/datasets.js";
|
|
4
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
4
5
|
import {
|
|
5
6
|
applyFacadeGuides,
|
|
6
7
|
normalizeAppearance,
|
|
@@ -18,10 +19,12 @@ const INTERVAL_OPTIONS = Object.freeze([
|
|
|
18
19
|
"color", "point", "errorBar", "guides"
|
|
19
20
|
]);
|
|
20
21
|
const POINT_OPTIONS = Object.freeze([
|
|
21
|
-
"shape", "fill", "opacity", "stroke", "strokeWidth", "radius"
|
|
22
|
+
"shape", "fill", "opacity", "stroke", "strokeWidth", "radius",
|
|
23
|
+
...STROKE_STYLE_PROPERTIES
|
|
22
24
|
]);
|
|
23
25
|
const ERROR_BAR_OPTIONS = Object.freeze([
|
|
24
|
-
"caps", "capSize", "stroke", "strokeWidth", "strokeDash", "opacity"
|
|
26
|
+
"caps", "capSize", "stroke", "strokeWidth", "strokeDash", "opacity",
|
|
27
|
+
...STROKE_STYLE_PROPERTIES
|
|
25
28
|
]);
|
|
26
29
|
|
|
27
30
|
function intervalChannel(value, operation, channel, id) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
2
|
import { normalizeGroupFields } from "../../grammar/pathSeries.js";
|
|
3
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
3
4
|
import {
|
|
4
5
|
applyFacadeGuides,
|
|
5
6
|
normalizeAppearance,
|
|
@@ -19,7 +20,8 @@ const OPTIONS = Object.freeze([
|
|
|
19
20
|
"strokeDash", "line", "guides"
|
|
20
21
|
]);
|
|
21
22
|
const LINE_OPTIONS = Object.freeze([
|
|
22
|
-
"strokeWidth", "curve", "stroke", "opacity", "closed"
|
|
23
|
+
"strokeWidth", "curve", "stroke", "opacity", "closed",
|
|
24
|
+
...STROKE_STYLE_PROPERTIES
|
|
23
25
|
]);
|
|
24
26
|
|
|
25
27
|
export const createLinePlot = action(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
2
|
import { resolveParallelCoordinate } from "../coordinates/parallel.js";
|
|
3
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
3
4
|
import {
|
|
4
5
|
applyFacadeGuides,
|
|
5
6
|
normalizeAppearance,
|
|
@@ -17,7 +18,8 @@ const OPTIONS = Object.freeze([
|
|
|
17
18
|
"color", "strokeDash", "line", "guides"
|
|
18
19
|
]);
|
|
19
20
|
const LINE_OPTIONS = Object.freeze([
|
|
20
|
-
"strokeWidth", "stroke", "opacity", "curve", "closed"
|
|
21
|
+
"strokeWidth", "stroke", "opacity", "curve", "closed",
|
|
22
|
+
...STROKE_STYLE_PROPERTIES
|
|
21
23
|
]);
|
|
22
24
|
|
|
23
25
|
function scopeParallelGuides(guides, coordinate) {
|
|
@@ -105,6 +107,10 @@ export const createParallelCoordinates = action(
|
|
|
105
107
|
if (strokeDash !== undefined) {
|
|
106
108
|
next = next.encodeStrokeDash(targetArgs(strokeDash, id));
|
|
107
109
|
}
|
|
108
|
-
|
|
110
|
+
next = applyFacadeGuides(next, guides, id);
|
|
111
|
+
return next._withMarkConfig(id, {
|
|
112
|
+
...next.markConfigs[id],
|
|
113
|
+
compositionRole: "parallel"
|
|
114
|
+
});
|
|
109
115
|
}
|
|
110
116
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
2
3
|
import {
|
|
3
4
|
applyFacadeGuides, normalizeAppearance, normalizeCategoricalColor, normalizeCategoricalGuides,
|
|
4
5
|
normalizeArcCategory, normalizeCategoryAggregate, omitUndefinedOptions,
|
|
@@ -7,7 +8,10 @@ import {
|
|
|
7
8
|
|
|
8
9
|
const OPERATION = "createPiePlot";
|
|
9
10
|
const OPTIONS = ["id", "data", "coordinate", "category", "value", "aggregate", "color", "arc", "guides"];
|
|
10
|
-
const ARC_OPTIONS = [
|
|
11
|
+
const ARC_OPTIONS = [
|
|
12
|
+
"innerRadius", "padAngle", "fill", "opacity", "stroke", "strokeWidth",
|
|
13
|
+
...STROKE_STYLE_PROPERTIES
|
|
14
|
+
];
|
|
11
15
|
function guideOptions(value, color) {
|
|
12
16
|
const guides = normalizeCategoricalGuides(value, OPERATION, color);
|
|
13
17
|
if (guides === false) return false;
|
|
@@ -40,5 +44,9 @@ export const createPiePlot = action({
|
|
|
40
44
|
...(aggregate === "sum" ? { weight: args.value } : {})
|
|
41
45
|
});
|
|
42
46
|
if (color !== undefined) next = next.encodeColor({ ...color, target: id });
|
|
43
|
-
|
|
47
|
+
next = applyFacadeGuides(next, guides, id, args.guides ?? {});
|
|
48
|
+
return next._withMarkConfig(id, {
|
|
49
|
+
...next.markConfigs[id],
|
|
50
|
+
compositionRole: "pie"
|
|
51
|
+
});
|
|
44
52
|
});
|
|
@@ -2,6 +2,7 @@ import { action } from "../../core/action.js";
|
|
|
2
2
|
import { validateNonNegativeFinite, validateOptionObject } from
|
|
3
3
|
"../../core/validation.js";
|
|
4
4
|
import { normalizeGroupFields } from "../../grammar/pathSeries.js";
|
|
5
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
5
6
|
import {
|
|
6
7
|
applyFacadeGuides,
|
|
7
8
|
normalizeAppearance,
|
|
@@ -20,10 +21,12 @@ const POSITION_OPTIONS = Object.freeze([
|
|
|
20
21
|
"field", "fieldType", "temporalUnit", "scale"
|
|
21
22
|
]);
|
|
22
23
|
const POINT_OPTIONS = Object.freeze([
|
|
23
|
-
"shape", "fill", "opacity", "stroke", "strokeWidth", "radius"
|
|
24
|
+
"shape", "fill", "opacity", "stroke", "strokeWidth", "radius",
|
|
25
|
+
...STROKE_STYLE_PROPERTIES
|
|
24
26
|
]);
|
|
25
27
|
const LINE_OPTIONS = Object.freeze([
|
|
26
|
-
"strokeWidth", "curve", "stroke", "opacity", "closed"
|
|
28
|
+
"strokeWidth", "curve", "stroke", "opacity", "closed",
|
|
29
|
+
...STROKE_STYLE_PROPERTIES
|
|
27
30
|
]);
|
|
28
31
|
|
|
29
32
|
function position(value, operation, channel) {
|
|
@@ -78,7 +81,11 @@ export const createPolarScatterPlot = action(
|
|
|
78
81
|
if (color !== undefined) next = next.encodeColor(targetArgs(color, id));
|
|
79
82
|
if (size !== undefined) next = next.encodeSize(targetArgs(size, id));
|
|
80
83
|
if (shape !== undefined) next = next.encodeShape(targetArgs(shape, id));
|
|
81
|
-
|
|
84
|
+
next = applyFacadeGuides(next, guides, id);
|
|
85
|
+
return next._withMarkConfig(id, {
|
|
86
|
+
...next.markConfigs[id],
|
|
87
|
+
compositionRole: "polar-point"
|
|
88
|
+
});
|
|
82
89
|
}
|
|
83
90
|
);
|
|
84
91
|
|
|
@@ -118,6 +125,10 @@ export const createPolarLinePlot = action(
|
|
|
118
125
|
if (groupBy !== undefined) next = next.encodeGroup({ target: id, fields: groupBy });
|
|
119
126
|
if (color !== undefined) next = next.encodeColor(targetArgs(color, id));
|
|
120
127
|
if (strokeDash !== undefined) next = next.encodeStrokeDash(targetArgs(strokeDash, id));
|
|
121
|
-
|
|
128
|
+
next = applyFacadeGuides(next, guides, id);
|
|
129
|
+
return next._withMarkConfig(id, {
|
|
130
|
+
...next.markConfigs[id],
|
|
131
|
+
compositionRole: "polar-line"
|
|
132
|
+
});
|
|
122
133
|
}
|
|
123
134
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
2
3
|
import { isPlainObject } from "../../core/immutable.js";
|
|
3
4
|
import { validateNonEmptyString, validateOptionObject } from
|
|
4
5
|
"../../core/validation.js";
|
|
@@ -31,7 +32,8 @@ const CATEGORY_SCALE_OPTIONS = Object.freeze([
|
|
|
31
32
|
const WIDE_OPTIONS = Object.freeze(["fields", "as"]);
|
|
32
33
|
const WIDE_AS_OPTIONS = Object.freeze(["key", "value"]);
|
|
33
34
|
const LINE_OPTIONS = Object.freeze([
|
|
34
|
-
"strokeWidth", "curve", "stroke", "opacity", "closed"
|
|
35
|
+
"strokeWidth", "curve", "stroke", "opacity", "closed",
|
|
36
|
+
...STROKE_STYLE_PROPERTIES
|
|
35
37
|
]);
|
|
36
38
|
|
|
37
39
|
function normalizeCategory(value, operation) {
|
|
@@ -283,7 +285,7 @@ export const createRadarPlot = action(
|
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
category = scaleWithOrder(category, order, operation);
|
|
286
|
-
|
|
288
|
+
next = next.createPolarLinePlot({
|
|
287
289
|
id,
|
|
288
290
|
data,
|
|
289
291
|
...(args.coordinate === undefined ? {} : { coordinate: args.coordinate }),
|
|
@@ -295,5 +297,9 @@ export const createRadarPlot = action(
|
|
|
295
297
|
line: { ...line, closed: true },
|
|
296
298
|
guides
|
|
297
299
|
});
|
|
300
|
+
return next._withMarkConfig(id, {
|
|
301
|
+
...next.markConfigs[id],
|
|
302
|
+
compositionRole: "radar"
|
|
303
|
+
});
|
|
298
304
|
}
|
|
299
305
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
2
3
|
import {
|
|
3
4
|
applyFacadeGuides, normalizeAppearance, normalizeArcCategory, normalizeCategoryAggregate,
|
|
4
5
|
normalizeCategoricalColor, normalizeCategoricalGuides, omitUndefinedOptions,
|
|
@@ -6,7 +7,10 @@ import {
|
|
|
6
7
|
} from "./shared.js";
|
|
7
8
|
|
|
8
9
|
const OPTIONS = ["id", "data", "coordinate", "category", "value", "aggregate", "radiusScale", "color", "arc", "guides"];
|
|
9
|
-
const ARC_OPTIONS = [
|
|
10
|
+
const ARC_OPTIONS = [
|
|
11
|
+
"innerRadius", "padAngle", "fill", "opacity", "stroke", "strokeWidth",
|
|
12
|
+
...STROKE_STYLE_PROPERTIES
|
|
13
|
+
];
|
|
10
14
|
const RADIUS_OPTIONS = ["id", "type", "domain", "range", "zero", "nice", "reverse", "clamp"];
|
|
11
15
|
|
|
12
16
|
function createMeasuredPlot(program, args, { operation, defaultId, mapping }) {
|
|
@@ -31,7 +35,11 @@ function createMeasuredPlot(program, args, { operation, defaultId, mapping }) {
|
|
|
31
35
|
...(aggregate === "sum" ? { field: args.value } : {}),
|
|
32
36
|
...(radiusScale === undefined ? {} : { scale: radiusScale }) });
|
|
33
37
|
if (color !== undefined) next = next.encodeColor({ ...color, target: id });
|
|
34
|
-
|
|
38
|
+
next = applyFacadeGuides(next, guides, id, args.guides ?? {});
|
|
39
|
+
return next._withMarkConfig(id, {
|
|
40
|
+
...next.markConfigs[id],
|
|
41
|
+
compositionRole: "rose"
|
|
42
|
+
});
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
export const createRosePlot = action({ op: "createRosePlot", description: "Create equal-angle sectors with area proportional to category count or sum." }, function (args = {}) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
2
3
|
import { isPlainObject } from "../../core/immutable.js";
|
|
3
4
|
import { validateNonEmptyString, validateNonNegativeFinite, validateOptionObject } from
|
|
4
5
|
"../../core/validation.js";
|
|
@@ -19,12 +20,15 @@ import {
|
|
|
19
20
|
|
|
20
21
|
const RUG_OPTIONS = Object.freeze(["id", "data", "coordinate", "x", "y", "edge", "tick", "guides"]);
|
|
21
22
|
const MEASURE_OPTIONS = Object.freeze(["field", "fieldType", "temporalUnit", "scale"]);
|
|
22
|
-
const TICK_OPTIONS = Object.freeze([
|
|
23
|
+
const TICK_OPTIONS = Object.freeze([
|
|
24
|
+
"length", "stroke", "strokeWidth", "opacity", ...STROKE_STYLE_PROPERTIES
|
|
25
|
+
]);
|
|
23
26
|
const STRIP_OPTIONS = Object.freeze([
|
|
24
27
|
"id", "data", "coordinate", "x", "y", "color", "size", "shape", "point", "jitter", "guides"
|
|
25
28
|
]);
|
|
26
29
|
const POINT_OPTIONS = Object.freeze([
|
|
27
|
-
"radius", "shape", "fill", "opacity", "stroke", "strokeWidth"
|
|
30
|
+
"radius", "shape", "fill", "opacity", "stroke", "strokeWidth",
|
|
31
|
+
...STROKE_STYLE_PROPERTIES
|
|
28
32
|
]);
|
|
29
33
|
const JITTER_OPTIONS = Object.freeze(["maxOffset", "seed", "key"]);
|
|
30
34
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
2
|
import { validateNonNegativeFinite } from "../../core/validation.js";
|
|
3
|
+
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
3
4
|
import {
|
|
4
5
|
applyFacadeGuides,
|
|
5
6
|
normalizeAppearance,
|
|
@@ -18,7 +19,8 @@ const OPTIONS = Object.freeze([
|
|
|
18
19
|
"point", "guides"
|
|
19
20
|
]);
|
|
20
21
|
const POINT_OPTIONS = Object.freeze([
|
|
21
|
-
"shape", "fill", "opacity", "stroke", "strokeWidth", "radius"
|
|
22
|
+
"shape", "fill", "opacity", "stroke", "strokeWidth", "radius",
|
|
23
|
+
...STROKE_STYLE_PROPERTIES
|
|
22
24
|
]);
|
|
23
25
|
|
|
24
26
|
export const createScatterPlot = action(
|
|
@@ -12,6 +12,7 @@ import { namespaceGraphicSnapshot } from "../../materialization/compositionSnaps
|
|
|
12
12
|
import { materializeCompositionGraphics } from
|
|
13
13
|
"../../materialization/composition.js";
|
|
14
14
|
import { materializeFacetGraphics } from "../../materialization/facets.js";
|
|
15
|
+
import { replayInheritedThemeFrames } from "../theme/composition.js";
|
|
15
16
|
|
|
16
17
|
const CONCAT_OPTIONS = Object.freeze([
|
|
17
18
|
"id", "programs", "gap", "align", "padding"
|
|
@@ -245,10 +246,14 @@ const replaceCompositionChild = action(
|
|
|
245
246
|
if (!(args.program instanceof CoreChartProgram)) {
|
|
246
247
|
throw new TypeError("replaceCompositionChild program must be a ChartProgram.");
|
|
247
248
|
}
|
|
248
|
-
|
|
249
|
+
const replacement = replayInheritedThemeFrames(
|
|
250
|
+
args.program,
|
|
251
|
+
this.materializationConfigs.theme
|
|
252
|
+
);
|
|
253
|
+
childDescriptor({ id: target, program: replacement });
|
|
249
254
|
const children = freezeOwned({
|
|
250
255
|
...this.children,
|
|
251
|
-
[target]:
|
|
256
|
+
[target]: replacement
|
|
252
257
|
});
|
|
253
258
|
return applyCompositionState(this, {
|
|
254
259
|
children,
|
|
@@ -283,7 +288,11 @@ const insertCompositionChild = action(
|
|
|
283
288
|
if (args.before !== undefined && args.after !== undefined) {
|
|
284
289
|
throw new Error("insertCompositionChild before and after are mutually exclusive.");
|
|
285
290
|
}
|
|
286
|
-
|
|
291
|
+
const inserted = replayInheritedThemeFrames(
|
|
292
|
+
args.program,
|
|
293
|
+
this.materializationConfigs.theme
|
|
294
|
+
);
|
|
295
|
+
childDescriptor({ id, program: inserted });
|
|
287
296
|
const order = [...this.compositionSpec.children];
|
|
288
297
|
if (args.before !== undefined || args.after !== undefined) {
|
|
289
298
|
const property = args.before !== undefined ? "before" : "after";
|
|
@@ -295,7 +304,7 @@ const insertCompositionChild = action(
|
|
|
295
304
|
order.push(id);
|
|
296
305
|
}
|
|
297
306
|
return applyCompositionState(this, {
|
|
298
|
-
children: freezeOwned({ ...this.children, [id]:
|
|
307
|
+
children: freezeOwned({ ...this.children, [id]: inserted }),
|
|
299
308
|
compositionSpec: { ...this.compositionSpec, children: order }
|
|
300
309
|
}, [id]);
|
|
301
310
|
}
|