ggaction 0.0.16 → 0.0.18
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 +66 -0
- package/README.md +3 -2
- package/knowledge/action-card.schema.json +1 -1
- package/knowledge/action-cards.json +1 -1
- package/knowledge/intent-taxonomy.json +1 -1
- package/knowledge/mcp-resources.json +1 -1
- package/knowledge/task-resolver.js +1 -1
- package/package.json +10 -4
- package/src/BasicChartProgram.js +1 -1
- package/src/accessibility.js +3 -2
- package/src/actions/boxPlots/create.js +14 -4
- package/src/actions/boxPlots/edit.js +39 -33
- package/src/actions/boxPlots/materialize.js +7 -3
- package/src/actions/boxPlots/options.js +37 -11
- package/src/actions/canvas/actions.js +70 -95
- package/src/actions/canvas/fitting.js +16 -1
- package/src/actions/canvas/index.js +3 -0
- package/src/actions/canvas/plotBorder.js +28 -0
- package/src/actions/charts/area.js +2 -2
- package/src/actions/charts/bar.js +34 -7
- package/src/actions/charts/ecdf.js +4 -18
- package/src/actions/charts/endpoints.js +4 -18
- package/src/actions/charts/heatmap.js +4 -4
- package/src/actions/charts/index.js +2 -0
- package/src/actions/charts/interval-regression.js +2 -2
- package/src/actions/charts/line.js +1 -1
- package/src/actions/charts/pie.js +3 -47
- package/src/actions/charts/radial.js +34 -12
- package/src/actions/charts/scatter.js +16 -2
- package/src/actions/charts/shared.js +2 -2
- package/src/actions/charts/text.js +35 -0
- package/src/actions/composition/actions.js +6 -2
- package/src/actions/data/bin.js +1 -1
- package/src/actions/data/box.js +2 -1
- package/src/actions/data/create.js +18 -5
- package/src/actions/data/density.js +1 -1
- package/src/actions/data/derived.js +15 -1
- package/src/actions/data/edit.js +20 -7
- package/src/actions/data/filter.js +15 -4
- package/src/actions/data/index.js +3 -0
- package/src/actions/data/interval.js +2 -0
- package/src/actions/data/regression.js +6 -2
- package/src/actions/data/revise.js +37 -5
- package/src/actions/data/shared.js +33 -4
- package/src/actions/data/sort.js +21 -0
- package/src/actions/data/stack.js +3 -1
- package/src/actions/data/summary.js +1 -1
- package/src/actions/encodings/angle.js +4 -1
- package/src/actions/encodings/appearance.js +43 -31
- package/src/actions/encodings/barWidth.js +36 -11
- package/src/actions/encodings/channels.js +0 -1
- package/src/actions/encodings/color/continuous.js +5 -2
- package/src/actions/encodings/color/index.js +5 -2
- package/src/actions/encodings/color/policy.js +10 -3
- package/src/actions/encodings/density/resolve.js +1 -6
- package/src/actions/encodings/offset.js +4 -1
- package/src/actions/encodings/position/policies/arc.js +12 -10
- package/src/actions/encodings/position/policies/area.js +3 -3
- package/src/actions/encodings/position/policies/bar.js +15 -6
- package/src/actions/encodings/position/policies/line.js +17 -6
- package/src/actions/encodings/position/resolve.js +9 -3
- package/src/actions/encodings/ranged.js +23 -1
- package/src/actions/encodings/remove.js +3 -2
- package/src/actions/encodings/ruleAppearance.js +4 -1
- package/src/actions/encodings/seriesLayout.js +1 -0
- package/src/actions/encodings/stroke.js +4 -1
- package/src/actions/encodings/strokeDash.js +6 -1
- package/src/actions/encodings/text.js +12 -4
- package/src/actions/errorBands/create.js +2 -2
- package/src/actions/errorBands/edit.js +2 -1
- package/src/actions/facets/actions.js +158 -240
- package/src/actions/gradientPlots/resolve.js +2 -17
- package/src/actions/guides/applicability.js +1 -1
- package/src/actions/guides/axes/axis.js +16 -4
- package/src/actions/guides/axes/edit.js +4 -4
- package/src/actions/guides/axes/labels.js +120 -46
- package/src/actions/guides/axes/lines.js +6 -5
- package/src/actions/guides/axes/parallel/lifecycle.js +1 -1
- package/src/actions/guides/axes/parallel/policy.js +8 -7
- package/src/actions/guides/axes/remove.js +3 -2
- package/src/actions/guides/axes/tickGroups.js +5 -2
- package/src/actions/guides/axes/ticks.js +6 -3
- package/src/actions/guides/axes/titles.js +71 -26
- package/src/actions/guides/basic.js +2 -0
- package/src/actions/guides/facadeLegend.js +10 -2
- package/src/actions/guides/grids/grid.js +7 -1
- package/src/actions/guides/grids/resolve.js +59 -12
- package/src/actions/guides/legends/blocks.js +3 -1
- package/src/actions/guides/legends/categorical/actions.js +70 -17
- package/src/actions/guides/legends/categorical/components.js +12 -8
- package/src/actions/guides/legends/categorical/index.js +6 -0
- package/src/actions/guides/legends/categorical/layout.js +37 -8
- package/src/actions/guides/legends/categorical/options.js +31 -20
- package/src/actions/guides/legends/categorical/resolve.js +2 -2
- package/src/actions/guides/legends/categorical/symbols.js +18 -12
- package/src/actions/guides/legends/categorical/validation.js +1 -6
- package/src/actions/guides/legends/continuous/colorSymbols.js +1 -0
- package/src/actions/guides/legends/continuous/common.js +1 -447
- package/src/actions/guides/legends/continuous/gradient.js +47 -34
- package/src/actions/guides/legends/continuous/interval.js +4 -4
- package/src/actions/guides/legends/continuous/opacity.js +19 -12
- package/src/actions/guides/legends/edit.js +1 -604
- package/src/actions/guides/legends/focused.js +2 -2
- package/src/actions/guides/legends/group.js +1 -0
- package/src/actions/guides/legends/lane.js +1 -516
- package/src/actions/guides/legends/remove.js +3 -0
- package/src/actions/guides/legends/sampling.js +1 -1
- package/src/actions/guides/legends/size.js +51 -43
- package/src/actions/guides/legends/strokeWidth.js +11 -29
- package/src/actions/guides/legends/target.js +3 -3
- package/src/actions/guides/legends/transition.js +21 -7
- package/src/actions/guides/polar/axes/labels.js +4 -2
- package/src/actions/guides/polar/axes/titles.js +7 -5
- package/src/actions/guides/polar/resolve.js +6 -14
- package/src/actions/index.js +16 -16
- package/src/actions/marks/arc/actions.js +3 -10
- package/src/actions/marks/area/actions.js +8 -5
- package/src/actions/marks/area/materialize.js +8 -9
- package/src/actions/marks/bar/create.js +17 -4
- package/src/actions/marks/bar/edit.js +18 -7
- package/src/actions/marks/bar/materialize.js +9 -6
- package/src/actions/marks/line/actions.js +11 -4
- package/src/actions/marks/line/materialize.js +9 -5
- package/src/actions/marks/point/create.js +8 -1
- package/src/actions/marks/point/edit.js +13 -6
- package/src/actions/marks/point/materialize.js +4 -2
- package/src/actions/marks/rect/actions.js +26 -11
- package/src/actions/marks/remove.js +2 -0
- package/src/actions/marks/rule/actions.js +31 -12
- package/src/actions/marks/text/actions.js +42 -11
- package/src/actions/marks/text/layout.js +3 -0
- package/src/actions/marks/tick/actions.js +23 -8
- package/src/actions/primitives/semanticAction.js +37 -3
- package/src/actions/primitives/semanticValidation/dataset.js +13 -1
- package/src/actions/primitives/semanticValidation/layer.js +26 -2
- package/src/actions/primitives/semanticValidation/scale.js +6 -0
- package/src/actions/regression/create.js +26 -5
- package/src/actions/regression/edit.js +50 -15
- package/src/actions/regression/follow.js +22 -0
- package/src/actions/regression/resolve.js +2 -6
- package/src/actions/scales/channels.js +20 -15
- package/src/actions/scales/consumers/common.js +2 -1
- package/src/actions/scales/consumers/families.js +16 -5
- package/src/actions/scales/create.js +10 -4
- package/src/actions/scales/definitions.js +1 -425
- package/src/actions/scales/edit.js +3 -3
- package/src/actions/scales/editPolicy.js +9 -3
- package/src/actions/scales/materialize.js +1 -1
- package/src/actions/scales/parallel.js +1 -1
- package/src/actions/scales/patch.js +1 -1
- package/src/actions/scales/preview.js +49 -2
- package/src/actions/scales/quantitativeColor.js +3 -3
- package/src/actions/selection/actions.js +1 -13
- package/src/actions/theme/reconcile.js +83 -27
- package/src/actions/theme/state.js +12 -0
- package/src/actions/titles/actions.js +5 -18
- package/src/actions/titles/resolve.js +41 -19
- package/src/actions/violinPlots/edit.js +3 -20
- package/src/core/action.js +3 -2
- package/src/core/compositionState.js +4 -1
- package/src/core/font.js +9 -2
- package/src/core/optionRequirements.js +1 -0
- package/src/core/programState.js +5 -1
- package/src/core/resourceReferences.js +3 -0
- package/src/core/textMetricProfile.js +3 -2
- package/src/core/textMetrics.js +41 -4
- package/src/core/validation.js +26 -0
- package/src/core/vocabulary.js +4 -0
- package/src/grammar/aggregate.js +4 -18
- package/src/grammar/arcs.js +1 -386
- package/src/grammar/areaPaint.js +10 -0
- package/src/grammar/areaSeries.js +18 -10
- package/src/grammar/bars/geometry.js +30 -3
- package/src/grammar/bars/policy.js +12 -1
- package/src/grammar/bin.js +41 -22
- package/src/grammar/bin2d.js +1 -6
- package/src/grammar/boxPlot.js +56 -9
- package/src/grammar/categoryOrder.js +1 -6
- package/src/grammar/complete.js +15 -19
- package/src/grammar/computed.js +92 -25
- package/src/grammar/curveCommands.js +29 -16
- package/src/grammar/datasetSchema.js +382 -0
- package/src/grammar/density.js +53 -5
- package/src/grammar/displayLabels.js +28 -0
- package/src/grammar/ecdf.js +2 -9
- package/src/grammar/facets/dependencies.js +6 -2
- package/src/grammar/facets/guides.js +5 -0
- package/src/grammar/facets/index.js +2 -5
- package/src/grammar/filter.js +133 -39
- package/src/grammar/fold.js +2 -12
- package/src/grammar/gradientProfile.js +1 -6
- package/src/grammar/impute.js +21 -48
- package/src/grammar/interval.js +34 -10
- package/src/grammar/itemMissing.js +59 -0
- package/src/grammar/legendGradient.js +18 -0
- package/src/grammar/legendGroups.js +1 -0
- package/src/grammar/legendTitleStyle.js +22 -0
- package/src/grammar/lineSeries.js +32 -17
- package/src/grammar/markLabels.js +5 -2
- package/src/grammar/normalize.js +4 -54
- package/src/grammar/numeric.js +1 -290
- package/src/grammar/parallelCoordinates.js +1 -6
- package/src/grammar/parseTime.js +41 -0
- package/src/grammar/pathCommands.js +11 -4
- package/src/grammar/polar.js +1 -184
- package/src/grammar/positionCompatibility.js +3 -3
- package/src/grammar/regression/derive.js +63 -16
- package/src/grammar/regression/index.js +1 -0
- package/src/grammar/regression/models.js +116 -59
- package/src/grammar/regression/parameters.js +69 -6
- package/src/grammar/roundedRect.js +42 -54
- package/src/grammar/scales/appearance.js +1 -206
- package/src/grammar/scales/color.js +1 -382
- package/src/grammar/scales/colorConsumers.js +5 -2
- package/src/grammar/scales/definition.js +1 -190
- package/src/grammar/scales/discretized.js +1 -195
- package/src/grammar/scales/size.js +1 -456
- package/src/grammar/scales/temporal.js +2 -13
- package/src/grammar/scales/transformed.js +1 -383
- package/src/grammar/scales/types.js +1 -1
- package/src/grammar/scales/validation.js +1 -66
- package/src/grammar/schemas/concreteGraphic.js +11 -0
- package/src/grammar/schemas/graphic.js +3 -0
- package/src/grammar/schemas/semanticPath.js +5 -3
- package/src/grammar/sort.js +88 -0
- package/src/grammar/stack.js +2 -10
- package/src/grammar/statisticalReference.js +1 -6
- package/src/grammar/summary.js +120 -45
- package/src/grammar/text.js +19 -0
- package/src/grammar/timeUnit.js +16 -7
- package/src/grammar/transformKeys.js +47 -0
- package/src/grammar/transformTopology.js +1 -0
- package/src/grammar/transforms.js +25 -12
- package/src/grammar/valueFormat.js +17 -5
- package/src/grammar/weightedStatistics.js +1 -6
- package/src/grammar/window.js +4 -58
- package/src/inspection.js +495 -0
- package/src/inspectionDescriptors.js +3 -0
- package/src/layout/canvas.js +1 -110
- package/src/layout/facets.js +1 -244
- package/src/layout/labels.js +1 -0
- package/src/layout/legend.js +13 -0
- package/src/layout/legendGroup.js +1 -0
- package/src/layout/legendItems.js +59 -15
- package/src/layout/legendLane.js +1 -441
- package/src/layout/legendText.js +1 -0
- package/src/layout/title.js +35 -13
- package/src/materialization/bars/aggregate.js +11 -5
- package/src/materialization/bars/histogram.js +4 -1
- package/src/materialization/bars/ranged.js +19 -6
- package/src/materialization/bars/resolve.js +26 -3
- package/src/materialization/coordinateBounds.js +8 -0
- package/src/materialization/dependencies.js +4 -44
- package/src/materialization/facetGuides/layout.js +1 -0
- package/src/materialization/facetGuides/placement.js +19 -8
- package/src/materialization/facetGuides/preparation.js +15 -7
- package/src/materialization/facetHeaders.js +1 -347
- package/src/materialization/facets.js +1 -185
- package/src/materialization/graphicHierarchy.js +1 -1
- package/src/materialization/guides/layout.js +1 -57
- package/src/materialization/guides/resources.js +1 -123
- package/src/materialization/layout.js +53 -0
- package/src/materialization/legendGroups.js +1 -0
- package/src/materialization/legendText.js +1 -0
- package/src/materialization/legends.js +1 -1
- package/src/materialization/marks/capabilities.js +5 -6
- package/src/materialization/rect.js +1 -1
- package/src/materialization/revisionIdentity.js +19 -0
- package/src/materialization/scaleGuideDependencies.js +1 -1
- package/src/materialization/scales/map.js +3 -0
- package/src/materialization/scales/policies/arc.js +8 -7
- package/src/materialization/scales/policies/bar.js +19 -7
- package/src/materialization/scales/policies/series.js +2 -1
- package/src/materialization/scales/resolve.js +72 -7
- package/src/materialization/selection/items/arc.js +1 -1
- package/src/materialization/selection/items/bar.js +7 -6
- package/src/materialization/selection/items/path.js +7 -6
- package/src/materialization/selection/items/rect.js +2 -2
- package/src/materialization/text.js +17 -6
- package/src/materialization/textLines.js +15 -0
- package/src/persistence/codec.js +37 -6
- package/src/persistence/validation.js +47 -0
- package/src/persistence.js +94 -8
- package/src/renderers/canvas/circle.js +6 -3
- package/src/renderers/canvas/fill.js +7 -1
- package/src/renderers/canvas/index.js +2 -1
- package/src/renderers/canvas/line.js +1 -0
- package/src/renderers/canvas/path.js +1 -1
- package/src/renderers/canvas/rect.js +11 -8
- package/src/renderers/canvas/stroke.js +2 -1
- package/src/renderers/canvas/text.js +5 -3
- package/src/renderers/svg.js +4 -1
- package/src/selectors/layers.js +19 -0
- package/src/theme/defaults.js +8 -2
- package/src/version.js +1 -1
- package/types/basic.d.ts +1 -0
- package/types/index.d.ts +7 -0
- package/types/inspection.d.ts +17 -0
- package/types/program.d.ts +494 -112
|
@@ -135,7 +135,7 @@ export const createIntervalPlot = /* @__PURE__ */ action(
|
|
|
135
135
|
|
|
136
136
|
const REGRESSION_OPTIONS = Object.freeze([
|
|
137
137
|
"id", "data", "coordinate", "x", "y", "color", "size", "shape", "point",
|
|
138
|
-
"groupBy", "method", "degree", "span", "confidenceMethod", "level", "confidence",
|
|
138
|
+
"groupBy", "method", "degree", "span", "robustIterations", "confidenceMethod", "level", "confidence",
|
|
139
139
|
"interval", "band", "line", "guides"
|
|
140
140
|
]);
|
|
141
141
|
|
|
@@ -163,7 +163,7 @@ export const createRegressionPlot = /* @__PURE__ */ action(
|
|
|
163
163
|
guides: false
|
|
164
164
|
});
|
|
165
165
|
const regression = Object.fromEntries([
|
|
166
|
-
"groupBy", "method", "degree", "span", "confidenceMethod", "level",
|
|
166
|
+
"groupBy", "method", "degree", "span", "robustIterations", "confidenceMethod", "level",
|
|
167
167
|
"confidence", "interval", "band", "line"
|
|
168
168
|
].filter(key => Object.hasOwn(args, key)).map(key => [key, args[key]]));
|
|
169
169
|
next = next.createRegression({ target: id, ...regression });
|
|
@@ -20,7 +20,7 @@ const OPTIONS = Object.freeze([
|
|
|
20
20
|
"strokeDash", "line", "guides"
|
|
21
21
|
]);
|
|
22
22
|
const LINE_OPTIONS = Object.freeze([
|
|
23
|
-
"strokeWidth", "curve", "stroke", "opacity", "closed",
|
|
23
|
+
"strokeWidth", "curve", "tension", "stroke", "opacity", "closed",
|
|
24
24
|
...STROKE_STYLE_PROPERTIES
|
|
25
25
|
]);
|
|
26
26
|
|
|
@@ -1,52 +1,8 @@
|
|
|
1
1
|
import { action } from "../../core/action.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
applyFacadeGuides, normalizeAppearance, normalizeCategoricalColor, normalizeCategoricalGuides,
|
|
5
|
-
normalizeArcCategory, normalizeCategoryAggregate, omitUndefinedOptions,
|
|
6
|
-
resolveFacadeData, resolveFacadeId, validateFacadeOptions
|
|
7
|
-
} from "./shared.js";
|
|
8
|
-
|
|
9
|
-
const OPERATION = "createPiePlot";
|
|
10
|
-
const OPTIONS = ["id", "data", "coordinate", "category", "value", "aggregate", "color", "arc", "guides"];
|
|
11
|
-
const ARC_OPTIONS = [
|
|
12
|
-
"innerRadius", "padAngle", "fill", "opacity", "stroke", "strokeWidth",
|
|
13
|
-
...STROKE_STYLE_PROPERTIES
|
|
14
|
-
];
|
|
15
|
-
function guideOptions(value, color) {
|
|
16
|
-
const guides = normalizeCategoricalGuides(value, OPERATION, color);
|
|
17
|
-
if (guides === false) return false;
|
|
18
|
-
for (const key of ["axes", "grid"]) {
|
|
19
|
-
if (guides[key] !== undefined && guides[key] !== false) {
|
|
20
|
-
throw new TypeError(`${OPERATION} guides.${key} only accepts false.`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return { ...guides, axes: false, grid: false };
|
|
24
|
-
}
|
|
2
|
+
import { createArcPlot } from "./radial.js";
|
|
25
3
|
|
|
26
4
|
export const createPiePlot = /* @__PURE__ */ action({
|
|
27
|
-
op:
|
|
5
|
+
op: "createPiePlot", description: "Create a categorical count or weighted-sum pie or donut plot."
|
|
28
6
|
}, function (args = {}) {
|
|
29
|
-
|
|
30
|
-
const id = resolveFacadeId(this, args.id, { defaultId: "piePlot", operation: OPERATION });
|
|
31
|
-
const data = resolveFacadeData(this, args.data, OPERATION);
|
|
32
|
-
const category = normalizeArcCategory(args.category, OPERATION);
|
|
33
|
-
const aggregate = normalizeCategoryAggregate(args, OPERATION);
|
|
34
|
-
const arc = omitUndefinedOptions(normalizeAppearance(args.arc, ARC_OPTIONS, `${OPERATION} arc`));
|
|
35
|
-
const color = args.color === false ? undefined
|
|
36
|
-
: normalizeCategoricalColor(args.color === undefined ? category.field : args.color, `${OPERATION} color`);
|
|
37
|
-
if (color !== undefined && arc.fill !== undefined) {
|
|
38
|
-
throw new Error(`${OPERATION} arc.fill cannot be combined with color; use color:false.`);
|
|
39
|
-
}
|
|
40
|
-
const guides = guideOptions(args.guides, color);
|
|
41
|
-
let next = this.createArcMark({ id, data, ...arc }).encodeTheta({
|
|
42
|
-
...category, target: id, aggregate,
|
|
43
|
-
...(args.coordinate === undefined ? {} : { coordinate: args.coordinate }),
|
|
44
|
-
...(aggregate === "sum" ? { weight: args.value } : {})
|
|
45
|
-
});
|
|
46
|
-
if (color !== undefined) next = next.encodeColor({ ...color, target: id });
|
|
47
|
-
next = applyFacadeGuides(next, guides, id, args.guides ?? {});
|
|
48
|
-
return next._withMarkConfig(id, {
|
|
49
|
-
...next.markConfigs[id],
|
|
50
|
-
compositionRole: "pie"
|
|
51
|
-
});
|
|
7
|
+
return createArcPlot(this, args, { operation: "createPiePlot", defaultId: "piePlot" });
|
|
52
8
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { findSemanticScale } from "../../selectors/scales.js";
|
|
1
2
|
import { action } from "../../core/action.js";
|
|
2
3
|
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
3
4
|
import {
|
|
@@ -6,21 +7,22 @@ import {
|
|
|
6
7
|
resolveFacadeData, resolveFacadeId, validateFacadeOptions
|
|
7
8
|
} from "./shared.js";
|
|
8
9
|
|
|
9
|
-
const OPTIONS = ["id", "data", "coordinate", "category", "value", "aggregate", "
|
|
10
|
+
const OPTIONS = ["id", "data", "coordinate", "category", "value", "aggregate", "color", "arc", "guides"];
|
|
10
11
|
const ARC_OPTIONS = [
|
|
11
12
|
"innerRadius", "padAngle", "fill", "opacity", "stroke", "strokeWidth",
|
|
12
13
|
...STROKE_STYLE_PROPERTIES
|
|
13
14
|
];
|
|
14
15
|
const RADIUS_OPTIONS = ["id", "type", "domain", "range", "zero", "nice", "reverse", "clamp"];
|
|
15
16
|
|
|
16
|
-
function
|
|
17
|
-
|
|
17
|
+
export function createArcPlot(program, args, { operation, defaultId, mapping }) {
|
|
18
|
+
const measured = mapping !== undefined;
|
|
19
|
+
validateFacadeOptions(args, [...OPTIONS, measured ? "radiusScale" : "radius"], operation);
|
|
18
20
|
const id = resolveFacadeId(program, args.id, { defaultId, operation });
|
|
19
21
|
const data = resolveFacadeData(program, args.data, operation);
|
|
20
22
|
const category = normalizeArcCategory(args.category, operation);
|
|
21
23
|
const aggregate = normalizeCategoryAggregate(args, operation);
|
|
22
24
|
const arc = omitUndefinedOptions(normalizeAppearance(args.arc, ARC_OPTIONS, `${operation} arc`));
|
|
23
|
-
if (arc.padAngle !== undefined && arc.padAngle !== 0) throw new Error(`${operation} requires padAngle 0.`);
|
|
25
|
+
if (measured && arc.padAngle !== undefined && arc.padAngle !== 0) throw new Error(`${operation} requires padAngle 0.`);
|
|
24
26
|
const radiusScale = args.radiusScale === undefined ? undefined
|
|
25
27
|
: omitUndefinedOptions(normalizeAppearance(args.radiusScale, RADIUS_OPTIONS, `${operation} radiusScale`));
|
|
26
28
|
const color = args.color === false ? undefined
|
|
@@ -28,23 +30,43 @@ function createMeasuredPlot(program, args, { operation, defaultId, mapping }) {
|
|
|
28
30
|
if (color !== undefined && arc.fill !== undefined) {
|
|
29
31
|
throw new Error(`${operation} arc.fill cannot be combined with color; use color:false.`);
|
|
30
32
|
}
|
|
31
|
-
|
|
33
|
+
let guides = normalizeCategoricalGuides(args.guides, operation, color);
|
|
34
|
+
if (!measured && guides !== false) {
|
|
35
|
+
for (const key of ["axes", "grid"]) {
|
|
36
|
+
if (guides[key] !== undefined && guides[key] !== false) {
|
|
37
|
+
throw new TypeError(`${operation} guides.${key} only accepts false.`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
guides = { ...guides, axes: false, grid: false };
|
|
41
|
+
}
|
|
32
42
|
let next = program.createArcMark({ id, data, ...arc }).encodeTheta({
|
|
33
|
-
...category, target: id, ...(args.coordinate === undefined ? {} : { coordinate: args.coordinate })
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
...category, target: id, ...(args.coordinate === undefined ? {} : { coordinate: args.coordinate }),
|
|
44
|
+
...(!measured ? { aggregate, ...(aggregate === "sum" ? { weight: args.value } : {}) } : {})
|
|
45
|
+
});
|
|
46
|
+
if (measured) {
|
|
47
|
+
next = next.encodeR({ target: id, aggregate, mapping,
|
|
48
|
+
...(aggregate === "sum" ? { field: args.value } : {}),
|
|
49
|
+
...(radiusScale === undefined ? {} : { scale: radiusScale }) });
|
|
50
|
+
} else if (args.radius !== undefined) {
|
|
51
|
+
const radius = typeof args.radius === "string" ? { field: args.radius }
|
|
52
|
+
: normalizeAppearance(args.radius, ["field", "aggregate", "scale"], `${operation} radius`);
|
|
53
|
+
const scale = radius.scale ?? {};
|
|
54
|
+
next = next.encodeR({ target: id, ...omitUndefinedOptions(radius), scale: {
|
|
55
|
+
...(scale.type !== "log" && findSemanticScale(next, scale.id ?? "radius") === undefined ? { zero: true } : {}),
|
|
56
|
+
...scale
|
|
57
|
+
} });
|
|
58
|
+
}
|
|
37
59
|
if (color !== undefined) next = next.encodeColor({ ...color, target: id });
|
|
38
60
|
next = applyFacadeGuides(next, guides, id, args.guides ?? {});
|
|
39
61
|
return next._withMarkConfig(id, {
|
|
40
62
|
...next.markConfigs[id],
|
|
41
|
-
compositionRole: "rose"
|
|
63
|
+
compositionRole: measured ? "rose" : "pie"
|
|
42
64
|
});
|
|
43
65
|
}
|
|
44
66
|
|
|
45
67
|
export const createRosePlot = /* @__PURE__ */ action({ op: "createRosePlot", description: "Create equal-angle sectors with area proportional to category count or sum." }, function (args = {}) {
|
|
46
|
-
return
|
|
68
|
+
return createArcPlot(this, args, { operation: "createRosePlot", defaultId: "rosePlot", mapping: "area" });
|
|
47
69
|
});
|
|
48
70
|
export const createRadialBarPlot = /* @__PURE__ */ action({ op: "createRadialBarPlot", description: "Create equal-angle sectors with radial length proportional to category count or sum." }, function (args = {}) {
|
|
49
|
-
return
|
|
71
|
+
return createArcPlot(this, args, { operation: "createRadialBarPlot", defaultId: "radialBarPlot", mapping: "radius-length" });
|
|
50
72
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { encodeStroke } from "../encodings/stroke.js";
|
|
1
2
|
import { action } from "../../core/action.js";
|
|
2
3
|
import { validateNonNegativeFinite } from "../../core/validation.js";
|
|
3
4
|
import { STROKE_STYLE_PROPERTIES } from "../../grammar/strokeStyle.js";
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
} from "./shared.js";
|
|
16
17
|
|
|
17
18
|
const OPTIONS = Object.freeze([
|
|
18
|
-
"id", "data", "coordinate", "x", "y", "color", "size", "shape",
|
|
19
|
+
"id", "data", "coordinate", "x", "y", "color", "stroke", "size", "shape",
|
|
19
20
|
"point", "guides"
|
|
20
21
|
]);
|
|
21
22
|
const POINT_OPTIONS = Object.freeze([
|
|
@@ -43,6 +44,13 @@ export const createScatterPlot = /* @__PURE__ */ action(
|
|
|
43
44
|
const x = normalizeFieldEncoding(args.x, "createScatterPlot x");
|
|
44
45
|
const y = normalizeFieldEncoding(args.y, "createScatterPlot y");
|
|
45
46
|
const color = normalizeEncoding(args.color, "createScatterPlot color");
|
|
47
|
+
const stroke = normalizeEncoding(args.stroke, "createScatterPlot stroke");
|
|
48
|
+
if (stroke !== undefined) {
|
|
49
|
+
if (typeof stroke.field !== "string" || stroke.field.length === 0 || Object.hasOwn(stroke, "value")) {
|
|
50
|
+
throw new TypeError("createScatterPlot stroke requires a field; constant stroke belongs in point.");
|
|
51
|
+
}
|
|
52
|
+
if (Object.hasOwn(point, "stroke")) throw new Error("createScatterPlot stroke conflicts with point.stroke.");
|
|
53
|
+
}
|
|
46
54
|
const size = normalizeEncoding(args.size, "createScatterPlot size");
|
|
47
55
|
const shape = normalizeEncoding(args.shape, "createScatterPlot shape");
|
|
48
56
|
const guides = normalizeGuides(args.guides, "createScatterPlot");
|
|
@@ -51,12 +59,18 @@ export const createScatterPlot = /* @__PURE__ */ action(
|
|
|
51
59
|
if (size !== undefined) throw new Error("createScatterPlot point radius conflicts with size.");
|
|
52
60
|
}
|
|
53
61
|
|
|
62
|
+
const initialPoint = { ...point };
|
|
63
|
+
if (stroke !== undefined) delete initialPoint.strokeWidth;
|
|
54
64
|
let next = this
|
|
55
|
-
.createPointMark({ id, data, ...
|
|
65
|
+
.createPointMark({ id, data, ...initialPoint })
|
|
56
66
|
.encodeX(positionArgs(x, { target: id, coordinate: args.coordinate }))
|
|
57
67
|
.encodeY(positionArgs(y, { target: id, coordinate: args.coordinate }));
|
|
58
68
|
if (radius !== undefined) next = next.encodePointRadius({ target: id, value: radius });
|
|
59
69
|
if (color !== undefined) next = next.encodeColor(targetArgs(color, id));
|
|
70
|
+
if (stroke !== undefined) {
|
|
71
|
+
next = encodeStroke.call(next, targetArgs(stroke, id));
|
|
72
|
+
if (Object.hasOwn(point, "strokeWidth")) next = next.editPointMark({ target: id, strokeWidth: point.strokeWidth });
|
|
73
|
+
}
|
|
60
74
|
if (size !== undefined) next = next.encodeSize(targetArgs(size, id));
|
|
61
75
|
if (shape !== undefined) next = next.encodeShape(targetArgs(shape, id));
|
|
62
76
|
return applyFacadeGuides(next, guides, id);
|
|
@@ -191,9 +191,9 @@ export function normalizeArcCategory(value, operation) {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
export function normalizeCategoryAggregate(args, operation) {
|
|
194
|
-
const aggregate = args.aggregate === undefined ? "count" : args.aggregate;
|
|
194
|
+
const aggregate = args.aggregate === undefined ? args.value === undefined ? "count" : "sum" : args.aggregate;
|
|
195
195
|
if (!["count", "sum"].includes(aggregate) || (aggregate === "sum") !== (args.value !== undefined)) {
|
|
196
|
-
throw new Error(`${operation} requires count without value or
|
|
196
|
+
throw new Error(`${operation} requires count without value or sum with value.`);
|
|
197
197
|
}
|
|
198
198
|
if (args.value !== undefined) validateNonEmptyString(args.value, `${operation} value`);
|
|
199
199
|
return aggregate;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { action } from "../../core/action.js";
|
|
2
|
+
import { TEXT_MARK_STYLE_OPTIONS } from "../../grammar/text.js";
|
|
3
|
+
import {
|
|
4
|
+
applyFacadeGuides, normalizeAppearance, normalizeEncoding, normalizeFieldEncoding,
|
|
5
|
+
normalizeGuides, positionArgs, resolveFacadeData, resolveFacadeId, targetArgs,
|
|
6
|
+
validateFacadeOptions
|
|
7
|
+
} from "./shared.js";
|
|
8
|
+
|
|
9
|
+
const OPTIONS = Object.freeze(["id", "data", "coordinate", "x", "y", "text", "color", "style", "guides"]);
|
|
10
|
+
const STYLE_OPTIONS = Object.freeze(["missing", ...TEXT_MARK_STYLE_OPTIONS.filter(key => key !== "inheritColor")]);
|
|
11
|
+
|
|
12
|
+
export const createTextPlot = /* @__PURE__ */ action({
|
|
13
|
+
op: "createTextPlot", description: "Create a Cartesian text plot from existing chart data."
|
|
14
|
+
}, function (args = {}) {
|
|
15
|
+
validateFacadeOptions(args, OPTIONS, "createTextPlot");
|
|
16
|
+
const id = resolveFacadeId(this, args.id, { defaultId: "textPlot", operation: "createTextPlot" });
|
|
17
|
+
const data = resolveFacadeData(this, args.data, "createTextPlot");
|
|
18
|
+
const x = normalizeFieldEncoding(args.x, "createTextPlot x");
|
|
19
|
+
const y = normalizeFieldEncoding(args.y, "createTextPlot y");
|
|
20
|
+
const text = normalizeEncoding(args.text, "createTextPlot text");
|
|
21
|
+
if (text === undefined) throw new Error("createTextPlot requires text.");
|
|
22
|
+
const color = normalizeEncoding(args.color, "createTextPlot color");
|
|
23
|
+
const style = normalizeAppearance(args.style, STYLE_OPTIONS, "createTextPlot style");
|
|
24
|
+
const guides = normalizeGuides(args.guides, "createTextPlot");
|
|
25
|
+
const apply = program => {
|
|
26
|
+
let next = program.createTextMark({ id, data, ...style })
|
|
27
|
+
.encodeX(positionArgs(x, { target: id, coordinate: args.coordinate }))
|
|
28
|
+
.encodeY(positionArgs(y, { target: id, coordinate: args.coordinate }))
|
|
29
|
+
.encodeText(targetArgs(text, id));
|
|
30
|
+
if (color !== undefined) next = next.encodeColor(targetArgs(color, id));
|
|
31
|
+
return applyFacadeGuides(next, guides, id);
|
|
32
|
+
};
|
|
33
|
+
apply(this);
|
|
34
|
+
return apply(this);
|
|
35
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveGraphicBounds } from "../../layout/canvas.js";
|
|
1
2
|
import { inheritTextMetrics } from "../textMetrics/index.js";
|
|
2
3
|
import { action, closedAction } from "../../core/action.js";
|
|
3
4
|
import { ChartProgram as CoreChartProgram } from "../../core/ChartProgram.js";
|
|
@@ -19,7 +20,7 @@ const CONCAT_OPTIONS = Object.freeze([
|
|
|
19
20
|
"id", "programs", "gap", "align", "padding"
|
|
20
21
|
]);
|
|
21
22
|
const LAYOUT_EDIT_OPTIONS = Object.freeze([
|
|
22
|
-
"columns", "gap", "align", "padding"
|
|
23
|
+
"columns", "gap", "spacing", "align", "padding"
|
|
23
24
|
]);
|
|
24
25
|
const REPLACEMENT_OPTIONS = Object.freeze(["target", "program"]);
|
|
25
26
|
const INSERTION_OPTIONS = Object.freeze(["id", "program", "before", "after"]);
|
|
@@ -179,6 +180,7 @@ const editCompositionLayout = /* @__PURE__ */ closedAction(
|
|
|
179
180
|
"editCompositionLayout columns is available only on a facet composition."
|
|
180
181
|
);
|
|
181
182
|
}
|
|
183
|
+
if (current.type !== "facet" && Object.hasOwn(args, "spacing")) throw new Error("Plot spacing requires a facet composition.");
|
|
182
184
|
const padding = Object.hasOwn(args, "padding")
|
|
183
185
|
? normalizeCompositionPadding(args.padding, current.padding)
|
|
184
186
|
: current.padding;
|
|
@@ -188,6 +190,8 @@ const editCompositionLayout = /* @__PURE__ */ closedAction(
|
|
|
188
190
|
(current.facet.grid?.cells ?? []).map(cell => [cell.id, cell])
|
|
189
191
|
);
|
|
190
192
|
layout = resolveFacetLayout({
|
|
193
|
+
spacing: option(args, "spacing", current.spacing),
|
|
194
|
+
plots: current.children.map(id => ({ id, ...resolveGraphicBounds(this.children[id]) })),
|
|
191
195
|
children: current.children.map((id, index) => ({
|
|
192
196
|
...childDescriptor({ id, program: this.children[id] }),
|
|
193
197
|
value: current.facet.values[index],
|
|
@@ -218,7 +222,7 @@ const editCompositionLayout = /* @__PURE__ */ closedAction(
|
|
|
218
222
|
children: this.children,
|
|
219
223
|
compositionSpec: {
|
|
220
224
|
...current,
|
|
221
|
-
...(current.type === "facet" ? { columns: layout.columns } : {}),
|
|
225
|
+
...(current.type === "facet" ? { columns: layout.columns, ...(layout.spacing !== undefined ? { spacing: layout.spacing } : current.spacing !== undefined ? { spacing: "canvas" } : {}) } : {}),
|
|
222
226
|
gap: layout.gap,
|
|
223
227
|
align: layout.align,
|
|
224
228
|
padding: layout.padding
|
package/src/actions/data/bin.js
CHANGED
|
@@ -7,7 +7,7 @@ import { derivedCreator, derivedMaterializer } from "./shared.js";
|
|
|
7
7
|
|
|
8
8
|
const OPTIONS = Object.freeze([
|
|
9
9
|
"id", "source", "field", "maxBins", "step", "boundaries", "extent",
|
|
10
|
-
"nice", "zero", "includeEmpty", "members", "as", "weight"
|
|
10
|
+
"nice", "zero", "includeEmpty", "members", "as", "weight", "missing"
|
|
11
11
|
]);
|
|
12
12
|
|
|
13
13
|
export const materializeBinData = /* @__PURE__ */ derivedMaterializer(
|
package/src/actions/data/box.js
CHANGED
|
@@ -2,7 +2,7 @@ import { BOX_FIELDS, deriveBoxData, normalizeBoxTransform } from "../../grammar/
|
|
|
2
2
|
import { derivedCreator, derivedMaterializer } from "./shared.js";
|
|
3
3
|
|
|
4
4
|
const OPTIONS = Object.freeze([
|
|
5
|
-
"id", "source", "category", "field", "whisker", "factor", "as"
|
|
5
|
+
"id", "source", "category", "field", "whisker", "factor", "as", "summary"
|
|
6
6
|
]);
|
|
7
7
|
|
|
8
8
|
function materializer(type, op, select) {
|
|
@@ -28,6 +28,7 @@ function creator(type, op, materialize) {
|
|
|
28
28
|
type,
|
|
29
29
|
category: args.category,
|
|
30
30
|
field: args.field,
|
|
31
|
+
...(args.summary === undefined ? {} : { summary: args.summary }),
|
|
31
32
|
...(args.whisker === undefined ? {} : { whisker: args.whisker }),
|
|
32
33
|
...(args.factor === undefined ? {} : { factor: args.factor }),
|
|
33
34
|
as: args.as ?? BOX_FIELDS
|
|
@@ -2,8 +2,13 @@ import { closedAction } from "../../core/action.js";
|
|
|
2
2
|
import { resolveOptionalUserId } from "../../core/identifiers.js";
|
|
3
3
|
import { validateDataRows } from "../../core/validation.js";
|
|
4
4
|
import { hasDataset, hasDatasetOwner } from "../../selectors/index.js";
|
|
5
|
+
import {
|
|
6
|
+
inferDatasetSchema,
|
|
7
|
+
normalizeSourceSchema,
|
|
8
|
+
validateRowsAgainstSchema
|
|
9
|
+
} from "../../grammar/datasetSchema.js";
|
|
5
10
|
|
|
6
|
-
const OPTIONS = Object.freeze(["id", "values"]);
|
|
11
|
+
const OPTIONS = Object.freeze(["id", "values", "schema"]);
|
|
7
12
|
|
|
8
13
|
export const createData = /* @__PURE__ */ closedAction(
|
|
9
14
|
{ op: "createData", description: "Create an immutable named dataset." }, OPTIONS,
|
|
@@ -15,12 +20,20 @@ export const createData = /* @__PURE__ */ closedAction(
|
|
|
15
20
|
ambiguous: this.semanticSpec.datasets.length > 0
|
|
16
21
|
});
|
|
17
22
|
validateDataRows(args.values, "createData");
|
|
23
|
+
const schema = args.schema === undefined
|
|
24
|
+
? inferDatasetSchema(args.values)
|
|
25
|
+
: normalizeSourceSchema(args.schema);
|
|
26
|
+
validateRowsAgainstSchema(args.values, schema, "createData");
|
|
18
27
|
if (hasDataset(this, id) || hasDatasetOwner(this, id)) {
|
|
19
28
|
throw new Error(`Dataset "${id}" already exists.`);
|
|
20
29
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
// Keep the historical one-primitive trace for inferred sources. The
|
|
31
|
+
// semantic primitive owns deterministic inference so a dataset never
|
|
32
|
+
// exists between actions without its schema.
|
|
33
|
+
return args.schema === undefined
|
|
34
|
+
? this.editSemantic({ property: `dataset[${id}].values`, value: args.values })
|
|
35
|
+
: this
|
|
36
|
+
.editSemantic({ property: `dataset[${id}].schema`, value: schema })
|
|
37
|
+
.editSemantic({ property: `dataset[${id}].values`, value: args.values });
|
|
25
38
|
}
|
|
26
39
|
);
|
|
@@ -6,7 +6,7 @@ import { derivedCreator, derivedMaterializer } from "./shared.js";
|
|
|
6
6
|
|
|
7
7
|
const OPTIONS = Object.freeze([
|
|
8
8
|
"id", "source", "field", "groupBy", "bandwidth", "extent", "steps",
|
|
9
|
-
"kernel", "normalization", "as", "weight"
|
|
9
|
+
"kernel", "normalization", "as", "weight", "missing"
|
|
10
10
|
]);
|
|
11
11
|
const CATEGORICAL_OPTIONS = Object.freeze([...OPTIONS, "placement"]);
|
|
12
12
|
|
|
@@ -11,6 +11,10 @@ import { requireLayer } from "../../selectors/layers.js";
|
|
|
11
11
|
import { applyLayerDataRematerialization } from
|
|
12
12
|
"../../materialization/dependencies.js";
|
|
13
13
|
import { collectResourceReferences } from "../../core/resourceReferences.js";
|
|
14
|
+
import {
|
|
15
|
+
assertFieldsAvailable,
|
|
16
|
+
transformInputFields
|
|
17
|
+
} from "../../grammar/datasetSchema.js";
|
|
14
18
|
|
|
15
19
|
const OPTIONS = Object.freeze(["id", "source", "transform"]);
|
|
16
20
|
const RELEASE_OPTIONS = Object.freeze(["id"]);
|
|
@@ -43,9 +47,16 @@ export const createDerivedData = /* @__PURE__ */ closedAction(
|
|
|
43
47
|
if (!hasDataset(this, source)) {
|
|
44
48
|
throw new Error(`Unknown source dataset "${source}".`);
|
|
45
49
|
}
|
|
46
|
-
|
|
50
|
+
const created = this
|
|
47
51
|
.editSemantic({ property: `dataset[${id}].source`, value: source })
|
|
48
52
|
.editSemantic({ property: `dataset[${id}].transform`, value: args.transform });
|
|
53
|
+
const input = resolveDatasetReference(created, source, "Source dataset");
|
|
54
|
+
const transform = args.transform[0];
|
|
55
|
+
assertFieldsAvailable(input.schema, transformInputFields(transform), {
|
|
56
|
+
data: input.id,
|
|
57
|
+
operation: "createDerivedData"
|
|
58
|
+
});
|
|
59
|
+
return created;
|
|
49
60
|
}
|
|
50
61
|
);
|
|
51
62
|
|
|
@@ -75,6 +86,9 @@ export const releaseDerivedData = /* @__PURE__ */ closedAction(
|
|
|
75
86
|
property: `dataset[${validatedId}]`,
|
|
76
87
|
remove: true
|
|
77
88
|
});
|
|
89
|
+
next = next._withoutMaterializationConfig([
|
|
90
|
+
"calculations", "datasets", validatedId
|
|
91
|
+
]);
|
|
78
92
|
for (const owner of selfOwners) {
|
|
79
93
|
const [, family, ownerId] = owner.path;
|
|
80
94
|
next = next._withoutMaterializationConfig(["data", family, ownerId]);
|
package/src/actions/data/edit.js
CHANGED
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
} from "../../selectors/datasets.js";
|
|
14
14
|
import { applyLayerDataRematerialization } from
|
|
15
15
|
"../../materialization/dependencies.js";
|
|
16
|
+
import { withLogicalDataReplacements } from
|
|
17
|
+
"../../materialization/revisionIdentity.js";
|
|
16
18
|
import {
|
|
17
19
|
outputFieldChanges,
|
|
18
20
|
rebindLayerOutputFields,
|
|
@@ -36,6 +38,7 @@ const CREATOR_BY_TYPE = Object.freeze({
|
|
|
36
38
|
interval: "createIntervalData",
|
|
37
39
|
normalize: "createNormalizedData",
|
|
38
40
|
regression: "createRegressionData",
|
|
41
|
+
sort: "createSortedData",
|
|
39
42
|
stack: "createStackData",
|
|
40
43
|
summary: "createSummaryData",
|
|
41
44
|
timeUnit: "createTimeUnitData",
|
|
@@ -54,6 +57,7 @@ const REVISION_ROLE = Object.freeze({
|
|
|
54
57
|
interval: "IntervalData",
|
|
55
58
|
normalize: "NormalizedData",
|
|
56
59
|
regression: "RegressionData",
|
|
60
|
+
sort: "SortedData",
|
|
57
61
|
stack: "StackData",
|
|
58
62
|
summary: "SummaryData",
|
|
59
63
|
timeUnit: "TimeUnitData",
|
|
@@ -298,6 +302,11 @@ function directLayerConsumers(program, data) {
|
|
|
298
302
|
}
|
|
299
303
|
|
|
300
304
|
export function applyRevisionPlan(program, resolved, plan, { retain = new Set() } = {}) {
|
|
305
|
+
return withLogicalDataReplacements(plan.replacements, () =>
|
|
306
|
+
applyRevisionPlanWithIdentity(program, resolved, plan, { retain }));
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function applyRevisionPlanWithIdentity(program, resolved, plan, { retain }) {
|
|
301
310
|
const root = plan.revisions[0];
|
|
302
311
|
const changes = resolved === undefined ? new Map() : outputFieldChanges(
|
|
303
312
|
resolved.dataset.transform[0],
|
|
@@ -464,18 +473,18 @@ export const editComputedData = /* @__PURE__ */ focusedEditor(
|
|
|
464
473
|
"editComputedData", "computed", ["as", "expression"]
|
|
465
474
|
);
|
|
466
475
|
export const editFilteredData = /* @__PURE__ */ focusedEditor(
|
|
467
|
-
"editFilteredData", "filter", ["field", "oneOf", "predicate", "range"]
|
|
476
|
+
"editFilteredData", "filter", ["field", "oneOf", "noneOf", "predicate", "range", "nulls"]
|
|
468
477
|
);
|
|
469
478
|
export const editFoldData = /* @__PURE__ */ focusedEditor(
|
|
470
479
|
"editFoldData", "fold", ["fields", "as"]
|
|
471
480
|
);
|
|
472
481
|
export const editSummaryData = /* @__PURE__ */ focusedEditor(
|
|
473
|
-
"editSummaryData", "summary", ["groupBy", "aggregates", "members", "weight"]
|
|
482
|
+
"editSummaryData", "summary", ["groupBy", "aggregates", "members", "weight", "missing", "empty"]
|
|
474
483
|
);
|
|
475
484
|
export const editBinData = /* @__PURE__ */ focusedEditor(
|
|
476
485
|
"editBinData", "bin", [
|
|
477
486
|
"field", "maxBins", "step", "boundaries", "extent", "nice", "zero",
|
|
478
|
-
"includeEmpty", "members", "as", "weight"
|
|
487
|
+
"includeEmpty", "members", "as", "weight", "missing"
|
|
479
488
|
]
|
|
480
489
|
);
|
|
481
490
|
export const editTimeUnitData = /* @__PURE__ */ focusedEditor(
|
|
@@ -492,7 +501,7 @@ export const editWindowData = /* @__PURE__ */ focusedEditor(
|
|
|
492
501
|
export const editDensityData = /* @__PURE__ */ focusedEditor(
|
|
493
502
|
"editDensityData", "density", [
|
|
494
503
|
"field", "groupBy", "bandwidth", "extent", "steps", "kernel",
|
|
495
|
-
"normalization", "as", "weight"
|
|
504
|
+
"normalization", "as", "weight", "missing"
|
|
496
505
|
]
|
|
497
506
|
);
|
|
498
507
|
export const editStackData = /* @__PURE__ */ focusedEditor(
|
|
@@ -500,13 +509,16 @@ export const editStackData = /* @__PURE__ */ focusedEditor(
|
|
|
500
509
|
);
|
|
501
510
|
export const editRegressionData = /* @__PURE__ */ focusedEditor(
|
|
502
511
|
"editRegressionData", "regression", [
|
|
503
|
-
"x", "y", "groupBy", "method", "degree", "span", "confidenceMethod",
|
|
504
|
-
"level", "confidence", "interval"
|
|
512
|
+
"x", "y", "groupBy", "method", "degree", "span", "robustIterations", "confidenceMethod",
|
|
513
|
+
"level", "confidence", "interval", "predict"
|
|
505
514
|
]
|
|
506
515
|
);
|
|
516
|
+
export const editSortedData = /* @__PURE__ */ focusedEditor(
|
|
517
|
+
"editSortedData", "sort", ["sortBy"]
|
|
518
|
+
);
|
|
507
519
|
export const editIntervalData = /* @__PURE__ */ focusedEditor(
|
|
508
520
|
"editIntervalData", "interval", [
|
|
509
|
-
"field", "groupBy", "center", "extent", "method", "level", "as"
|
|
521
|
+
"field", "groupBy", "center", "extent", "method", "level", "missing", "as"
|
|
510
522
|
]
|
|
511
523
|
);
|
|
512
524
|
export const editECDFData = /* @__PURE__ */ focusedEditor(
|
|
@@ -543,6 +555,7 @@ export const EDIT_DERIVED_DATA_ACTIONS = Object.freeze({
|
|
|
543
555
|
editDensityData,
|
|
544
556
|
editStackData,
|
|
545
557
|
editRegressionData,
|
|
558
|
+
editSortedData,
|
|
546
559
|
editIntervalData,
|
|
547
560
|
editECDFData,
|
|
548
561
|
editNormalizedData,
|
|
@@ -27,9 +27,14 @@ import {
|
|
|
27
27
|
resolveEligibleLayer
|
|
28
28
|
} from "../../selectors/index.js";
|
|
29
29
|
import { MATERIALIZE_OPTIONS, requireDerivedDataset } from "./shared.js";
|
|
30
|
+
import {
|
|
31
|
+
assertFieldsAvailable,
|
|
32
|
+
deriveTransformSchema,
|
|
33
|
+
transformInputFields
|
|
34
|
+
} from "../../grammar/datasetSchema.js";
|
|
30
35
|
|
|
31
36
|
const OPTIONS = Object.freeze([
|
|
32
|
-
"id", "source", "field", "oneOf", "predicate", "range"
|
|
37
|
+
"id", "source", "field", "oneOf", "noneOf", "predicate", "range", "nulls"
|
|
33
38
|
]);
|
|
34
39
|
const MARK_SELECTOR_KEYS = Object.freeze([
|
|
35
40
|
"grain", "field", "channel", "property", "op", "value", "values",
|
|
@@ -58,10 +63,16 @@ export const materializeFilteredData = /* @__PURE__ */ closedAction(
|
|
|
58
63
|
args.id,
|
|
59
64
|
"filter"
|
|
60
65
|
);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
assertFieldsAvailable(source.schema, transformInputFields(transform), {
|
|
67
|
+
data: source.id,
|
|
68
|
+
operation: "materializeFilteredData"
|
|
69
|
+
});
|
|
70
|
+
const values = deriveFilteredRows(source.values, transform);
|
|
71
|
+
const schema = deriveTransformSchema(source.schema, transform, values, {
|
|
72
|
+
sourceId: source.id,
|
|
73
|
+
ownerId: id
|
|
64
74
|
});
|
|
75
|
+
return this.editSemantic({ property: `dataset[${id}].values`, value: values });
|
|
65
76
|
}
|
|
66
77
|
);
|
|
67
78
|
|
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
import { createCompleteData, materializeCompleteData } from "./complete.js";
|
|
49
49
|
import { createImputedData, materializeImputedData } from "./impute.js";
|
|
50
50
|
import { createStackData, materializeStackData } from "./stack.js";
|
|
51
|
+
import { createSortedData, materializeSortedData } from "./sort.js";
|
|
51
52
|
import { EDIT_DERIVED_DATA_ACTIONS } from "./edit.js";
|
|
52
53
|
import { createBoxSummaryData, createBoxOutlierData, materializeBoxSummaryData, materializeBoxOutlierData } from "./box.js";
|
|
53
54
|
|
|
@@ -96,6 +97,8 @@ export function registerDataActions(ProgramClass) {
|
|
|
96
97
|
materializeImputedData,
|
|
97
98
|
createStackData,
|
|
98
99
|
materializeStackData,
|
|
100
|
+
createSortedData,
|
|
101
|
+
materializeSortedData,
|
|
99
102
|
createTimeUnitData,
|
|
100
103
|
materializeTimeUnitData,
|
|
101
104
|
createBin2DData,
|
|
@@ -13,6 +13,7 @@ const OPTIONS = Object.freeze([
|
|
|
13
13
|
"extent",
|
|
14
14
|
"method",
|
|
15
15
|
"level",
|
|
16
|
+
"missing",
|
|
16
17
|
"as"
|
|
17
18
|
]);
|
|
18
19
|
|
|
@@ -42,6 +43,7 @@ export const createIntervalData = /* @__PURE__ */ derivedCreator(
|
|
|
42
43
|
extent: args.extent,
|
|
43
44
|
method: args.method,
|
|
44
45
|
level: args.level,
|
|
46
|
+
missing: args.missing,
|
|
45
47
|
as
|
|
46
48
|
});
|
|
47
49
|
},
|
|
@@ -9,8 +9,9 @@ import { resolveDatasetReference } from "../../selectors/datasets.js";
|
|
|
9
9
|
import { derivedMaterializer } from "./shared.js";
|
|
10
10
|
|
|
11
11
|
const OPTIONS = Object.freeze([
|
|
12
|
-
"id", "source", "x", "y", "groupBy", "method", "degree", "span",
|
|
12
|
+
"id", "source", "x", "y", "groupBy", "method", "degree", "span", "robustIterations",
|
|
13
13
|
"confidenceMethod", "level", "confidence", "interval"
|
|
14
|
+
, "predict", "missing"
|
|
14
15
|
]);
|
|
15
16
|
|
|
16
17
|
export const materializeRegressionData = /* @__PURE__ */ derivedMaterializer(
|
|
@@ -24,10 +25,13 @@ export const materializeRegressionData = /* @__PURE__ */ derivedMaterializer(
|
|
|
24
25
|
method: transform.method,
|
|
25
26
|
degree: transform.degree,
|
|
26
27
|
span: transform.span,
|
|
28
|
+
robustIterations: transform.robustIterations,
|
|
27
29
|
confidenceMethod: transform.confidenceMethod,
|
|
28
30
|
level: transform.level,
|
|
29
31
|
confidence: transform.confidence,
|
|
30
|
-
interval: transform.interval
|
|
32
|
+
interval: transform.interval,
|
|
33
|
+
predict: transform.predict
|
|
34
|
+
, missing: transform.missing
|
|
31
35
|
})
|
|
32
36
|
);
|
|
33
37
|
|