@opendata-ai/openchart-core 8.0.0-rc.19 → 8.0.0-rc.20
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 +74 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
- package/schema/chart.schema.json +175 -1
- package/schema/table.schema.json +31 -1
- package/schema/vizspec.schema.json +319 -1
package/dist/index.d.ts
CHANGED
|
@@ -563,6 +563,25 @@ interface MarkDef {
|
|
|
563
563
|
* - `'none'` (default): solid fills only.
|
|
564
564
|
*/
|
|
565
565
|
fillPattern?: 'auto' | 'none';
|
|
566
|
+
/**
|
|
567
|
+
* Rendering backend for point marks. High-cardinality scatter plots draw
|
|
568
|
+
* thousands of SVG circles, which is what makes their entrance and update
|
|
569
|
+
* transitions stutter; a canvas layer draws the same dots in a handful of
|
|
570
|
+
* batched paint calls.
|
|
571
|
+
*
|
|
572
|
+
* - `'auto'` (default): canvas above 1,000 compiled point marks, SVG below.
|
|
573
|
+
* - `'svg'`: always SVG, whatever the point count.
|
|
574
|
+
* - `'canvas'`: always canvas, whatever the point count.
|
|
575
|
+
*
|
|
576
|
+
* Canvas mode trades per-mark keyboard focus and edit-mode point selection
|
|
577
|
+
* (the screen-reader data table still carries every row), and draws the
|
|
578
|
+
* trendline above the dots even when `trendline.layer` is `'below'`.
|
|
579
|
+
* Tooltips, hover, and click callbacks work the same in both modes.
|
|
580
|
+
*
|
|
581
|
+
* Ignored with a console warning for non-point marks, and for faceted,
|
|
582
|
+
* layered, and sparkline charts.
|
|
583
|
+
*/
|
|
584
|
+
render?: 'auto' | 'svg' | 'canvas';
|
|
566
585
|
/**
|
|
567
586
|
* Visual style for range marks. Only meaningful when `type` is `'range'`.
|
|
568
587
|
* - 'dumbbell' (default): a dot at each end joined by a connector line.
|
|
@@ -1722,6 +1741,20 @@ interface AnimationPhaseConfig {
|
|
|
1722
1741
|
/** Stagger config. true = defaults, false = no stagger. Default: true for enter. */
|
|
1723
1742
|
stagger?: AnimationStagger | boolean;
|
|
1724
1743
|
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Data-update phase config. Adds `maxMarks` on top of the shared phase
|
|
1746
|
+
* options; the cap is meaningless for enter/exit, which animate via CSS.
|
|
1747
|
+
*/
|
|
1748
|
+
interface UpdatePhaseConfig extends AnimationPhaseConfig {
|
|
1749
|
+
/**
|
|
1750
|
+
* Maximum mark count that still runs a tweened data-update transition.
|
|
1751
|
+
* Default: 500. Above the cap the chart swaps instantly instead, because
|
|
1752
|
+
* per-frame SVG attribute writes on thousands of elements drop frames on
|
|
1753
|
+
* low-end devices. Raise it deliberately when the audience is desktop-heavy
|
|
1754
|
+
* and you have measured the frame budget.
|
|
1755
|
+
*/
|
|
1756
|
+
maxMarks?: number;
|
|
1757
|
+
}
|
|
1725
1758
|
/**
|
|
1726
1759
|
* Full animation config object. Structured as enter/update/exit phases
|
|
1727
1760
|
* following Vega's encoding set model.
|
|
@@ -1730,7 +1763,7 @@ interface AnimationConfig {
|
|
|
1730
1763
|
/** Entrance animation when chart first renders. */
|
|
1731
1764
|
enter?: AnimationPhaseConfig | boolean;
|
|
1732
1765
|
/** Transition animation when data updates. */
|
|
1733
|
-
update?:
|
|
1766
|
+
update?: UpdatePhaseConfig | boolean;
|
|
1734
1767
|
/** Exit animation when marks are removed. */
|
|
1735
1768
|
exit?: AnimationPhaseConfig | boolean;
|
|
1736
1769
|
/** Delay before annotations animate in (ms after marks). Default: 200. */
|
|
@@ -4257,6 +4290,12 @@ interface A11yMetadata {
|
|
|
4257
4290
|
altText: string;
|
|
4258
4291
|
/** Tabular data fallback for screen readers. Each inner array is a row. */
|
|
4259
4292
|
dataTableFallback: unknown[][];
|
|
4293
|
+
/**
|
|
4294
|
+
* True row count of the underlying data. Only set when `dataTableFallback`
|
|
4295
|
+
* was truncated, so its presence is the signal that rows are missing and the
|
|
4296
|
+
* caption should name the total.
|
|
4297
|
+
*/
|
|
4298
|
+
totalRows?: number;
|
|
4260
4299
|
/** ARIA role for the visualization root element. */
|
|
4261
4300
|
role: string;
|
|
4262
4301
|
/** Whether the visualization is keyboard-navigable. */
|
|
@@ -4279,6 +4318,12 @@ interface ResolvedAnimationPhase {
|
|
|
4279
4318
|
staggerDelay: number;
|
|
4280
4319
|
/** Stagger ordering. */
|
|
4281
4320
|
staggerOrder: 'index' | 'value' | 'reverse';
|
|
4321
|
+
/**
|
|
4322
|
+
* Author-set cap on the mark count that still runs a tweened data-update
|
|
4323
|
+
* transition (update phase only). Present only when explicitly set on the
|
|
4324
|
+
* spec — the renderer supplies the default so it can vary by render mode.
|
|
4325
|
+
*/
|
|
4326
|
+
maxMarks?: number;
|
|
4282
4327
|
}
|
|
4283
4328
|
/** Resolved animation config. A phase is present iff that phase is enabled. */
|
|
4284
4329
|
interface ResolvedAnimation {
|
|
@@ -4531,6 +4576,16 @@ interface ChartLayout {
|
|
|
4531
4576
|
yInvert?: ScaleInvert;
|
|
4532
4577
|
/** Faceted (small-multiples) layout. When present, renderers iterate panels instead of using top-level marks/axes. */
|
|
4533
4578
|
facet?: FacetLayout;
|
|
4579
|
+
/**
|
|
4580
|
+
* Resolved rendering backend for point marks. Absent means `'svg'`.
|
|
4581
|
+
*
|
|
4582
|
+
* ADVISORY metadata only: it tells the mount and export layers that a canvas
|
|
4583
|
+
* mark layer is worth creating for this layout. The SVG renderer keys solely
|
|
4584
|
+
* on its own `canvasMarks` render option and never reads this field, so a
|
|
4585
|
+
* server-side or export render of a canvas-mode layout still produces
|
|
4586
|
+
* full-fidelity SVG.
|
|
4587
|
+
*/
|
|
4588
|
+
markRenderMode?: 'svg' | 'canvas';
|
|
4534
4589
|
}
|
|
4535
4590
|
/** A resolved column definition with computed properties. */
|
|
4536
4591
|
interface ResolvedColumn {
|
|
@@ -5231,6 +5286,13 @@ interface CompileOptions {
|
|
|
5231
5286
|
* different area than the one the axes are rendered in.
|
|
5232
5287
|
*/
|
|
5233
5288
|
frozenChartArea?: Rect;
|
|
5289
|
+
/**
|
|
5290
|
+
* Marks this compile as one leaf (or the primary spec) of a multi-leaf layer.
|
|
5291
|
+
* Set by compileLayer; callers should not set it. Only consumer today is the
|
|
5292
|
+
* canvas mark-layer resolution, which refuses canvas mode for layered charts
|
|
5293
|
+
* because the layer layout concatenates marks from several compiles.
|
|
5294
|
+
*/
|
|
5295
|
+
layered?: boolean;
|
|
5234
5296
|
}
|
|
5235
5297
|
/** Extended compile options for table visualizations. */
|
|
5236
5298
|
interface CompileTableOptions extends CompileOptions {
|
|
@@ -5941,12 +6003,22 @@ declare function buildTemporalFormatter(formatStr: string | undefined): ((value:
|
|
|
5941
6003
|
* @param data - The data array.
|
|
5942
6004
|
*/
|
|
5943
6005
|
declare function generateAltText(spec: ChartSpec, data: DataRow[]): string;
|
|
6006
|
+
/**
|
|
6007
|
+
* Maximum number of data rows in the screen-reader table. A 50k-point scatter
|
|
6008
|
+
* would otherwise put 50k hidden rows in the DOM.
|
|
6009
|
+
*/
|
|
6010
|
+
declare const MAX_SR_TABLE_ROWS = 1000;
|
|
5944
6011
|
/**
|
|
5945
6012
|
* Generate a tabular data fallback for screen readers.
|
|
5946
6013
|
*
|
|
5947
6014
|
* Returns a 2D array where the first row is headers and subsequent
|
|
5948
6015
|
* rows are data values. Only includes fields referenced in the encoding.
|
|
5949
6016
|
*
|
|
6017
|
+
* Data rows are capped at MAX_SR_TABLE_ROWS (the header row does not count
|
|
6018
|
+
* against the cap). SCOPE: this caps the chart compile path only. Graph,
|
|
6019
|
+
* sankey, tilemap and map build their `dataTableFallback` independently and
|
|
6020
|
+
* stay uncapped.
|
|
6021
|
+
*
|
|
5950
6022
|
* @param spec - The chart spec.
|
|
5951
6023
|
* @param data - The data array.
|
|
5952
6024
|
*/
|
|
@@ -6199,4 +6271,4 @@ declare const CSS_TOKEN_ROOT_SELECTORS: readonly string[];
|
|
|
6199
6271
|
declare const CSS_TOKENS: readonly CssTokenDef[];
|
|
6200
6272
|
declare function cssTokenDefault(name: string, mode: 'light' | 'dark'): string;
|
|
6201
6273
|
|
|
6202
|
-
export { type A11yConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type Display, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphAnimationConfig, type GraphAnimationSpec, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphInteractionConfig, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, type MapBorders, type MapEncoding, type MapFeatureMark, type MapFocus, type MapFocusLayout, type MapGeo, type MapLayout, type MapPointMark, type MapPointsLayer, type MapProjection, type MapSpec, type MapSpecWithoutData, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type Metric, NARROW_VIEWPORT_MAX, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type Point, type PointEncoding, type PointMark, type RadialGradient, type RangeAnnotation, type RangeEncoding, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedYouDrawIt, type ResponsiveConfig, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleInvert, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, areaChart, axisTitleOffset, barChart, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, dataTable, deepMergeSpec, defaultNumberFormatter, detectCollision, donutChart, dotChart, editorial, elementRef, essay, estimateTextWidth, findAccessibleColor, footnoteBandHeight, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isMapSpec, isOpaqueColor, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, lineChart, maxRotatedLabelWidth, meetsAA, overlapArea, pickLabelColor, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, scatterChart, simulateColorBlindness, textAscent, tileMap, truncateRotatedLabel, truncateToWidth, wire, wrapText };
|
|
6274
|
+
export { type A11yConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type Display, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphAnimationConfig, type GraphAnimationSpec, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphInteractionConfig, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, MAX_SR_TABLE_ROWS, type MapBorders, type MapEncoding, type MapFeatureMark, type MapFocus, type MapFocusLayout, type MapGeo, type MapLayout, type MapPointMark, type MapPointsLayer, type MapProjection, type MapSpec, type MapSpecWithoutData, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type Metric, NARROW_VIEWPORT_MAX, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type Point, type PointEncoding, type PointMark, type RadialGradient, type RangeAnnotation, type RangeEncoding, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedYouDrawIt, type ResponsiveConfig, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleInvert, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, type UpdatePhaseConfig, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, areaChart, axisTitleOffset, barChart, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, dataTable, deepMergeSpec, defaultNumberFormatter, detectCollision, donutChart, dotChart, editorial, elementRef, essay, estimateTextWidth, findAccessibleColor, footnoteBandHeight, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isMapSpec, isOpaqueColor, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, lineChart, maxRotatedLabelWidth, meetsAA, overlapArea, pickLabelColor, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, scatterChart, simulateColorBlindness, textAscent, tileMap, truncateRotatedLabel, truncateToWidth, wire, wrapText };
|
package/dist/index.js
CHANGED
|
@@ -3622,6 +3622,7 @@ function generateAltText(spec, data) {
|
|
|
3622
3622
|
parts.push(`(${data.length} data points)`);
|
|
3623
3623
|
return parts.join(" ");
|
|
3624
3624
|
}
|
|
3625
|
+
var MAX_SR_TABLE_ROWS = 1e3;
|
|
3625
3626
|
function generateDataTable(spec, data) {
|
|
3626
3627
|
const fields = [];
|
|
3627
3628
|
const encoding = spec.encoding;
|
|
@@ -3632,7 +3633,7 @@ function generateDataTable(spec, data) {
|
|
|
3632
3633
|
const uniqueFields = [...new Set(fields)];
|
|
3633
3634
|
if (uniqueFields.length === 0) return [];
|
|
3634
3635
|
const headers = uniqueFields;
|
|
3635
|
-
const rows = data.map((row) => uniqueFields.map((field) => row[field] ?? ""));
|
|
3636
|
+
const rows = data.slice(0, MAX_SR_TABLE_ROWS).map((row) => uniqueFields.map((field) => row[field] ?? ""));
|
|
3636
3637
|
return [headers, ...rows];
|
|
3637
3638
|
}
|
|
3638
3639
|
|
|
@@ -4054,6 +4055,7 @@ export {
|
|
|
4054
4055
|
MAX_LEFT_LABEL_FRACTION_DEFAULT,
|
|
4055
4056
|
MAX_LEFT_LABEL_FRACTION_MEDIUM,
|
|
4056
4057
|
MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX,
|
|
4058
|
+
MAX_SR_TABLE_ROWS,
|
|
4057
4059
|
NARROW_VIEWPORT_MAX,
|
|
4058
4060
|
OFFSET_STRATEGIES,
|
|
4059
4061
|
SEQUENTIAL_PALETTES,
|