ggaction 0.0.10 → 0.0.12
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 +97 -0
- package/README.md +5 -3
- package/knowledge/action-card.schema.json +1 -0
- package/knowledge/action-cards.json +1 -10941
- package/knowledge/action-cards.schema.json +1 -0
- package/knowledge/intent-taxonomy.json +1 -183
- package/knowledge/intent-taxonomy.schema.json +1 -0
- package/knowledge/mcp-resources.json +1 -95
- package/knowledge/mcp-resources.schema.json +1 -0
- package/knowledge/task-packet.schema.json +1 -159
- package/knowledge/task-resolver.js +1 -1230
- package/package.json +18 -2
- package/src/actions/boxPlots/edit.js +45 -298
- package/src/actions/boxPlots/options.js +46 -77
- package/src/actions/boxPlots/resolve.js +1 -1
- package/src/actions/charts/bar.js +3 -0
- package/src/actions/charts/heatmap.js +73 -83
- package/src/actions/charts/index.js +1 -1
- package/src/actions/charts/parallel.js +35 -1
- package/src/actions/charts/shared.js +20 -0
- package/src/actions/composition/actions.js +46 -49
- package/src/actions/data/bin2d.js +105 -2
- package/src/actions/data/box.js +17 -17
- package/src/actions/data/density.js +42 -78
- package/src/actions/data/gradientProfile.js +22 -52
- package/src/actions/data/horizon.js +16 -41
- package/src/actions/data/index.js +10 -10
- package/src/actions/data/interval.js +16 -38
- package/src/actions/data/intervalEdit.js +55 -0
- package/src/actions/data/regression.js +7 -17
- package/src/actions/data/shared.js +47 -0
- package/src/actions/data/timeUnit.js +14 -38
- package/src/actions/data/window.js +14 -38
- package/src/actions/distributions/revision.js +154 -34
- package/src/actions/encodings/angle.js +9 -10
- package/src/actions/encodings/appearance.js +17 -51
- package/src/actions/encodings/density/resolve.js +3 -1
- package/src/actions/encodings/density.js +1 -15
- package/src/actions/encodings/horizon/resolve.js +13 -3
- package/src/actions/encodings/horizon.js +8 -7
- package/src/actions/encodings/index.js +9 -9
- package/src/actions/encodings/offset.js +41 -45
- package/src/actions/encodings/parallel.js +9 -10
- package/src/actions/encodings/pathOrder.js +6 -13
- package/src/actions/encodings/position/apply.js +30 -0
- package/src/actions/encodings/position/policies/arc.js +23 -2
- package/src/actions/encodings/position/policies/index.js +4 -4
- package/src/actions/encodings/position/policies/line.js +47 -17
- package/src/actions/encodings/position/resolve.js +36 -7
- package/src/actions/encodings/ranged.js +18 -23
- package/src/actions/encodings/remove.js +15 -25
- package/src/actions/encodings/ruleAppearance.js +9 -24
- package/src/actions/encodings/shared.js +37 -0
- package/src/actions/encodings/strokeDash.js +8 -23
- package/src/actions/encodings/text.js +9 -10
- package/src/actions/errorBands/create.js +105 -39
- package/src/actions/errorBands/edit.js +89 -93
- package/src/actions/errorBands/index.js +1 -2
- package/src/actions/errorBars/create.js +212 -30
- package/src/actions/errorBars/edit.js +91 -48
- package/src/actions/errorBars/index.js +1 -2
- package/src/actions/facets/actions.js +45 -69
- package/src/actions/facets/derive.js +38 -53
- package/src/actions/facets/replay.js +0 -1
- package/src/actions/gradientPlots/components.js +59 -48
- package/src/actions/gradientPlots/edit.js +35 -216
- package/src/actions/gradientPlots/index.js +11 -10
- package/src/actions/gradientPlots/materialize.js +21 -35
- package/src/actions/gradientPlots/options.js +5 -7
- package/src/actions/gradientPlots/paint.js +9 -6
- package/src/actions/gradientPlots/resolve.js +1 -1
- package/src/actions/guides/axes/index.js +3 -3
- package/src/actions/guides/axes/labels.js +68 -26
- package/src/actions/guides/axes/lines.js +22 -2
- package/src/actions/guides/axes/policy.js +28 -8
- package/src/actions/guides/axes/ticks.js +27 -9
- package/src/actions/guides/axes/titles.js +113 -65
- package/src/actions/guides/grids/resolve.js +14 -0
- package/src/actions/guides/guides.js +2 -4
- package/src/actions/guides/index.js +2 -2
- package/src/actions/guides/legends/categorical/actions.js +44 -68
- package/src/actions/guides/legends/categorical/components.js +6 -1
- package/src/actions/guides/legends/categorical/index.js +2 -2
- package/src/actions/guides/legends/categorical/layout.js +148 -175
- package/src/actions/guides/legends/categorical/recipes.js +5 -0
- package/src/actions/guides/legends/categorical/resolve.js +8 -1
- package/src/actions/guides/legends/continuous/common.js +117 -66
- package/src/actions/guides/legends/continuous/gradient.js +38 -37
- package/src/actions/guides/legends/continuous/interval.js +97 -76
- package/src/actions/guides/legends/continuous/opacity.js +28 -38
- package/src/actions/guides/legends/edit.js +14 -1
- package/src/actions/guides/legends/index.js +1 -1
- package/src/actions/guides/legends/lane.js +2 -1
- package/src/actions/guides/legends/remove.js +8 -0
- package/src/actions/guides/legends/size.js +36 -43
- package/src/actions/guides/legends/strokeWidth.js +20 -26
- package/src/actions/guides/polar/axes/labels.js +17 -1
- package/src/actions/guides/polar/axes/shared.js +7 -1
- package/src/actions/guides/polar/axes/titles.js +19 -2
- package/src/actions/guides/polar/grids.js +4 -0
- package/src/actions/guides/polar/resolve.js +6 -0
- package/src/actions/index.js +13 -13
- package/src/actions/intervals/resolve.js +87 -117
- package/src/actions/marks/arc/actions.js +31 -36
- package/src/actions/marks/area/actions.js +23 -31
- package/src/actions/marks/index.js +6 -6
- package/src/actions/marks/line/actions.js +33 -52
- package/src/actions/marks/line/materialize.js +7 -5
- package/src/actions/marks/point/materialize.js +38 -16
- package/src/actions/marks/remove.js +21 -0
- package/src/actions/marks/rule/actions.js +79 -54
- package/src/actions/marks/shared.js +8 -4
- package/src/actions/marks/text/actions.js +14 -6
- package/src/actions/marks/text/layout.js +21 -45
- package/src/actions/marks/tick/actions.js +22 -21
- package/src/actions/primitives/createGraphics.js +4 -0
- package/src/actions/primitives/editGraphics.js +4 -0
- package/src/actions/primitives/index.js +3 -3
- package/src/actions/primitives/semantic.js +1 -1
- package/src/actions/primitives/semanticValidation/index.js +2 -2
- package/src/actions/primitives/semanticValidation/layer.js +1 -1
- package/src/actions/regression/edit.js +3 -43
- package/src/actions/scales/consumers/families.js +24 -4
- package/src/actions/scales/consumers/index.js +1 -1
- package/src/actions/scales/consumers/seriesLayout.js +17 -0
- package/src/actions/scales/definitions.js +100 -103
- package/src/actions/scales/materialize.js +5 -0
- package/src/actions/selection/actions.js +79 -121
- package/src/actions/titles/actions.js +48 -94
- package/src/actions/titles/resolve.js +14 -27
- package/src/actions/violinPlots/create.js +37 -44
- package/src/core/textMetrics.js +74 -37
- package/src/core/validation.js +18 -0
- package/src/core/vocabulary.js +2 -2
- package/src/grammar/aggregate.js +48 -28
- package/src/grammar/arcs.js +170 -32
- package/src/grammar/areaSeries.js +14 -16
- package/src/grammar/bin2d.js +37 -23
- package/src/grammar/boxPlot.js +14 -13
- package/src/grammar/categoricalDensity.js +14 -14
- package/src/grammar/categoryOrder.js +8 -14
- package/src/grammar/curveCommands.js +87 -20
- package/src/grammar/density.js +162 -141
- package/src/grammar/facets/index.js +14 -0
- package/src/grammar/facets/scales.js +7 -4
- package/src/grammar/gradientProfile.js +12 -15
- package/src/grammar/histogram.js +145 -83
- package/src/grammar/horizon.js +60 -23
- package/src/grammar/interval.js +14 -13
- package/src/grammar/lineSeries.js +91 -61
- package/src/grammar/numeric.js +290 -0
- package/src/grammar/paint.js +3 -4
- package/src/grammar/palettes.js +21 -32
- package/src/grammar/pathCommands.js +6 -0
- package/src/grammar/polarPaths.js +5 -5
- package/src/grammar/positionCompatibility.js +1 -1
- package/src/grammar/regression/derive.js +48 -9
- package/src/grammar/regression/models.js +248 -69
- package/src/grammar/regression/parameters.js +8 -0
- package/src/grammar/rules.js +2 -0
- package/src/grammar/scales/color.js +35 -26
- package/src/grammar/scales/continuous.js +71 -24
- package/src/grammar/scales/definition.js +1 -1
- package/src/grammar/scales/discretized.js +42 -12
- package/src/grammar/scales/fields.js +21 -4
- package/src/grammar/scales/ordinal.js +139 -60
- package/src/grammar/scales/temporal.js +40 -11
- package/src/grammar/scales/transformed.js +199 -52
- package/src/grammar/schemas/graphicBounds.js +270 -79
- package/src/grammar/seriesLayout.js +50 -18
- package/src/grammar/ticks.js +123 -53
- package/src/grammar/timeUnit.js +18 -8
- package/src/grammar/transforms.js +4 -1
- package/src/grammar/window.js +70 -57
- package/src/index.js +1 -1
- package/src/layout/canvas.js +4 -8
- package/src/layout/composition.js +39 -40
- package/src/layout/facets.js +55 -30
- package/src/layout/labels.js +91 -15
- package/src/layout/legend.js +22 -20
- package/src/layout/legendLane.js +54 -40
- package/src/layout/title.js +7 -7
- package/src/materialization/bars/aggregate.js +14 -40
- package/src/materialization/bars/grouped.js +7 -18
- package/src/materialization/bars/histogram.js +2 -19
- package/src/materialization/bars/ranged.js +20 -15
- package/src/materialization/bars/resolve.js +21 -0
- package/src/materialization/facetGuides/legacyCategorical.js +9 -2
- package/src/materialization/facetGuides/placement.js +49 -19
- package/src/materialization/facetGuides/preparation.js +35 -6
- package/src/materialization/facets.js +42 -28
- package/src/materialization/guides/resources.js +2 -1
- package/src/materialization/marks/capabilities.js +15 -4
- package/src/materialization/marks/index.js +29 -6
- package/src/materialization/rowEncoding.js +57 -1
- package/src/materialization/scales/policies/bar.js +61 -102
- package/src/materialization/scales/policies/binnedPosition.js +34 -0
- package/src/materialization/scales/policies/offset.js +54 -0
- package/src/materialization/scales/policies/series.js +13 -7
- package/src/materialization/scales/resolve.js +6 -9
- package/src/materialization/selection/items/arc.js +16 -2
- package/src/materialization/selection/items/bar.js +4 -2
- package/src/materialization/selection/items/common.js +21 -1
- package/src/materialization/selection/items/path.js +19 -2
- package/src/materialization/selection/items/point.js +4 -16
- package/src/materialization/selection/items/tick.js +13 -21
- package/src/materialization/selection/point.js +11 -4
- package/src/materialization/selection/styles.js +19 -27
- package/src/materialization/text.js +4 -1
- package/src/mcp/adapter.js +8 -3
- package/src/renderers/canvas/fill.js +2 -2
- package/src/renderers/canvas/index.js +35 -2
- package/src/renderers/canvas/native.js +160 -0
- package/src/renderers/pdf.js +14 -0
- package/src/renderers/svg.js +37 -4
- package/types/index.d.ts +3 -0
- package/types/program.d.ts +523 -131
- package/types/svg.d.ts +1 -0
- package/src/actions/errorBands/components.js +0 -81
- package/src/actions/errorBands/options.js +0 -39
- package/src/actions/errorBands/resolve.js +0 -28
- package/src/actions/errorBars/components.js +0 -62
- package/src/actions/errorBars/options.js +0 -58
- package/src/actions/errorBars/resolve.js +0 -25
package/types/svg.d.ts
CHANGED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { action } from "../../core/action.js";
|
|
2
|
-
|
|
3
|
-
function positionOptions({ target, field, fieldType, coordinate, scale }) {
|
|
4
|
-
return {
|
|
5
|
-
target,
|
|
6
|
-
field,
|
|
7
|
-
fieldType,
|
|
8
|
-
coordinate,
|
|
9
|
-
scale: { id: scale }
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const createErrorBandBoundary = action(
|
|
14
|
-
{
|
|
15
|
-
op: "createErrorBandBoundary",
|
|
16
|
-
description: "Create one lower or upper error-band boundary line."
|
|
17
|
-
},
|
|
18
|
-
function ({
|
|
19
|
-
id,
|
|
20
|
-
data,
|
|
21
|
-
orientation,
|
|
22
|
-
bound,
|
|
23
|
-
position,
|
|
24
|
-
coordinate,
|
|
25
|
-
intervalScale,
|
|
26
|
-
positionScale,
|
|
27
|
-
groupBy,
|
|
28
|
-
stroke,
|
|
29
|
-
strokeWidth,
|
|
30
|
-
strokeDash,
|
|
31
|
-
opacity,
|
|
32
|
-
curve
|
|
33
|
-
} = {}) {
|
|
34
|
-
let next = this.createLineMark({ id, data, strokeWidth, curve });
|
|
35
|
-
if (orientation === "vertical") {
|
|
36
|
-
next = next
|
|
37
|
-
.encodeY(positionOptions({
|
|
38
|
-
target: id,
|
|
39
|
-
field: bound,
|
|
40
|
-
fieldType: "quantitative",
|
|
41
|
-
coordinate,
|
|
42
|
-
scale: intervalScale
|
|
43
|
-
}))
|
|
44
|
-
.encodeX(positionOptions({
|
|
45
|
-
target: id,
|
|
46
|
-
field: position.field,
|
|
47
|
-
fieldType: position.fieldType,
|
|
48
|
-
coordinate,
|
|
49
|
-
scale: positionScale
|
|
50
|
-
}));
|
|
51
|
-
} else {
|
|
52
|
-
next = next
|
|
53
|
-
.encodeY(positionOptions({
|
|
54
|
-
target: id,
|
|
55
|
-
field: position.field,
|
|
56
|
-
fieldType: position.fieldType,
|
|
57
|
-
coordinate,
|
|
58
|
-
scale: positionScale
|
|
59
|
-
}))
|
|
60
|
-
.encodeX(positionOptions({
|
|
61
|
-
target: id,
|
|
62
|
-
field: bound,
|
|
63
|
-
fieldType: "quantitative",
|
|
64
|
-
coordinate,
|
|
65
|
-
scale: intervalScale
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
if (groupBy !== undefined) {
|
|
69
|
-
next = next.encodeGroup({ target: id, field: groupBy });
|
|
70
|
-
}
|
|
71
|
-
next = next
|
|
72
|
-
.editGraphics({ target: id, property: "stroke", value: stroke })
|
|
73
|
-
.editGraphics({
|
|
74
|
-
target: id,
|
|
75
|
-
property: "strokeDash",
|
|
76
|
-
value: next.graphicSpec.objects[id].items.map(() => strokeDash)
|
|
77
|
-
})
|
|
78
|
-
.editGraphics({ target: id, property: "opacity", value: opacity });
|
|
79
|
-
return next;
|
|
80
|
-
}
|
|
81
|
-
);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { isPlainObject } from "../../core/immutable.js";
|
|
2
|
-
import {
|
|
3
|
-
validateKeys,
|
|
4
|
-
validateNonEmptyString,
|
|
5
|
-
validateNonNegativeFinite,
|
|
6
|
-
validateUnitInterval
|
|
7
|
-
} from "../../core/validation.js";
|
|
8
|
-
import { validateCurveInterpolation } from "../../grammar/curveCommands.js";
|
|
9
|
-
import { normalizeStrokeDashPattern } from "../../grammar/scales/index.js";
|
|
10
|
-
|
|
11
|
-
export const ERROR_BAND_BOUNDARY_OPTIONS = Object.freeze([
|
|
12
|
-
"stroke", "strokeWidth", "strokeDash", "opacity", "curve"
|
|
13
|
-
]);
|
|
14
|
-
|
|
15
|
-
export function resolveBoundaryAppearance(value, {
|
|
16
|
-
defaults,
|
|
17
|
-
operation
|
|
18
|
-
}) {
|
|
19
|
-
if (!isPlainObject(value)) {
|
|
20
|
-
throw new TypeError(`${operation} must be a plain object.`);
|
|
21
|
-
}
|
|
22
|
-
validateKeys(value, ERROR_BAND_BOUNDARY_OPTIONS, operation);
|
|
23
|
-
const stroke = value.stroke ?? defaults.stroke;
|
|
24
|
-
const strokeWidth = value.strokeWidth ?? defaults.strokeWidth;
|
|
25
|
-
const strokeDash = value.strokeDash ?? defaults.strokeDash;
|
|
26
|
-
const opacity = value.opacity ?? defaults.opacity;
|
|
27
|
-
const curve = validateCurveInterpolation(value.curve ?? defaults.curve);
|
|
28
|
-
validateNonEmptyString(stroke, `${operation} stroke`);
|
|
29
|
-
validateNonNegativeFinite(strokeWidth, `${operation} strokeWidth`);
|
|
30
|
-
const resolvedStrokeDash = normalizeStrokeDashPattern(strokeDash);
|
|
31
|
-
validateUnitInterval(opacity, `${operation} opacity`);
|
|
32
|
-
return {
|
|
33
|
-
stroke,
|
|
34
|
-
strokeWidth,
|
|
35
|
-
strokeDash: resolvedStrokeDash,
|
|
36
|
-
opacity,
|
|
37
|
-
curve
|
|
38
|
-
};
|
|
39
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { resolveIntervalComposite } from "../intervals/resolve.js";
|
|
2
|
-
|
|
3
|
-
const ERROR_BAND_POLICY = Object.freeze({
|
|
4
|
-
operation: "createErrorBand",
|
|
5
|
-
resourceLabel: "error-band",
|
|
6
|
-
defaultId: "errorBand",
|
|
7
|
-
ownerLabel: "Error-band id",
|
|
8
|
-
positionTypes: Object.freeze(["quantitative", "temporal"]),
|
|
9
|
-
defaultPositionType: "quantitative",
|
|
10
|
-
defaultIntervalChannel: "y",
|
|
11
|
-
scaleDefaults: fieldType => fieldType === "temporal"
|
|
12
|
-
? { nice: true }
|
|
13
|
-
: { nice: true, zero: false },
|
|
14
|
-
intervalScaleDefaults: Object.freeze({ nice: true, zero: false }),
|
|
15
|
-
allowExplicitGrouping: true,
|
|
16
|
-
ambiguousMessage:
|
|
17
|
-
"createErrorBand cannot infer the interval axis when both positions are quantitative; provide an interval option."
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export function resolveErrorBand(program, args) {
|
|
21
|
-
const resolved = resolveIntervalComposite(program, args, ERROR_BAND_POLICY);
|
|
22
|
-
if (resolved.groupField === resolved.position.field) {
|
|
23
|
-
throw new Error(
|
|
24
|
-
"createErrorBand groupBy must differ from the independent position field."
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
return resolved;
|
|
28
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { action } from "../../core/action.js";
|
|
2
|
-
import { validateKeys } from "../../core/validation.js";
|
|
3
|
-
|
|
4
|
-
const OPTIONS = Object.freeze([
|
|
5
|
-
"id",
|
|
6
|
-
"data",
|
|
7
|
-
"orientation",
|
|
8
|
-
"positionField",
|
|
9
|
-
"positionFieldType",
|
|
10
|
-
"intervalField",
|
|
11
|
-
"coordinate",
|
|
12
|
-
"positionScale",
|
|
13
|
-
"intervalScale",
|
|
14
|
-
"capSize",
|
|
15
|
-
"stroke",
|
|
16
|
-
"strokeWidth",
|
|
17
|
-
"strokeDash",
|
|
18
|
-
"opacity"
|
|
19
|
-
]);
|
|
20
|
-
|
|
21
|
-
export const createErrorBarCap = action(
|
|
22
|
-
{
|
|
23
|
-
op: "createErrorBarCap",
|
|
24
|
-
description: "Create one fixed-pixel error-bar cap."
|
|
25
|
-
},
|
|
26
|
-
function (args = {}) {
|
|
27
|
-
validateKeys(args, OPTIONS, "createErrorBarCap");
|
|
28
|
-
if (!["vertical", "horizontal"].includes(args.orientation)) {
|
|
29
|
-
throw new Error(`Unsupported error-bar orientation "${args.orientation}".`);
|
|
30
|
-
}
|
|
31
|
-
const positionChannel = args.orientation === "vertical" ? "x" : "y";
|
|
32
|
-
const intervalChannel = args.orientation === "vertical" ? "y" : "x";
|
|
33
|
-
const positionAction = positionChannel === "x" ? "encodeX" : "encodeY";
|
|
34
|
-
const intervalAction = intervalChannel === "x" ? "encodeX" : "encodeY";
|
|
35
|
-
|
|
36
|
-
return this
|
|
37
|
-
.createRuleMark({ id: args.id, data: args.data })
|
|
38
|
-
[positionAction]({
|
|
39
|
-
target: args.id,
|
|
40
|
-
field: args.positionField,
|
|
41
|
-
fieldType: args.positionFieldType,
|
|
42
|
-
coordinate: args.coordinate,
|
|
43
|
-
scale: { id: args.positionScale }
|
|
44
|
-
})
|
|
45
|
-
[intervalAction]({
|
|
46
|
-
target: args.id,
|
|
47
|
-
field: args.intervalField,
|
|
48
|
-
fieldType: "quantitative",
|
|
49
|
-
coordinate: args.coordinate,
|
|
50
|
-
scale: { id: args.intervalScale }
|
|
51
|
-
})
|
|
52
|
-
.encodeStroke({ target: args.id, value: args.stroke })
|
|
53
|
-
.encodeStrokeWidth({ target: args.id, value: args.strokeWidth })
|
|
54
|
-
.encodeStrokeDash({ target: args.id, value: args.strokeDash })
|
|
55
|
-
.encodeOpacity({ target: args.id, value: args.opacity })
|
|
56
|
-
.materializeRuleSpan({
|
|
57
|
-
id: args.id,
|
|
58
|
-
orientation: args.orientation === "vertical" ? "horizontal" : "vertical",
|
|
59
|
-
size: args.capSize
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
);
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
validateKeys,
|
|
3
|
-
validatePositiveFinite
|
|
4
|
-
} from "../../core/validation.js";
|
|
5
|
-
import {
|
|
6
|
-
normalizeStrokeDashPattern,
|
|
7
|
-
validateOpacityValue
|
|
8
|
-
} from "../../grammar/scales/index.js";
|
|
9
|
-
import {
|
|
10
|
-
validateRuleStroke,
|
|
11
|
-
validateRuleStrokeWidth
|
|
12
|
-
} from "../../grammar/ruleAppearance.js";
|
|
13
|
-
|
|
14
|
-
export const ERROR_BAR_EDIT_OPTIONS = Object.freeze([
|
|
15
|
-
"target", "caps", "capSize", "stroke", "strokeWidth",
|
|
16
|
-
"strokeDash", "opacity", "statistics"
|
|
17
|
-
]);
|
|
18
|
-
|
|
19
|
-
export const ERROR_BAR_APPEARANCE_OPTIONS = Object.freeze(
|
|
20
|
-
ERROR_BAR_EDIT_OPTIONS.filter(option =>
|
|
21
|
-
option !== "target" && option !== "statistics"
|
|
22
|
-
)
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export function resolveErrorBarAppearance(args, {
|
|
26
|
-
defaults,
|
|
27
|
-
operation
|
|
28
|
-
}) {
|
|
29
|
-
validateKeys(args, ERROR_BAR_EDIT_OPTIONS, operation);
|
|
30
|
-
const caps = args.caps ?? defaults.caps;
|
|
31
|
-
if (typeof caps !== "boolean") {
|
|
32
|
-
throw new TypeError(`${operation} caps must be a boolean.`);
|
|
33
|
-
}
|
|
34
|
-
const capSize = args.capSize ?? defaults.capSize;
|
|
35
|
-
validatePositiveFinite(capSize, `${operation} capSize`);
|
|
36
|
-
const stroke = validateRuleStroke(
|
|
37
|
-
args.stroke ?? defaults.stroke,
|
|
38
|
-
`${operation} stroke`
|
|
39
|
-
);
|
|
40
|
-
const strokeWidth = validateRuleStrokeWidth(
|
|
41
|
-
args.strokeWidth ?? defaults.strokeWidth,
|
|
42
|
-
`${operation} strokeWidth`
|
|
43
|
-
);
|
|
44
|
-
const strokeDash = args.strokeDash ?? defaults.strokeDash;
|
|
45
|
-
normalizeStrokeDashPattern(strokeDash);
|
|
46
|
-
const opacity = validateOpacityValue(
|
|
47
|
-
args.opacity ?? defaults.opacity,
|
|
48
|
-
`${operation} opacity`
|
|
49
|
-
);
|
|
50
|
-
return {
|
|
51
|
-
caps,
|
|
52
|
-
capSize,
|
|
53
|
-
stroke,
|
|
54
|
-
strokeWidth,
|
|
55
|
-
strokeDash,
|
|
56
|
-
opacity
|
|
57
|
-
};
|
|
58
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { resolveIntervalComposite } from "../intervals/resolve.js";
|
|
2
|
-
|
|
3
|
-
const ERROR_BAR_POLICY = Object.freeze({
|
|
4
|
-
operation: "createErrorBar",
|
|
5
|
-
resourceLabel: "error-bar",
|
|
6
|
-
defaultId: "errorBar",
|
|
7
|
-
ownerLabel: "Error-bar id",
|
|
8
|
-
positionTypes: Object.freeze(["nominal", "ordinal", "temporal"]),
|
|
9
|
-
defaultPositionType: "nominal",
|
|
10
|
-
defaultIntervalChannel: "y",
|
|
11
|
-
scaleDefaults: () => ({}),
|
|
12
|
-
intervalScaleDefaults: Object.freeze({ nice: true, zero: false }),
|
|
13
|
-
allowExplicitGrouping: false,
|
|
14
|
-
ambiguousMessage:
|
|
15
|
-
"createErrorBar requires one quantitative interval axis and one nominal, ordinal, or temporal position axis."
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export function resolveErrorBar(program, args) {
|
|
19
|
-
const resolved = resolveIntervalComposite(program, args, ERROR_BAR_POLICY);
|
|
20
|
-
return {
|
|
21
|
-
...resolved,
|
|
22
|
-
lowerCapId: `${resolved.id}LowerCap`,
|
|
23
|
-
upperCapId: `${resolved.id}UpperCap`
|
|
24
|
-
};
|
|
25
|
-
}
|