ggaction 0.0.13 → 0.0.16
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 +146 -0
- package/README.md +41 -12
- package/knowledge/action-cards.json +1 -1
- package/knowledge/intent-taxonomy.json +1 -1
- package/knowledge/mcp-resources.json +1 -1
- package/knowledge/task-packet.schema.json +1 -1
- package/knowledge/task-resolver.js +1 -1
- package/package.json +39 -7
- package/src/BasicChartProgram.js +3 -1
- package/src/ChartProgram.js +2 -0
- package/src/accessibility.js +157 -0
- package/src/actions/basic.js +2 -2
- package/src/actions/boxPlots/components.js +20 -12
- package/src/actions/boxPlots/create.js +4 -5
- package/src/actions/boxPlots/edit.js +34 -9
- package/src/actions/boxPlots/materialize.js +12 -4
- package/src/actions/boxPlots/options.js +48 -16
- package/src/actions/canvas/actions.js +3 -3
- package/src/actions/canvas/fitting.js +1 -1
- package/src/actions/categoryOrder/index.js +21 -12
- package/src/actions/charts/area.js +6 -2
- package/src/actions/charts/bar.js +3 -2
- package/src/actions/charts/beeswarm.js +1 -1
- package/src/actions/charts/density.js +7 -3
- package/src/actions/charts/ecdf.js +6 -3
- package/src/actions/charts/endpoints.js +29 -7
- package/src/actions/charts/heatmap.js +3 -2
- package/src/actions/charts/histogram.js +5 -4
- package/src/actions/charts/horizon.js +4 -2
- package/src/actions/charts/interval-regression.js +7 -4
- package/src/actions/charts/line.js +4 -2
- package/src/actions/charts/parallel.js +9 -3
- package/src/actions/charts/pie.js +11 -3
- package/src/actions/charts/polar.js +17 -6
- package/src/actions/charts/radar.js +9 -3
- package/src/actions/charts/radial.js +12 -4
- package/src/actions/charts/raincloud.js +2 -2
- package/src/actions/charts/rug-strip.js +8 -4
- package/src/actions/charts/scatter.js +4 -2
- package/src/actions/composition/actions.js +29 -24
- package/src/actions/coordinates/actions.js +2 -2
- package/src/actions/coordinates/edit.js +76 -0
- package/src/actions/data/basicBin2d.js +4 -5
- package/src/actions/data/bin.js +3 -3
- package/src/actions/data/bin2d.js +63 -193
- package/src/actions/data/bin2dMaterialize.js +4 -5
- package/src/actions/data/box.js +4 -4
- package/src/actions/data/complete.js +26 -0
- package/src/actions/data/computed.js +4 -4
- package/src/actions/data/create.js +7 -14
- package/src/actions/data/density.js +15 -23
- package/src/actions/data/derived.js +57 -31
- package/src/actions/data/ecdf.js +2 -2
- package/src/actions/data/edit.js +551 -0
- package/src/actions/data/filter.js +28 -22
- package/src/actions/data/fold.js +2 -2
- package/src/actions/data/gradientProfile.js +2 -2
- package/src/actions/data/horizon.js +2 -2
- package/src/actions/data/impute.js +26 -0
- package/src/actions/data/index.js +62 -47
- package/src/actions/data/interval.js +2 -2
- package/src/actions/data/intervalEdit.js +26 -18
- package/src/actions/data/normalize.js +27 -0
- package/src/actions/data/regression.js +21 -27
- package/src/actions/data/revise.js +48 -0
- package/src/actions/data/revisionBindings.js +125 -0
- package/src/actions/data/shared.js +20 -4
- package/src/actions/data/stack.js +2 -2
- package/src/actions/data/summary.js +3 -3
- package/src/actions/data/timeUnit.js +6 -3
- package/src/actions/data/window.js +3 -3
- package/src/actions/encodings/angle.js +1 -1
- package/src/actions/encodings/appearance.js +4 -4
- package/src/actions/encodings/barWidth.js +1 -1
- package/src/actions/encodings/channels.js +415 -0
- package/src/actions/encodings/color/index.js +3 -2
- package/src/actions/encodings/density.js +7 -4
- package/src/actions/encodings/histogram.js +4 -3
- package/src/actions/encodings/horizon.js +6 -8
- package/src/actions/encodings/index.js +4 -0
- package/src/actions/encodings/offset.js +22 -15
- package/src/actions/encodings/parallel.js +4 -5
- package/src/actions/encodings/pathOrder.js +6 -11
- package/src/actions/encodings/position/apply.js +53 -7
- package/src/actions/encodings/position/index.js +14 -6
- package/src/actions/encodings/position/policies/bar.js +9 -0
- package/src/actions/encodings/position/resolve.js +24 -7
- package/src/actions/encodings/ranged.js +5 -5
- package/src/actions/encodings/remove.js +13 -9
- package/src/actions/encodings/ruleAppearance.js +2 -24
- package/src/actions/encodings/seriesLayout.js +2 -1
- package/src/actions/encodings/shared.js +82 -14
- package/src/actions/encodings/stroke.js +226 -0
- package/src/actions/encodings/strokeDash.js +2 -2
- package/src/actions/encodings/text.js +1 -1
- package/src/actions/errorBands/create.js +34 -20
- package/src/actions/errorBands/edit.js +34 -137
- package/src/actions/errorBars/create.js +43 -20
- package/src/actions/errorBars/edit.js +29 -125
- package/src/actions/facets/actions.js +267 -73
- package/src/actions/facets/derive.js +99 -28
- package/src/actions/facets/guides.js +4 -5
- package/src/actions/facets/replay.js +4 -5
- package/src/actions/gradientPlots/components.js +15 -8
- package/src/actions/gradientPlots/create.js +4 -5
- package/src/actions/gradientPlots/edit.js +18 -9
- package/src/actions/gradientPlots/materialize.js +5 -3
- package/src/actions/gradientPlots/options.js +10 -2
- package/src/actions/gradientPlots/rebind.js +4 -5
- package/src/actions/guides/applicability.js +8 -2
- package/src/actions/guides/axes/axes.js +23 -4
- package/src/actions/guides/axes/axis.js +2 -2
- package/src/actions/guides/axes/edit.js +2 -2
- package/src/actions/guides/axes/labels.js +67 -21
- package/src/actions/guides/axes/lines.js +15 -9
- package/src/actions/guides/axes/parallel/lifecycle.js +13 -13
- package/src/actions/guides/axes/parallel/resolve.js +6 -2
- package/src/actions/guides/axes/parallel.js +5 -5
- package/src/actions/guides/axes/remove.js +4 -4
- package/src/actions/guides/axes/tickGroups.js +6 -5
- package/src/actions/guides/axes/ticks.js +19 -6
- package/src/actions/guides/axes/titles.js +21 -13
- package/src/actions/guides/grids/grid.js +18 -29
- package/src/actions/guides/grids/resolve.js +7 -2
- package/src/actions/guides/guides.js +20 -4
- package/src/actions/guides/legends/blocks.js +426 -0
- package/src/actions/guides/legends/categorical/actions.js +138 -52
- package/src/actions/guides/legends/categorical/components.js +55 -45
- package/src/actions/guides/legends/categorical/index.js +37 -33
- package/src/actions/guides/legends/categorical/layout.js +98 -16
- 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 +104 -52
- package/src/actions/guides/legends/continuous/common.js +76 -20
- package/src/actions/guides/legends/continuous/gradient.js +95 -158
- package/src/actions/guides/legends/continuous/index.js +2 -0
- package/src/actions/guides/legends/continuous/interval.js +21 -16
- package/src/actions/guides/legends/continuous/opacity.js +37 -83
- package/src/actions/guides/legends/continuous/stroke.js +225 -0
- package/src/actions/guides/legends/creation.js +14 -1
- package/src/actions/guides/legends/edit.js +159 -60
- package/src/actions/guides/legends/focused.js +5 -5
- package/src/actions/guides/legends/index.js +2 -0
- package/src/actions/guides/legends/lane.js +59 -24
- package/src/actions/guides/legends/lifecycle.js +19 -8
- package/src/actions/guides/legends/remove.js +17 -8
- package/src/actions/guides/legends/sampling.js +140 -0
- package/src/actions/guides/legends/size.js +100 -108
- package/src/actions/guides/legends/strokeWidth.js +38 -92
- 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 +8 -8
- package/src/actions/guides/polar/axes/labels.js +29 -10
- package/src/actions/guides/polar/axes/lines.js +19 -19
- package/src/actions/guides/polar/axes/shared.js +16 -0
- package/src/actions/guides/polar/axes/ticks.js +10 -16
- package/src/actions/guides/polar/axes/titles.js +6 -6
- package/src/actions/guides/polar/grids.js +12 -14
- package/src/actions/guides/polar/resolve.js +12 -8
- package/src/actions/index.js +16 -3
- package/src/actions/intervals/revision.js +126 -0
- package/src/actions/marks/arc/actions.js +80 -22
- package/src/actions/marks/area/actions.js +38 -13
- package/src/actions/marks/area/materialize.js +17 -1
- package/src/actions/marks/bar/create.js +12 -3
- package/src/actions/marks/bar/edit.js +21 -4
- package/src/actions/marks/bar/materialize.js +34 -40
- package/src/actions/marks/index.js +10 -1
- package/src/actions/marks/line/actions.js +40 -17
- package/src/actions/marks/line/materialize.js +29 -10
- package/src/actions/marks/point/create.js +9 -3
- package/src/actions/marks/point/edit.js +19 -7
- package/src/actions/marks/point/jitter.js +6 -8
- package/src/actions/marks/point/materialize.js +48 -22
- package/src/actions/marks/point/packing.js +6 -8
- package/src/actions/marks/rect/actions.js +36 -15
- package/src/actions/marks/references.js +602 -33
- package/src/actions/marks/remove.js +67 -41
- package/src/actions/marks/rule/actions.js +51 -14
- package/src/actions/marks/shared.js +1 -1
- package/src/actions/marks/text/actions.js +79 -14
- package/src/actions/marks/text/index.js +4 -0
- package/src/actions/marks/text/layout.js +157 -17
- package/src/actions/marks/text/removal.js +173 -0
- package/src/actions/marks/text/selection.js +72 -0
- package/src/actions/marks/tick/actions.js +25 -8
- package/src/actions/primitives/createGraphics.js +5 -4
- package/src/actions/primitives/editGraphics.js +31 -4
- package/src/actions/primitives/graphicProperties.js +6 -0
- package/src/actions/primitives/semantic.js +11 -3
- package/src/actions/primitives/semanticAction.js +90 -14
- package/src/actions/primitives/semanticValidation/dataset.js +2 -4
- 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 +36 -25
- package/src/actions/regression/create.js +13 -6
- package/src/actions/regression/edit.js +24 -11
- package/src/actions/resources/index.js +7 -0
- package/src/actions/resources/remove.js +173 -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 +55 -23
- package/src/actions/scales/definitions.js +94 -40
- package/src/actions/scales/edit.js +67 -12
- package/src/actions/scales/editPolicy.js +81 -11
- package/src/actions/scales/index.js +6 -0
- package/src/actions/scales/materialize.js +5 -4
- 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/scales/quantitativeColor.js +4 -5
- package/src/actions/selection/actions.js +179 -66
- package/src/actions/selection/index.js +3 -0
- package/src/actions/textMetrics/index.js +56 -0
- package/src/actions/theme/actions.js +70 -15
- package/src/actions/theme/composition.js +238 -0
- package/src/actions/theme/index.js +9 -2
- package/src/actions/theme/reconcile.js +313 -121
- package/src/actions/theme/state.js +160 -0
- package/src/actions/titles/actions.js +8 -8
- package/src/actions/titles/resolve.js +3 -3
- package/src/actions/violinPlots/create.js +6 -3
- package/src/actions/violinPlots/edit.js +2 -1
- package/src/core/action.js +117 -35
- package/src/core/compositionState.js +6 -1
- package/src/core/diagnostics.js +16 -0
- package/src/core/extensionRegistry.js +27 -0
- package/src/core/font.js +18 -0
- package/src/core/identifiers.js +5 -4
- package/src/core/immutable.js +10 -3
- package/src/core/optionRequirements.js +8 -0
- package/src/core/programState.js +21 -1
- package/src/core/resourceReferences.js +341 -0
- package/src/core/textMetricProfile.js +28 -0
- package/src/core/textMetrics.js +24 -3
- package/src/core/validation.js +22 -10
- package/src/core/vocabulary.js +16 -3
- package/src/diagnostics.js +1 -0
- 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 +341 -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/scales/types.js +8 -0
- package/src/grammar/schemas/concreteGraphic.js +14 -2
- package/src/grammar/schemas/graphic.js +15 -0
- package/src/grammar/schemas/graphicBounds.js +190 -41
- 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 +351 -7
- package/src/layout/legend.js +4 -4
- package/src/layout/legendItems.js +6 -6
- package/src/layout/text.js +10 -9
- package/src/layout/title.js +9 -9
- 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 +9 -3
- package/src/materialization/facetGuides/preparation.js +13 -8
- package/src/materialization/facetHeaders.js +347 -0
- package/src/materialization/facets.js +15 -65
- package/src/materialization/guides/layout.js +3 -3
- 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/scaleGuideDependencies.js +10 -0
- 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 +20 -5
- 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/materialization/typography.js +31 -0
- package/src/mcp/cli.js +5 -3
- package/src/persistence/codec.js +65 -0
- package/src/persistence/validation.js +185 -0
- package/src/persistence.js +74 -0
- package/src/renderers/canvas/circle.js +2 -3
- package/src/renderers/canvas/index.js +5 -4
- 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/nativeBackend.js +10 -0
- package/src/renderers/options.js +13 -0
- package/src/renderers/pdf.js +25 -54
- package/src/renderers/png.js +22 -17
- package/src/renderers/svg.js +29 -14
- package/src/renderers/text.js +1 -11
- package/src/selectors/coordinates.js +3 -1
- package/src/selectors/datasets.js +38 -5
- package/src/selectors/layers.js +10 -4
- package/src/selectors/markOwners.js +46 -0
- package/src/selectors/scales.js +6 -4
- package/src/theme/defaults.js +103 -1
- package/src/version.js +2 -0
- package/types/accessibility.d.ts +37 -0
- package/types/basic.d.ts +10 -2
- package/types/diagnostics.d.ts +15 -0
- package/types/index.d.ts +90 -0
- package/types/pdf.d.ts +9 -0
- package/types/persistence.d.ts +7 -0
- package/types/png.d.ts +9 -0
- package/types/program.d.ts +944 -118
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { closedAction } from "../../core/action.js";
|
|
2
|
+
|
|
3
3
|
import { findSemanticScale } from "../../selectors/scales.js";
|
|
4
4
|
import { resolveFacadeData } from "../charts/shared.js";
|
|
5
5
|
import {
|
|
@@ -19,13 +19,12 @@ import {
|
|
|
19
19
|
resolveBoxSourceLayer
|
|
20
20
|
} from "./resolve.js";
|
|
21
21
|
|
|
22
|
-
export const createBoxPlot =
|
|
22
|
+
export const createBoxPlot = /* @__PURE__ */ closedAction(
|
|
23
23
|
{
|
|
24
24
|
op: "createBoxPlot",
|
|
25
25
|
description: "Create a Tukey box plot from categorical and quantitative positions."
|
|
26
|
-
},
|
|
26
|
+
}, BOX_PLOT_OPTIONS,
|
|
27
27
|
function (args = {}) {
|
|
28
|
-
validateKeys(args, BOX_PLOT_OPTIONS, "createBoxPlot");
|
|
29
28
|
const id = resolveBoxPlotId(this, args.id);
|
|
30
29
|
const source = resolveBoxSourceLayer(this, args.target, {
|
|
31
30
|
requiresInference: args.x === undefined || args.y === undefined
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { closedAction } from "../../core/action.js";
|
|
2
2
|
import { isPlainObject } from "../../core/immutable.js";
|
|
3
3
|
import { validateUserId } from "../../core/identifiers.js";
|
|
4
4
|
import { validateKeys } from "../../core/validation.js";
|
|
@@ -24,6 +24,8 @@ import {
|
|
|
24
24
|
resolveBoxWidth
|
|
25
25
|
} from "./options.js";
|
|
26
26
|
import { resolveBoxOrientation } from "./resolve.js";
|
|
27
|
+
import { requestedRectStyleDetails } from "../../grammar/roundedRect.js";
|
|
28
|
+
import { requestedStrokeDetails } from "../../grammar/strokeStyle.js";
|
|
27
29
|
|
|
28
30
|
const OPTIONS = Object.freeze([
|
|
29
31
|
"target", "data", "x", "y", "whisker", "width", "outliers", "box",
|
|
@@ -211,13 +213,12 @@ function updateBoxPositions(program, owner, current, candidate, {
|
|
|
211
213
|
return next;
|
|
212
214
|
}
|
|
213
215
|
|
|
214
|
-
export const editBoxPlot =
|
|
216
|
+
export const editBoxPlot = /* @__PURE__ */ closedAction(
|
|
215
217
|
{
|
|
216
218
|
op: "editBoxPlot",
|
|
217
219
|
description: "Revise one box plot and its owned components."
|
|
218
|
-
},
|
|
220
|
+
}, OPTIONS,
|
|
219
221
|
function (args = {}) {
|
|
220
|
-
validateKeys(args, OPTIONS, "editBoxPlot");
|
|
221
222
|
if (!OPTIONS.slice(1).some(key => Object.hasOwn(args, key))) {
|
|
222
223
|
throw new Error("editBoxPlot requires at least one box-plot option.");
|
|
223
224
|
}
|
|
@@ -252,6 +253,8 @@ export const editBoxPlot = action(
|
|
|
252
253
|
{ ...current.outlier, ...outlierPatch },
|
|
253
254
|
"editBoxPlot"
|
|
254
255
|
);
|
|
256
|
+
const boxStyleDetails = requestedRectStyleDetails(box, "Box body");
|
|
257
|
+
const medianStyleDetails = requestedStrokeDetails(median, "Box median");
|
|
255
258
|
if (Object.hasOwn(boxPatch, "fill") && owner.encoding?.color !== undefined) {
|
|
256
259
|
throw new Error(
|
|
257
260
|
"editBoxPlot box.fill cannot be combined with a color encoding."
|
|
@@ -333,6 +336,7 @@ export const editBoxPlot = action(
|
|
|
333
336
|
...next.markConfigs[current.whiskerId],
|
|
334
337
|
errorBar: {
|
|
335
338
|
...next.markConfigs[current.whiskerId].errorBar,
|
|
339
|
+
source: summaryRevision.id,
|
|
336
340
|
data: summaryRevision.id
|
|
337
341
|
}
|
|
338
342
|
});
|
|
@@ -360,7 +364,10 @@ export const editBoxPlot = action(
|
|
|
360
364
|
fill: box.fill,
|
|
361
365
|
opacity: box.opacity,
|
|
362
366
|
stroke: box.stroke,
|
|
363
|
-
strokeWidth: box.strokeWidth
|
|
367
|
+
strokeWidth: box.strokeWidth,
|
|
368
|
+
...(Object.keys(boxStyleDetails).length === 0
|
|
369
|
+
? {}
|
|
370
|
+
: { barAppearance: boxStyleDetails })
|
|
364
371
|
});
|
|
365
372
|
next = updateBoxPositions(next, owner, current, candidate, {
|
|
366
373
|
outlierDataId: outlierRevision?.id,
|
|
@@ -385,7 +392,8 @@ export const editBoxPlot = action(
|
|
|
385
392
|
measureScale: measure.scale,
|
|
386
393
|
shape: outlier.shape,
|
|
387
394
|
radius: outlier.radius,
|
|
388
|
-
opacity: outlier.opacity
|
|
395
|
+
opacity: outlier.opacity,
|
|
396
|
+
...requestedStrokeDetails(outlier, "Box outlier")
|
|
389
397
|
});
|
|
390
398
|
}
|
|
391
399
|
next = next
|
|
@@ -394,12 +402,19 @@ export const editBoxPlot = action(
|
|
|
394
402
|
target: current.medianId,
|
|
395
403
|
value: median.strokeWidth
|
|
396
404
|
});
|
|
405
|
+
if (Object.keys(medianStyleDetails).length > 0) {
|
|
406
|
+
next = next.editRuleMark({
|
|
407
|
+
target: current.medianId,
|
|
408
|
+
...medianStyleDetails
|
|
409
|
+
});
|
|
410
|
+
}
|
|
397
411
|
if (findLayer(next, current.outlierId) !== undefined) {
|
|
398
412
|
next = next
|
|
399
413
|
.editPointMark({
|
|
400
414
|
target: current.outlierId,
|
|
401
415
|
shape: outlier.shape,
|
|
402
|
-
opacity: outlier.opacity
|
|
416
|
+
opacity: outlier.opacity,
|
|
417
|
+
...requestedStrokeDetails(outlier, "Box outlier")
|
|
403
418
|
})
|
|
404
419
|
.encodeRadius({ target: current.outlierId, value: outlier.radius });
|
|
405
420
|
}
|
|
@@ -445,7 +460,10 @@ export const editBoxPlot = action(
|
|
|
445
460
|
fill: box.fill,
|
|
446
461
|
opacity: box.opacity,
|
|
447
462
|
stroke: box.stroke,
|
|
448
|
-
strokeWidth: box.strokeWidth
|
|
463
|
+
strokeWidth: box.strokeWidth,
|
|
464
|
+
...(Object.keys(boxStyleDetails).length === 0
|
|
465
|
+
? {}
|
|
466
|
+
: { barAppearance: boxStyleDetails })
|
|
449
467
|
});
|
|
450
468
|
|
|
451
469
|
if (changesBox) next = next.rematerializeBarMark({ id: owner.id });
|
|
@@ -456,13 +474,20 @@ export const editBoxPlot = action(
|
|
|
456
474
|
target: current.medianId,
|
|
457
475
|
value: median.strokeWidth
|
|
458
476
|
});
|
|
477
|
+
if (Object.keys(medianStyleDetails).length > 0) {
|
|
478
|
+
next = next.editRuleMark({
|
|
479
|
+
target: current.medianId,
|
|
480
|
+
...medianStyleDetails
|
|
481
|
+
});
|
|
482
|
+
}
|
|
459
483
|
}
|
|
460
484
|
if (findLayer(next, current.outlierId) !== undefined && changesOutlier) {
|
|
461
485
|
next = next
|
|
462
486
|
.editPointMark({
|
|
463
487
|
target: current.outlierId,
|
|
464
488
|
shape: outlier.shape,
|
|
465
|
-
opacity: outlier.opacity
|
|
489
|
+
opacity: outlier.opacity,
|
|
490
|
+
...requestedStrokeDetails(outlier, "Box outlier")
|
|
466
491
|
})
|
|
467
492
|
.encodeRadius({ target: current.outlierId, value: outlier.radius });
|
|
468
493
|
}
|
|
@@ -9,10 +9,12 @@ import {
|
|
|
9
9
|
import { findDataset } from "../../selectors/datasets.js";
|
|
10
10
|
import { findLayer } from "../../selectors/layers.js";
|
|
11
11
|
import { resolveBoxOrientation } from "./resolve.js";
|
|
12
|
+
import { requestedRectStyleDetails } from "../../grammar/roundedRect.js";
|
|
13
|
+
import { requestedStrokeDetails } from "../../grammar/strokeStyle.js";
|
|
12
14
|
import { resolvePlotGraphicPlacement } from
|
|
13
15
|
"../../materialization/graphicHierarchy.js";
|
|
14
16
|
|
|
15
|
-
export const materializeBoxPlot = action(
|
|
17
|
+
export const materializeBoxPlot = /* @__PURE__ */ action(
|
|
16
18
|
{
|
|
17
19
|
op: "materializeBoxPlot",
|
|
18
20
|
description: "Materialize a complete box-plot composite."
|
|
@@ -43,6 +45,7 @@ export const materializeBoxPlot = action(
|
|
|
43
45
|
const whiskerId = `${ownerId}Whisker`;
|
|
44
46
|
const medianId = `${ownerId}Median`;
|
|
45
47
|
const outlierId = `${ownerId}Outliers`;
|
|
48
|
+
const boxStyleDetails = requestedRectStyleDetails(config.box, "Box body");
|
|
46
49
|
let next = this._withMarkConfig(ownerId, {
|
|
47
50
|
...this.markConfigs[ownerId],
|
|
48
51
|
boxPlot: {
|
|
@@ -61,7 +64,10 @@ export const materializeBoxPlot = action(
|
|
|
61
64
|
fill: config.box.fill,
|
|
62
65
|
opacity: config.box.opacity,
|
|
63
66
|
stroke: config.box.stroke,
|
|
64
|
-
strokeWidth: config.box.strokeWidth
|
|
67
|
+
strokeWidth: config.box.strokeWidth,
|
|
68
|
+
...(Object.keys(boxStyleDetails).length === 0
|
|
69
|
+
? {}
|
|
70
|
+
: { barAppearance: boxStyleDetails })
|
|
65
71
|
}).createBoxSummaryData({
|
|
66
72
|
id: summaryId,
|
|
67
73
|
source,
|
|
@@ -165,7 +171,8 @@ export const materializeBoxPlot = action(
|
|
|
165
171
|
categoryScale: category.scale,
|
|
166
172
|
measureScale: measure.scale,
|
|
167
173
|
stroke: config.median.stroke,
|
|
168
|
-
strokeWidth: config.median.strokeWidth
|
|
174
|
+
strokeWidth: config.median.strokeWidth,
|
|
175
|
+
...requestedStrokeDetails(config.median, "Box median")
|
|
169
176
|
});
|
|
170
177
|
if (hasOutliers) {
|
|
171
178
|
next = next.createBoxOutliers({
|
|
@@ -180,7 +187,8 @@ export const materializeBoxPlot = action(
|
|
|
180
187
|
measureScale: measure.scale,
|
|
181
188
|
shape: config.outlier.shape,
|
|
182
189
|
radius: config.outlier.radius,
|
|
183
|
-
opacity: config.outlier.opacity
|
|
190
|
+
opacity: config.outlier.opacity,
|
|
191
|
+
...requestedStrokeDetails(config.outlier, "Box outlier")
|
|
184
192
|
});
|
|
185
193
|
}
|
|
186
194
|
next = next._withMarkConfig(ownerId, {
|
|
@@ -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
|
}
|
|
@@ -67,7 +67,7 @@ function resolveCanvasState(program, args) {
|
|
|
67
67
|
return cloneAndFreeze(state);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export const editCanvas = action(
|
|
70
|
+
export const editCanvas = /* @__PURE__ */ action(
|
|
71
71
|
{
|
|
72
72
|
op: "editCanvas",
|
|
73
73
|
description: "Edit canvas properties and authoring bounds."
|
|
@@ -104,7 +104,7 @@ export const editCanvas = action(
|
|
|
104
104
|
}
|
|
105
105
|
);
|
|
106
106
|
|
|
107
|
-
export const createCanvas = action(
|
|
107
|
+
export const createCanvas = /* @__PURE__ */ action(
|
|
108
108
|
{
|
|
109
109
|
op: "createCanvas",
|
|
110
110
|
description: "Create and configure the chart canvas."
|
|
@@ -147,7 +147,7 @@ export const createCanvas = action(
|
|
|
147
147
|
}
|
|
148
148
|
);
|
|
149
149
|
|
|
150
|
-
export const createBasicCanvas = action(
|
|
150
|
+
export const createBasicCanvas = /* @__PURE__ */ action(
|
|
151
151
|
{
|
|
152
152
|
op: "createCanvas",
|
|
153
153
|
description: "Create and configure the chart canvas."
|
|
@@ -159,7 +159,7 @@ function layoutSignature(program) {
|
|
|
159
159
|
return hash.toString(16).padStart(16, "0");
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
export const fitCanvas = action(
|
|
162
|
+
export const fitCanvas = /* @__PURE__ */ action(
|
|
163
163
|
{
|
|
164
164
|
op: "fitCanvas",
|
|
165
165
|
description: "Fit Canvas margins around existing layout resources."
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { closedAction } from "../../core/action.js";
|
|
2
2
|
import { validateUserId } from "../../core/identifiers.js";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { findDataset } from "../../selectors/datasets.js";
|
|
5
5
|
import { resolveEligibleLayer } from "../../selectors/layers.js";
|
|
6
6
|
import { findScaleConsumers } from "../scales/consumers/index.js";
|
|
@@ -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,22 +59,29 @@ 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
|
}
|
|
70
81
|
|
|
71
|
-
export const orderCategories =
|
|
72
|
-
{ op: "orderCategories", description: "Assign semantic order to a categorical position." },
|
|
82
|
+
export const orderCategories = /* @__PURE__ */ closedAction(
|
|
83
|
+
{ op: "orderCategories", description: "Assign semantic order to a categorical position." }, ORDER_OPTIONS,
|
|
73
84
|
function (args = {}) {
|
|
74
|
-
validateKeys(args, ORDER_OPTIONS, "orderCategories");
|
|
75
85
|
const { layer, encoding, dataset } = resolveAssignment(this, args, "orderCategories");
|
|
76
86
|
const order = normalizeCategoryOrder(args);
|
|
77
87
|
resolveCategoryOrder(dataset.values, encoding.field, order);
|
|
@@ -83,10 +93,9 @@ export const orderCategories = action(
|
|
|
83
93
|
}
|
|
84
94
|
);
|
|
85
95
|
|
|
86
|
-
export const removeCategoryOrder =
|
|
87
|
-
{ op: "removeCategoryOrder", description: "Restore automatic category order." },
|
|
96
|
+
export const removeCategoryOrder = /* @__PURE__ */ closedAction(
|
|
97
|
+
{ op: "removeCategoryOrder", description: "Restore automatic category order." }, REMOVE_OPTIONS,
|
|
88
98
|
function (args = {}) {
|
|
89
|
-
validateKeys(args, REMOVE_OPTIONS, "removeCategoryOrder");
|
|
90
99
|
const { layer, encoding } = resolveAssignment(
|
|
91
100
|
this,
|
|
92
101
|
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 { normalizeGroupFields } from "../../grammar/pathSeries.js";
|
|
3
4
|
import { normalizeAreaBound, validateAreaEndpointPair } from "../../grammar/areaEndpoints.js";
|
|
4
5
|
import {
|
|
@@ -10,7 +11,7 @@ import {
|
|
|
10
11
|
const OPERATION = "createAreaPlot";
|
|
11
12
|
const OPTIONS = ["id", "data", "coordinate", "x", "y", "valueChannel", "baseline", "groupBy", "layout", "missing", "color", "area", "guides"];
|
|
12
13
|
|
|
13
|
-
export const createAreaPlot = action({ op: OPERATION, description: "Create a simple, ranged, or stacked Cartesian area plot." }, function (args = {}) {
|
|
14
|
+
export const createAreaPlot = /* @__PURE__ */ action({ op: OPERATION, description: "Create a simple, ranged, or stacked Cartesian area plot." }, function (args = {}) {
|
|
14
15
|
validateFacadeOptions(args, OPTIONS, OPERATION);
|
|
15
16
|
for (const [key, value] of Object.entries(args)) if (value === null) throw new TypeError(`${OPERATION} ${key} cannot be null.`);
|
|
16
17
|
const id = resolveFacadeId(this, args.id, { defaultId: "areaPlot", operation: OPERATION });
|
|
@@ -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,10 +20,10 @@ 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
|
-
export const createBarPlot = action(
|
|
26
|
+
export const createBarPlot = /* @__PURE__ */ action(
|
|
26
27
|
{
|
|
27
28
|
op: "createBarPlot",
|
|
28
29
|
description: "Create a Cartesian bar plot from existing chart data."
|
|
@@ -29,7 +29,7 @@ function normalizePacking(value, operation) {
|
|
|
29
29
|
return { ...packing };
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export const createBeeswarmPlot = action(
|
|
32
|
+
export const createBeeswarmPlot = /* @__PURE__ */ action(
|
|
33
33
|
{
|
|
34
34
|
op: "createBeeswarmPlot",
|
|
35
35
|
description: "Create a Point plot packed within categorical slots."
|
|
@@ -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,10 +8,13 @@ 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
|
-
export const createDensityPlot = action({
|
|
17
|
+
export const createDensityPlot = /* @__PURE__ */ action({
|
|
14
18
|
op: OPERATION, description: "Create a baseline kernel-density area plot with optional explicit groups."
|
|
15
19
|
}, function (args = {}) {
|
|
16
20
|
validateFacadeOptions(args, OPTIONS, OPERATION);
|
|
@@ -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",
|
|
@@ -69,7 +72,7 @@ function resolveOwner(program, requested) {
|
|
|
69
72
|
throw new Error("editECDFPlot target is ambiguous; provide target.");
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
export const createECDFPlot = action(
|
|
75
|
+
export const createECDFPlot = /* @__PURE__ */ action(
|
|
73
76
|
{
|
|
74
77
|
op: "createECDFPlot",
|
|
75
78
|
description: "Create a right-continuous empirical cumulative distribution plot."
|
|
@@ -155,7 +158,7 @@ export const createECDFPlot = action(
|
|
|
155
158
|
}
|
|
156
159
|
);
|
|
157
160
|
|
|
158
|
-
export const editECDFPlot = action(
|
|
161
|
+
export const editECDFPlot = /* @__PURE__ */ action(
|
|
159
162
|
{
|
|
160
163
|
op: "editECDFPlot",
|
|
161
164
|
description: "Atomically revise an ECDF plot's source or statistical roles."
|
|
@@ -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));
|
|
@@ -232,7 +254,7 @@ function finish(program, { id, source, data, kind, roles, summary, orientation,
|
|
|
232
254
|
});
|
|
233
255
|
}
|
|
234
256
|
|
|
235
|
-
export const createDotPlot = action(
|
|
257
|
+
export const createDotPlot = /* @__PURE__ */ action(
|
|
236
258
|
{ op: "createDotPlot", description: "Create raw or explicitly summarized categorical dots." },
|
|
237
259
|
function (args = {}) {
|
|
238
260
|
const operation = "createDotPlot";
|
|
@@ -262,7 +284,7 @@ export const createDotPlot = action(
|
|
|
262
284
|
}
|
|
263
285
|
);
|
|
264
286
|
|
|
265
|
-
export const createLollipopPlot = action(
|
|
287
|
+
export const createLollipopPlot = /* @__PURE__ */ action(
|
|
266
288
|
{ op: "createLollipopPlot", description: "Create categorical value points with baseline stems." },
|
|
267
289
|
function (args = {}) {
|
|
268
290
|
const operation = "createLollipopPlot";
|
|
@@ -305,7 +327,7 @@ export const createLollipopPlot = action(
|
|
|
305
327
|
}
|
|
306
328
|
);
|
|
307
329
|
|
|
308
|
-
export const createDumbbellPlot = action(
|
|
330
|
+
export const createDumbbellPlot = /* @__PURE__ */ action(
|
|
309
331
|
{ op: "createDumbbellPlot", description: "Create two categorical endpoints joined by a connector." },
|
|
310
332
|
function (args = {}) {
|
|
311
333
|
const operation = "createDumbbellPlot";
|
|
@@ -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, {
|
|
@@ -427,7 +449,7 @@ function reviseRequestedScales(program, ownerId, revised, changes) {
|
|
|
427
449
|
return next;
|
|
428
450
|
}
|
|
429
451
|
|
|
430
|
-
export const editEndpointPlot = action(
|
|
452
|
+
export const editEndpointPlot = /* @__PURE__ */ action(
|
|
431
453
|
{ op: "editEndpointPlot", description: "Atomically revise an endpoint plot's semantic roles." },
|
|
432
454
|
function (args = {}) {
|
|
433
455
|
validateFacadeOptions(args, EDIT_OPTIONS, "editEndpointPlot");
|
|
@@ -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"
|
|
@@ -135,7 +136,7 @@ function binnedGuides(guides, xTitle, yTitle) {
|
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
138
|
|
|
138
|
-
export const createHeatmap = action(
|
|
139
|
+
export const createHeatmap = /* @__PURE__ */ action(
|
|
139
140
|
{
|
|
140
141
|
op: OPERATION,
|
|
141
142
|
description: "Create a pre-gridded or rectangularly binned heatmap."
|
|
@@ -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,16 +14,16 @@ 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
|
-
export const createHistogram = action(
|
|
26
|
+
export const createHistogram = /* @__PURE__ */ action(
|
|
26
27
|
{
|
|
27
28
|
op: "createHistogram",
|
|
28
29
|
description: "Create a binned count histogram from existing chart data."
|