@opendata-ai/openchart-engine 8.0.0-rc.24 → 8.0.0-rc.26
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/dist/index.d.ts +12 -12
- package/dist/index.js +69 -44
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _opendata_ai_openchart_core from '@opendata-ai/openchart-core';
|
|
2
|
-
import { AnimationEase, LegendLayout, ResolvedChrome, TooltipContent, A11yMetadata, ResolvedTheme, LegendEntry, CompileOptions, ChartLayout, LayerSpec, CompileTableOptions, TableLayout, ResolvedAnimationPhase, AnimationSpec, ResolvedAnimation, Point, DataRow, BarListEncoding, ThemeConfig, DarkMode,
|
|
3
|
-
export { BarListLayout, BarListSpec, ChartLayout, ChartSpec, CompileOptions, CompileTableOptions,
|
|
2
|
+
import { AnimationEase, LegendLayout, ResolvedChrome, TooltipContent, A11yMetadata, ResolvedTheme, LegendEntry, CompileOptions, ChartLayout, LayerSpec, CompileTableOptions, TableLayout, ResolvedAnimationPhase, AnimationSpec, ResolvedAnimation, Point, DataRow, BarListEncoding, ThemeConfig, DarkMode, GeoMapGeo, GeoMapEncoding, LegendConfig, GeoMapPointsLayer, TileMapEncoding, TileMapPalette, MarkType, MarkDef, Encoding, ChromeText, Annotation, LabelConfig, Display, ColumnConfig, GraphSpec, GraphEncoding, GraphLayoutConfig, NodeOverride, GraphAnimationSpec, GraphInteractionConfig, SankeyEncoding, SankeyNodeAlign, SankeyLinkColor, ScaleType, EncodingChannel, FieldFormatContext, Rect, LayoutStrategy, VizSpec, Mark, BinTransform, CalculateTransform, ConditionalValueDef, FilterPredicate, TimeUnitTransform, Transform } from '@opendata-ai/openchart-core';
|
|
3
|
+
export { BarListLayout, BarListSpec, ChartLayout, ChartSpec, CompileOptions, CompileTableOptions, GeoMapLayout, GeoMapSpec, GraphLayout, GraphSpec, LayerSpec, SankeyLayout, SankeySpec, TableLayout, TableSpec, TileMapLayout, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
|
|
4
4
|
import { ScaleLinear, ScaleTime, ScaleLogarithmic, ScalePower, ScaleSymLog, ScaleBand, ScalePoint, ScaleOrdinal, ScaleQuantile, ScaleQuantize, ScaleThreshold } from 'd3-scale';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -272,18 +272,18 @@ declare function compileSankey(spec: unknown, options: CompileOptions): _opendat
|
|
|
272
272
|
*/
|
|
273
273
|
declare function compileTileMap(spec: unknown, options: CompileOptions): _opendata_ai_openchart_core.TileMapLayout;
|
|
274
274
|
/**
|
|
275
|
-
* Compile a map spec into a
|
|
275
|
+
* Compile a map spec into a GeoMapLayout.
|
|
276
276
|
*
|
|
277
277
|
* Takes a raw map spec, validates, normalizes, resolves theme and chrome,
|
|
278
278
|
* projects geo features, joins data, builds feature marks with color fills,
|
|
279
|
-
* and returns a
|
|
279
|
+
* and returns a GeoMapLayout ready for rendering.
|
|
280
280
|
*
|
|
281
281
|
* @param spec - Raw map spec (validated and normalized internally).
|
|
282
282
|
* @param options - Compile options (width, height, theme, darkMode).
|
|
283
|
-
* @returns
|
|
283
|
+
* @returns GeoMapLayout with computed positions and visual properties.
|
|
284
284
|
* @throws Error if spec is invalid or not a map type.
|
|
285
285
|
*/
|
|
286
|
-
declare function
|
|
286
|
+
declare function compileGeoMap(spec: unknown, options: CompileOptions): _opendata_ai_openchart_core.GeoMapLayout;
|
|
287
287
|
/**
|
|
288
288
|
* Compile a barlist spec into a BarListLayout.
|
|
289
289
|
*
|
|
@@ -413,11 +413,11 @@ interface NormalizedBarListSpec {
|
|
|
413
413
|
valueFormat?: string;
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
interface
|
|
416
|
+
interface NormalizedGeoMapSpec {
|
|
417
417
|
type: 'map';
|
|
418
|
-
geo: Required<
|
|
418
|
+
geo: Required<GeoMapGeo>;
|
|
419
419
|
data: Record<string, unknown>[];
|
|
420
|
-
encoding:
|
|
420
|
+
encoding: GeoMapEncoding;
|
|
421
421
|
chrome: NormalizedChrome;
|
|
422
422
|
legend?: LegendConfig;
|
|
423
423
|
theme: ThemeConfig;
|
|
@@ -425,7 +425,7 @@ interface NormalizedMapSpec {
|
|
|
425
425
|
watermark: boolean;
|
|
426
426
|
animation?: AnimationSpec;
|
|
427
427
|
valueFormat?: string;
|
|
428
|
-
points?:
|
|
428
|
+
points?: GeoMapPointsLayer;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
/**
|
|
@@ -593,7 +593,7 @@ interface NormalizedGraphSpec {
|
|
|
593
593
|
};
|
|
594
594
|
}
|
|
595
595
|
/** Discriminated union of all normalized spec types. */
|
|
596
|
-
type NormalizedSpec = NormalizedChartSpec | NormalizedTableSpec | NormalizedGraphSpec | NormalizedSankeySpec | NormalizedTileMapSpec |
|
|
596
|
+
type NormalizedSpec = NormalizedChartSpec | NormalizedTableSpec | NormalizedGraphSpec | NormalizedSankeySpec | NormalizedTileMapSpec | NormalizedGeoMapSpec | NormalizedBarListSpec;
|
|
597
597
|
/** Machine-readable error code for programmatic handling. */
|
|
598
598
|
type ValidationErrorCode = 'MISSING_FIELD' | 'INVALID_TYPE' | 'INVALID_VALUE' | 'ENCODING_MISMATCH' | 'DATA_FIELD_MISSING' | 'EMPTY_DATA';
|
|
599
599
|
/** A single validation error with context. */
|
|
@@ -1058,4 +1058,4 @@ declare function runTimeUnit(data: DataRow[], transform: TimeUnitTransform): Dat
|
|
|
1058
1058
|
*/
|
|
1059
1059
|
declare function runTransforms(data: DataRow[], transforms: Transform[]): DataRow[];
|
|
1060
1060
|
|
|
1061
|
-
export { ARROWHEAD_LENGTH, type AnnotationContext, type AnnotationMeasureTextFn, type ArrowheadPoints, BOLD_SPAN_FONT_WEIGHT, type ChartRenderer, type CompileResult, type CompiledGraphEdge, type CompiledGraphNode, DEFAULT_ANNOTATION_FONT_SIZE, DEFAULT_LINE_HEIGHT, ENTER_DEFAULTS, EXIT_DEFAULTS, type GraphCompilation, type NormalizedBarListSpec, type NormalizedChartSpec, type NormalizedChrome, type
|
|
1061
|
+
export { ARROWHEAD_LENGTH, type AnnotationContext, type AnnotationMeasureTextFn, type ArrowheadPoints, BOLD_SPAN_FONT_WEIGHT, type ChartRenderer, type CompileResult, type CompiledGraphEdge, type CompiledGraphNode, DEFAULT_ANNOTATION_FONT_SIZE, DEFAULT_LINE_HEIGHT, ENTER_DEFAULTS, EXIT_DEFAULTS, type GraphCompilation, type NormalizedBarListSpec, type NormalizedChartSpec, type NormalizedChrome, type NormalizedGeoMapSpec, type NormalizedGraphSpec, type NormalizedSankeySpec, type NormalizedSpec, type NormalizedTableSpec, type NormalizedTileMapSpec, type ObstacleKind, type PlacementObstacle, type RichSpan, type SimulationConfig, UPDATE_DEFAULTS, type ValidationError, type ValidationErrorCode, type ValidationResult, buildAreaPath, buildEdgeTooltip, buildLinePath, clampStaggerDelay, clearRenderers, compile, compileBarList, compileChart, compileGeoMap, compileGraph, compileLayer, compileSankey, compileTable, compileTileMap, computeArrowheadPoints, dedupeKeys, evaluatePredicate, facetMinHeight, getChartRenderer, heuristicMeasure, isConditionalValueDef, legendGap, normalizeSpec, parseAnnotationSpans, registerChartRenderer, resolveAnimation, resolveConditionalValue, runBin, runCalculate, runFilter, runTimeUnit, runTransforms, serializeKeyValue, validateSpec };
|
package/dist/index.js
CHANGED
|
@@ -8560,6 +8560,11 @@ function computePieLabels(marks, _chartArea, density = "auto", _textFill = "#333
|
|
|
8560
8560
|
width: textWidth,
|
|
8561
8561
|
height: textHeight,
|
|
8562
8562
|
priority: "data",
|
|
8563
|
+
// Index into the ORIGINAL marks array, not `targetMarks`. Density
|
|
8564
|
+
// filtering drops slices and resolveCollisions re-sorts by priority, so
|
|
8565
|
+
// the returned labels line up with neither. Callers assign by this index
|
|
8566
|
+
// instead of zipping positionally.
|
|
8567
|
+
index: marks.indexOf(mark),
|
|
8563
8568
|
style: {
|
|
8564
8569
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
8565
8570
|
fontSize: LABEL_FONT_SIZE5,
|
|
@@ -8581,14 +8586,16 @@ function computePieLabels(marks, _chartArea, density = "auto", _textFill = "#333
|
|
|
8581
8586
|
x: c.anchorX,
|
|
8582
8587
|
y: c.anchorY,
|
|
8583
8588
|
style: c.style,
|
|
8584
|
-
visible: true
|
|
8589
|
+
visible: true,
|
|
8590
|
+
...c.index !== void 0 ? { index: c.index } : {}
|
|
8585
8591
|
}));
|
|
8586
8592
|
} else {
|
|
8587
8593
|
resolved = resolveCollisions5(candidates);
|
|
8588
8594
|
}
|
|
8589
|
-
for (let i = 0; i < resolved.length
|
|
8595
|
+
for (let i = 0; i < resolved.length; i++) {
|
|
8590
8596
|
const label = resolved[i];
|
|
8591
|
-
const mark =
|
|
8597
|
+
const mark = label.index !== void 0 ? marks[label.index] : void 0;
|
|
8598
|
+
if (!mark) continue;
|
|
8592
8599
|
if (label.visible) {
|
|
8593
8600
|
label.connector = {
|
|
8594
8601
|
from: { x: label.x, y: label.y },
|
|
@@ -8606,16 +8613,16 @@ function computePieLabels(marks, _chartArea, density = "auto", _textFill = "#333
|
|
|
8606
8613
|
var pieRenderer = (spec, scales, chartArea, strategy, theme) => {
|
|
8607
8614
|
const marks = computePieMarks(spec, scales, chartArea, strategy, false);
|
|
8608
8615
|
const labels = computePieLabels(marks, chartArea, spec.labels.density, theme.colors.text);
|
|
8609
|
-
for (
|
|
8610
|
-
marks[
|
|
8616
|
+
for (const label of labels) {
|
|
8617
|
+
if (label.index !== void 0 && marks[label.index]) marks[label.index].label = label;
|
|
8611
8618
|
}
|
|
8612
8619
|
return marks;
|
|
8613
8620
|
};
|
|
8614
8621
|
var donutRenderer = (spec, scales, chartArea, strategy, theme) => {
|
|
8615
8622
|
const marks = computePieMarks(spec, scales, chartArea, strategy, true);
|
|
8616
8623
|
const labels = computePieLabels(marks, chartArea, spec.labels.density, theme.colors.text);
|
|
8617
|
-
for (
|
|
8618
|
-
marks[
|
|
8624
|
+
for (const label of labels) {
|
|
8625
|
+
if (label.index !== void 0 && marks[label.index]) marks[label.index].label = label;
|
|
8619
8626
|
}
|
|
8620
8627
|
return marks;
|
|
8621
8628
|
};
|
|
@@ -9719,6 +9726,16 @@ function stripIgnoredKeys(spec, warnings) {
|
|
|
9719
9726
|
const { $schema: _schema, ...rest } = spec;
|
|
9720
9727
|
return rest;
|
|
9721
9728
|
}
|
|
9729
|
+
function stripRemovedMarkRender(spec, warnings) {
|
|
9730
|
+
const mark = spec.mark;
|
|
9731
|
+
if (!mark || typeof mark !== "object" || Array.isArray(mark)) return spec;
|
|
9732
|
+
if (!("render" in mark)) return spec;
|
|
9733
|
+
warnings.push(
|
|
9734
|
+
"[openchart] mark.render was removed in v8. This field is stripped for backward compatibility. Pass { renderer } to createChart() or the compile options instead."
|
|
9735
|
+
);
|
|
9736
|
+
const { render: _render, ...restMark } = mark;
|
|
9737
|
+
return { ...spec, mark: restMark };
|
|
9738
|
+
}
|
|
9722
9739
|
function applyFixedSizeDefault(spec) {
|
|
9723
9740
|
if (typeof spec.width === "number" && typeof spec.height === "number" && spec.responsive === void 0) {
|
|
9724
9741
|
return { ...spec, responsive: false };
|
|
@@ -9989,6 +10006,7 @@ function expandChartSugar(spec, warnings, inheritedData) {
|
|
|
9989
10006
|
out = expandTopLevelTitle(out);
|
|
9990
10007
|
out = expandDescriptionSugar(out);
|
|
9991
10008
|
out = stripIgnoredKeys(out, warnings);
|
|
10009
|
+
out = stripRemovedMarkRender(out, warnings);
|
|
9992
10010
|
out = applyFixedSizeDefault(out);
|
|
9993
10011
|
out = expandAnnotationSugar(out, warnings);
|
|
9994
10012
|
out = expandChannelSugar(out, warnings);
|
|
@@ -10152,9 +10170,9 @@ function resolveStagger(stagger, defaults) {
|
|
|
10152
10170
|
import {
|
|
10153
10171
|
isBarListSpec,
|
|
10154
10172
|
isChartSpec,
|
|
10173
|
+
isGeoMapSpec,
|
|
10155
10174
|
isGraphSpec,
|
|
10156
10175
|
isLayerSpec,
|
|
10157
|
-
isMapSpec,
|
|
10158
10176
|
isSankeySpec,
|
|
10159
10177
|
isTableSpec,
|
|
10160
10178
|
isTileMapSpec,
|
|
@@ -10652,7 +10670,7 @@ function normalizeTileMapSpec(spec, warnings) {
|
|
|
10652
10670
|
valueFormat: spec.valueFormat
|
|
10653
10671
|
};
|
|
10654
10672
|
}
|
|
10655
|
-
function
|
|
10673
|
+
function normalizeGeoMapSpec(spec, _warnings) {
|
|
10656
10674
|
return {
|
|
10657
10675
|
type: "map",
|
|
10658
10676
|
geo: {
|
|
@@ -10712,8 +10730,8 @@ function normalizeSpec(spec, warnings = []) {
|
|
|
10712
10730
|
if (isTileMapSpec(spec)) {
|
|
10713
10731
|
return normalizeTileMapSpec(spec, warnings);
|
|
10714
10732
|
}
|
|
10715
|
-
if (
|
|
10716
|
-
return
|
|
10733
|
+
if (isGeoMapSpec(spec)) {
|
|
10734
|
+
return normalizeGeoMapSpec(spec, warnings);
|
|
10717
10735
|
}
|
|
10718
10736
|
if (isBarListSpec(spec)) {
|
|
10719
10737
|
return normalizeBarListSpec(spec, warnings);
|
|
@@ -11029,21 +11047,6 @@ function validateCalendarSpec(spec, errors) {
|
|
|
11029
11047
|
seenDays.set(dayKey, i);
|
|
11030
11048
|
}
|
|
11031
11049
|
}
|
|
11032
|
-
var VALID_RENDER_MODES = /* @__PURE__ */ new Set(["auto", "svg", "canvas"]);
|
|
11033
|
-
function validateMarkRenderMode(spec, errors) {
|
|
11034
|
-
const mark = spec.mark;
|
|
11035
|
-
if (!mark || typeof mark !== "object" || Array.isArray(mark)) return;
|
|
11036
|
-
const render = mark.render;
|
|
11037
|
-
if (render === void 0) return;
|
|
11038
|
-
if (typeof render !== "string" || !VALID_RENDER_MODES.has(render)) {
|
|
11039
|
-
errors.push({
|
|
11040
|
-
message: `Spec error: mark.render ${JSON.stringify(render)} is not valid. Must be one of: auto, svg, canvas`,
|
|
11041
|
-
path: "mark.render",
|
|
11042
|
-
code: "INVALID_VALUE",
|
|
11043
|
-
suggestion: 'Use mark: { type: "point", render: "auto" } (default), "canvas" to force the canvas mark layer, or "svg" to force one circle per point.'
|
|
11044
|
-
});
|
|
11045
|
-
}
|
|
11046
|
-
}
|
|
11047
11050
|
var MAX_PLAUSIBLE_POINT_RADIUS = 50;
|
|
11048
11051
|
function pointSizeError(path2, value2) {
|
|
11049
11052
|
const radius = Math.max(1, Math.round(Math.sqrt(value2 / Math.PI)));
|
|
@@ -11183,7 +11186,6 @@ function validateChartSpec(spec, errors) {
|
|
|
11183
11186
|
if (markType === "calendar") {
|
|
11184
11187
|
validateCalendarSpec(spec, errors);
|
|
11185
11188
|
}
|
|
11186
|
-
validateMarkRenderMode(spec, errors);
|
|
11187
11189
|
validatePointSize(spec, errors);
|
|
11188
11190
|
if (Array.isArray(spec.transform)) {
|
|
11189
11191
|
const transforms = spec.transform;
|
|
@@ -11922,7 +11924,7 @@ function validateTileMapSpec(spec, errors) {
|
|
|
11922
11924
|
});
|
|
11923
11925
|
}
|
|
11924
11926
|
}
|
|
11925
|
-
function
|
|
11927
|
+
function validateGeoMapSpec(spec, errors) {
|
|
11926
11928
|
if (!spec.geo || typeof spec.geo !== "object") {
|
|
11927
11929
|
errors.push({
|
|
11928
11930
|
message: 'Spec error: map spec requires a "geo" object with a TopoJSON "features" field',
|
|
@@ -12422,7 +12424,7 @@ function validateSpec(spec) {
|
|
|
12422
12424
|
} else if (isTileMap) {
|
|
12423
12425
|
validateTileMapSpec(obj, errors);
|
|
12424
12426
|
} else if (isMap) {
|
|
12425
|
-
|
|
12427
|
+
validateGeoMapSpec(obj, errors);
|
|
12426
12428
|
} else if (isBarList) {
|
|
12427
12429
|
validateBarListSpec(obj, errors);
|
|
12428
12430
|
}
|
|
@@ -13854,6 +13856,7 @@ var LEGEND_PADDING = 8;
|
|
|
13854
13856
|
var LEGEND_RIGHT_WIDTH = 120;
|
|
13855
13857
|
var RIGHT_LEGEND_MAX_HEIGHT_RATIO = 0.4;
|
|
13856
13858
|
var TOP_LEGEND_MAX_ROWS = 2;
|
|
13859
|
+
var ARC_LABEL_CROWDING_LIMIT = 21;
|
|
13857
13860
|
function hasLegendContent(content) {
|
|
13858
13861
|
return content.entries.length > 0 || content.continuous != null;
|
|
13859
13862
|
}
|
|
@@ -14011,6 +14014,12 @@ function computeLegendContent(spec, strategy, theme, availableWidth, availableHe
|
|
|
14011
14014
|
}
|
|
14012
14015
|
}
|
|
14013
14016
|
}
|
|
14017
|
+
const density = spec.labels.density;
|
|
14018
|
+
const everySliceLabeled = density === "all" || density === "auto";
|
|
14019
|
+
const uncrowded = seriesCount > 0 && seriesCount <= ARC_LABEL_CROWDING_LIMIT;
|
|
14020
|
+
if (spec.markType === "arc" && everySliceLabeled && uncrowded && !spec.userExplicit?.legend) {
|
|
14021
|
+
entries = [];
|
|
14022
|
+
}
|
|
14014
14023
|
const labelStyle = {
|
|
14015
14024
|
fontFamily: theme.fonts.family,
|
|
14016
14025
|
fontSize: theme.fonts.sizes.small,
|
|
@@ -16020,22 +16029,25 @@ function collectContrastWarnings(scales, markType, theme) {
|
|
|
16020
16029
|
|
|
16021
16030
|
// src/compiler/mark-render-mode.ts
|
|
16022
16031
|
var AUTO_CANVAS_THRESHOLD = 1e3;
|
|
16023
|
-
var
|
|
16032
|
+
var AUTO_CANVAS_REFUSAL_WARN_THRESHOLD = 5e3;
|
|
16024
16033
|
function resolveMarkRenderMode(args, warnings = []) {
|
|
16025
|
-
const {
|
|
16026
|
-
const requested =
|
|
16034
|
+
const { markType, pointCount, display, faceted, layered } = args;
|
|
16035
|
+
const requested = args.requested ?? "auto";
|
|
16027
16036
|
if (requested === "svg") return "svg";
|
|
16028
16037
|
const refusal = describeRefusal(markType, display, faceted, layered);
|
|
16029
16038
|
if (refusal) {
|
|
16030
16039
|
if (requested === "canvas") {
|
|
16031
16040
|
warnings.push(
|
|
16032
|
-
`Chart warning:
|
|
16041
|
+
`Chart warning: renderer "canvas" is not supported ${refusal}; rendering marks as SVG instead.`
|
|
16042
|
+
);
|
|
16043
|
+
} else if (pointCount > AUTO_CANVAS_REFUSAL_WARN_THRESHOLD) {
|
|
16044
|
+
warnings.push(
|
|
16045
|
+
`[openchart] Rendering ${pointCount} point marks as SVG: the canvas mark layer is not supported ${refusal}. Expect slow paint and interaction. Reduce the point count, or restructure so the dense marks compile as a single unlayered, unfaceted point chart.`
|
|
16033
16046
|
);
|
|
16034
16047
|
}
|
|
16035
16048
|
return "svg";
|
|
16036
16049
|
}
|
|
16037
16050
|
if (requested === "canvas") return "canvas";
|
|
16038
|
-
if (!AUTO_ENABLED) return "svg";
|
|
16039
16051
|
return pointCount > AUTO_CANVAS_THRESHOLD ? "canvas" : "svg";
|
|
16040
16052
|
}
|
|
16041
16053
|
function describeRefusal(markType, display, faceted, layered) {
|
|
@@ -16112,7 +16124,7 @@ function buildSparklineAreaGradient(baseColor) {
|
|
|
16112
16124
|
};
|
|
16113
16125
|
}
|
|
16114
16126
|
|
|
16115
|
-
// src/geo/compile-map.ts
|
|
16127
|
+
// src/geo/compile-geo-map.ts
|
|
16116
16128
|
import {
|
|
16117
16129
|
adaptTheme as adaptTheme2,
|
|
16118
16130
|
buildD3Formatter as buildD3Formatter2,
|
|
@@ -18013,7 +18025,7 @@ function identity_default4() {
|
|
|
18013
18025
|
return projection2;
|
|
18014
18026
|
}
|
|
18015
18027
|
|
|
18016
|
-
// src/geo/compile-map.ts
|
|
18028
|
+
// src/geo/compile-geo-map.ts
|
|
18017
18029
|
import { feature as topoFeature, mesh as topoMesh } from "topojson-client";
|
|
18018
18030
|
|
|
18019
18031
|
// src/geo/join.ts
|
|
@@ -18146,7 +18158,7 @@ function excludePolarFeatures(geojson) {
|
|
|
18146
18158
|
return { type: "FeatureCollection", features: filtered };
|
|
18147
18159
|
}
|
|
18148
18160
|
|
|
18149
|
-
// src/geo/compile-map.ts
|
|
18161
|
+
// src/geo/compile-geo-map.ts
|
|
18150
18162
|
var OVERLAY_LEGEND_INSET = 18;
|
|
18151
18163
|
function validateGeoFeatures(geo) {
|
|
18152
18164
|
if (!geo.features) {
|
|
@@ -18168,14 +18180,14 @@ function validateGeoFeatures(geo) {
|
|
|
18168
18180
|
}
|
|
18169
18181
|
return topo;
|
|
18170
18182
|
}
|
|
18171
|
-
function
|
|
18183
|
+
function compileGeoMap(spec, options) {
|
|
18172
18184
|
const sugarWarnings = [];
|
|
18173
18185
|
const expandedSpec = spec && typeof spec === "object" && !Array.isArray(spec) ? expandSpecSugar(spec, sugarWarnings) : spec;
|
|
18174
18186
|
const { spec: normalized, warnings } = compile(expandedSpec);
|
|
18175
18187
|
emitSpecWarnings([...sugarWarnings, ...warnings], options.onWarn);
|
|
18176
18188
|
if (!("type" in normalized) || normalized.type !== "map") {
|
|
18177
18189
|
throw new Error(
|
|
18178
|
-
"
|
|
18190
|
+
"compileGeoMap received a non-map spec. Use compileChart, compileTileMap, compileSankey, or compileBarList instead."
|
|
18179
18191
|
);
|
|
18180
18192
|
}
|
|
18181
18193
|
const mapSpec = normalized;
|
|
@@ -23445,7 +23457,7 @@ function compileChart(spec, optionsInput) {
|
|
|
23445
23457
|
throw new Error("compileChart received a sankey spec. Use compileSankey instead.");
|
|
23446
23458
|
}
|
|
23447
23459
|
if ("type" in normalized && normalized.type === "map") {
|
|
23448
|
-
throw new Error("compileChart received a map spec. Use
|
|
23460
|
+
throw new Error("compileChart received a map spec. Use compileGeoMap instead.");
|
|
23449
23461
|
}
|
|
23450
23462
|
let chartSpec = normalized;
|
|
23451
23463
|
const rawWatermark = expandedSpec.watermark;
|
|
@@ -23743,7 +23755,7 @@ function compileChart(spec, optionsInput) {
|
|
|
23743
23755
|
const markRenderModeWarnings = [];
|
|
23744
23756
|
const markRenderMode = resolveMarkRenderMode(
|
|
23745
23757
|
{
|
|
23746
|
-
|
|
23758
|
+
requested: options.renderer,
|
|
23747
23759
|
markType: chartSpec.markType,
|
|
23748
23760
|
pointCount: marks.reduce((n, m) => m.type === "point" ? n + 1 : n, 0),
|
|
23749
23761
|
display: chartSpec.display,
|
|
@@ -24113,6 +24125,19 @@ function compileFaceted(chartSpec, renderSpec, facetChannel, facetDirection, opt
|
|
|
24113
24125
|
chartSpec.data
|
|
24114
24126
|
);
|
|
24115
24127
|
assignAnimationIndices(allMarks, resolvedAnimation);
|
|
24128
|
+
const facetRenderModeWarnings = [];
|
|
24129
|
+
resolveMarkRenderMode(
|
|
24130
|
+
{
|
|
24131
|
+
requested: options.renderer,
|
|
24132
|
+
markType: chartSpec.markType,
|
|
24133
|
+
pointCount: allMarks.reduce((n, m) => m.type === "point" ? n + 1 : n, 0),
|
|
24134
|
+
display: chartSpec.display,
|
|
24135
|
+
faceted: true,
|
|
24136
|
+
layered: options.layered ?? false
|
|
24137
|
+
},
|
|
24138
|
+
facetRenderModeWarnings
|
|
24139
|
+
);
|
|
24140
|
+
emitSpecWarnings(facetRenderModeWarnings, options.onWarn);
|
|
24116
24141
|
return {
|
|
24117
24142
|
area: chartArea,
|
|
24118
24143
|
chrome: allFootnotes.length > 0 ? { ...dims.chrome, footnotes: allFootnotes } : dims.chrome,
|
|
@@ -24185,8 +24210,8 @@ function compileSankey2(spec, options) {
|
|
|
24185
24210
|
function compileTileMap2(spec, options) {
|
|
24186
24211
|
return compileTileMap(spec, options);
|
|
24187
24212
|
}
|
|
24188
|
-
function
|
|
24189
|
-
return
|
|
24213
|
+
function compileGeoMap2(spec, options) {
|
|
24214
|
+
return compileGeoMap(spec, options);
|
|
24190
24215
|
}
|
|
24191
24216
|
function compileBarList2(spec, options) {
|
|
24192
24217
|
return compileBarList(spec, options);
|
|
@@ -24207,9 +24232,9 @@ export {
|
|
|
24207
24232
|
compile,
|
|
24208
24233
|
compileBarList2 as compileBarList,
|
|
24209
24234
|
compileChart,
|
|
24235
|
+
compileGeoMap2 as compileGeoMap,
|
|
24210
24236
|
compileGraph2 as compileGraph,
|
|
24211
24237
|
compileLayer2 as compileLayer,
|
|
24212
|
-
compileMap2 as compileMap,
|
|
24213
24238
|
compileSankey2 as compileSankey,
|
|
24214
24239
|
compileTable,
|
|
24215
24240
|
compileTileMap2 as compileTileMap,
|