@opendata-ai/openchart-core 6.24.2 → 6.25.1
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 +89 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +21 -0
- package/src/responsive/index.ts +19 -0
- package/src/responsive/metrics.ts +114 -0
- package/src/types/layout.ts +18 -0
- package/src/types/spec.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -13,12 +13,18 @@
|
|
|
13
13
|
*/
|
|
14
14
|
/** Responsive breakpoint based on container width. */
|
|
15
15
|
type Breakpoint = 'compact' | 'medium' | 'full';
|
|
16
|
+
/** Breakpoint thresholds in pixels. */
|
|
17
|
+
declare const BREAKPOINT_COMPACT_MAX = 400;
|
|
18
|
+
declare const BREAKPOINT_MEDIUM_MAX = 700;
|
|
16
19
|
/**
|
|
17
20
|
* Determine the breakpoint for a given container width.
|
|
18
21
|
*/
|
|
19
22
|
declare function getBreakpoint(width: number): Breakpoint;
|
|
20
23
|
/** Height classification based on container height. */
|
|
21
24
|
type HeightClass = 'cramped' | 'short' | 'normal';
|
|
25
|
+
/** Height class thresholds in pixels. */
|
|
26
|
+
declare const HEIGHT_CRAMPED_MAX = 200;
|
|
27
|
+
declare const HEIGHT_SHORT_MAX = 350;
|
|
22
28
|
/**
|
|
23
29
|
* Determine the height class for a given container height.
|
|
24
30
|
*/
|
|
@@ -320,6 +326,8 @@ interface AxisConfig {
|
|
|
320
326
|
titlePadding?: number;
|
|
321
327
|
/** Padding between tick labels and axis. */
|
|
322
328
|
labelPadding?: number;
|
|
329
|
+
/** Color override for axis tick labels and title. Useful in dual-axis charts to match axis color to its series. */
|
|
330
|
+
labelColor?: string;
|
|
323
331
|
}
|
|
324
332
|
/** Scale configuration for an encoding channel. */
|
|
325
333
|
interface ScaleConfig {
|
|
@@ -1805,6 +1813,8 @@ interface LineMark {
|
|
|
1805
1813
|
aria: MarkAria;
|
|
1806
1814
|
/** Index for stagger animation ordering. */
|
|
1807
1815
|
animationIndex?: number;
|
|
1816
|
+
/** Which y-scale produced this mark ('y' = left, 'y2' = right). */
|
|
1817
|
+
yScale?: 'y' | 'y2';
|
|
1808
1818
|
}
|
|
1809
1819
|
/**
|
|
1810
1820
|
* Area mark: a filled region bounded by a top line and a baseline.
|
|
@@ -1846,6 +1856,8 @@ interface AreaMark {
|
|
|
1846
1856
|
aria: MarkAria;
|
|
1847
1857
|
/** Index for stagger animation ordering. */
|
|
1848
1858
|
animationIndex?: number;
|
|
1859
|
+
/** Which y-scale produced this mark ('y' = left, 'y2' = right). */
|
|
1860
|
+
yScale?: 'y' | 'y2';
|
|
1849
1861
|
}
|
|
1850
1862
|
/**
|
|
1851
1863
|
* Rect mark: a rectangle.
|
|
@@ -1883,6 +1895,8 @@ interface RectMark {
|
|
|
1883
1895
|
stackGroup?: string;
|
|
1884
1896
|
/** Position of this segment within its stack group (0, 1, 2...). Set by engine for stacked bars. */
|
|
1885
1897
|
stackPos?: number;
|
|
1898
|
+
/** Which y-scale produced this mark ('y' = left, 'y2' = right). */
|
|
1899
|
+
yScale?: 'y' | 'y2';
|
|
1886
1900
|
}
|
|
1887
1901
|
/**
|
|
1888
1902
|
* Arc mark: a pie/donut slice.
|
|
@@ -1947,6 +1961,8 @@ interface PointMark {
|
|
|
1947
1961
|
aria: MarkAria;
|
|
1948
1962
|
/** Index for stagger animation ordering. */
|
|
1949
1963
|
animationIndex?: number;
|
|
1964
|
+
/** Which y-scale produced this mark ('y' = left, 'y2' = right). */
|
|
1965
|
+
yScale?: 'y' | 'y2';
|
|
1950
1966
|
}
|
|
1951
1967
|
/**
|
|
1952
1968
|
* Text mark: data-positioned text label.
|
|
@@ -1980,6 +1996,8 @@ interface TextMarkLayout {
|
|
|
1980
1996
|
aria: MarkAria;
|
|
1981
1997
|
/** Index for stagger animation ordering. */
|
|
1982
1998
|
animationIndex?: number;
|
|
1999
|
+
/** Which y-scale produced this mark ('y' = left, 'y2' = right). */
|
|
2000
|
+
yScale?: 'y' | 'y2';
|
|
1983
2001
|
}
|
|
1984
2002
|
/**
|
|
1985
2003
|
* Rule mark: a line segment between two points.
|
|
@@ -2009,6 +2027,8 @@ interface RuleMarkLayout {
|
|
|
2009
2027
|
aria: MarkAria;
|
|
2010
2028
|
/** Index for stagger animation ordering. */
|
|
2011
2029
|
animationIndex?: number;
|
|
2030
|
+
/** Which y-scale produced this mark ('y' = left, 'y2' = right). */
|
|
2031
|
+
yScale?: 'y' | 'y2';
|
|
2012
2032
|
}
|
|
2013
2033
|
/**
|
|
2014
2034
|
* Tick mark: a short line segment at a data coordinate.
|
|
@@ -2036,6 +2056,8 @@ interface TickMarkLayout {
|
|
|
2036
2056
|
aria: MarkAria;
|
|
2037
2057
|
/** Index for stagger animation ordering. */
|
|
2038
2058
|
animationIndex?: number;
|
|
2059
|
+
/** Which y-scale produced this mark ('y' = left, 'y2' = right). */
|
|
2060
|
+
yScale?: 'y' | 'y2';
|
|
2039
2061
|
}
|
|
2040
2062
|
/** Discriminated union of all mark types. */
|
|
2041
2063
|
type Mark = LineMark | AreaMark | RectMark | ArcMark | PointMark | TextMarkLayout | RuleMarkLayout | TickMarkLayout;
|
|
@@ -2189,6 +2211,8 @@ interface ChartLayout {
|
|
|
2189
2211
|
axes: {
|
|
2190
2212
|
x?: AxisLayout;
|
|
2191
2213
|
y?: AxisLayout;
|
|
2214
|
+
/** Right-side y-axis for independent-scale layers (dual-axis charts). */
|
|
2215
|
+
y2?: AxisLayout;
|
|
2192
2216
|
};
|
|
2193
2217
|
/** Data marks: the visual representation of data points. */
|
|
2194
2218
|
marks: Mark[];
|
|
@@ -2583,6 +2607,8 @@ interface CompileOptions {
|
|
|
2583
2607
|
* If not provided, the engine falls back to heuristic estimation.
|
|
2584
2608
|
*/
|
|
2585
2609
|
measureText?: MeasureTextFn;
|
|
2610
|
+
/** Extra pixels to reserve on the right margin for a secondary y-axis. Set by compileLayer when resolve.scale.y is 'independent'. */
|
|
2611
|
+
rightAxisReserve?: number;
|
|
2586
2612
|
}
|
|
2587
2613
|
/** Extended compile options for table visualizations. */
|
|
2588
2614
|
interface CompileTableOptions extends CompileOptions {
|
|
@@ -2829,6 +2855,68 @@ declare const COMPACT_WIDTH = 420;
|
|
|
2829
2855
|
*/
|
|
2830
2856
|
declare function wrapText(text: string, fontSize: number, fontWeight: number, maxWidth: number, measureText?: MeasureTextFn): string[];
|
|
2831
2857
|
|
|
2858
|
+
/**
|
|
2859
|
+
* Pixel-level responsive metrics for chart layout.
|
|
2860
|
+
*
|
|
2861
|
+
* These are the numeric tuning values that correspond to the semantic decisions
|
|
2862
|
+
* in LayoutStrategy. Centralizing them here ensures the engine and renderer
|
|
2863
|
+
* always agree on the same thresholds and offsets without duplicating raw numbers.
|
|
2864
|
+
*
|
|
2865
|
+
* LayoutStrategy is semantic (what to show), this module is metric (how much space).
|
|
2866
|
+
*/
|
|
2867
|
+
/** Distance from the chart edge to the rotated y-axis title center (compact viewports). */
|
|
2868
|
+
declare const AXIS_TITLE_OFFSET_COMPACT = 35;
|
|
2869
|
+
/** Distance from the chart edge to the rotated y-axis title center (standard viewports). */
|
|
2870
|
+
declare const AXIS_TITLE_OFFSET_DEFAULT = 45;
|
|
2871
|
+
/** Returns the y-axis title offset appropriate for the given container width. */
|
|
2872
|
+
declare function getAxisTitleOffset(width: number): number;
|
|
2873
|
+
/**
|
|
2874
|
+
* On compact viewports axis titles and tick labels tolerate closer container edges
|
|
2875
|
+
* than chrome text (title, subtitle). Reduce horizontal padding to reclaim space.
|
|
2876
|
+
*/
|
|
2877
|
+
declare const HPAD_COMPACT_FRACTION = 0.5;
|
|
2878
|
+
/** Minimum horizontal padding regardless of scaling. */
|
|
2879
|
+
declare const HPAD_COMPACT_MIN = 4;
|
|
2880
|
+
/**
|
|
2881
|
+
* Horizontal gap between the chart edge and the near edge of y-axis tick labels.
|
|
2882
|
+
* The engine uses this to reserve right-axis margin; the renderer uses it to position labels.
|
|
2883
|
+
* Both must agree on this value — do not change one without the other.
|
|
2884
|
+
*/
|
|
2885
|
+
declare const TICK_LABEL_OFFSET = 6;
|
|
2886
|
+
/**
|
|
2887
|
+
* Extra padding beyond half-glyph height added to the rotated axis title margin on
|
|
2888
|
+
* standard (non-compact) viewports. Omitted on compact viewports to save space.
|
|
2889
|
+
*/
|
|
2890
|
+
declare const AXIS_TITLE_TRAILING_PAD = 4;
|
|
2891
|
+
/**
|
|
2892
|
+
* Width below which "narrow" adjustments apply: extra iOS Safari top padding and
|
|
2893
|
+
* tighter category label gaps. Sits between compact (< 400) and medium (400–700).
|
|
2894
|
+
* Not a semantic breakpoint — a layout heuristic for narrow-but-not-compact containers.
|
|
2895
|
+
*/
|
|
2896
|
+
declare const NARROW_VIEWPORT_MAX = 500;
|
|
2897
|
+
/** Extra top padding added below NARROW_VIEWPORT_MAX to clear iOS Safari browser chrome. */
|
|
2898
|
+
declare const TOP_PAD_EXTRA_NARROW = 10;
|
|
2899
|
+
/** @deprecated Use NARROW_VIEWPORT_MAX instead. */
|
|
2900
|
+
declare const TOP_PAD_NARROW_MAX = 500;
|
|
2901
|
+
/** Gap between category label text and chart edge on narrow viewports (< NARROW_VIEWPORT_MAX). */
|
|
2902
|
+
declare const LABEL_GAP_COMPACT = 8;
|
|
2903
|
+
/** Gap between category label text and chart edge on standard viewports. */
|
|
2904
|
+
declare const LABEL_GAP_DEFAULT = 12;
|
|
2905
|
+
/** @deprecated Use NARROW_VIEWPORT_MAX instead. */
|
|
2906
|
+
declare const LABEL_GAP_NARROW_MAX = 500;
|
|
2907
|
+
/**
|
|
2908
|
+
* Width threshold for the medium left-label fraction cap.
|
|
2909
|
+
* Sits between medium (400-700) and full (> 700) to prevent wide category labels
|
|
2910
|
+
* from consuming too much horizontal space at mid-range widths.
|
|
2911
|
+
*/
|
|
2912
|
+
declare const MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX = 600;
|
|
2913
|
+
/** Max fraction of container width reservable for left category labels (compact). */
|
|
2914
|
+
declare const MAX_LEFT_LABEL_FRACTION_COMPACT = 0.45;
|
|
2915
|
+
/** Max fraction of container width reservable for left category labels (mid-range). */
|
|
2916
|
+
declare const MAX_LEFT_LABEL_FRACTION_MEDIUM = 0.55;
|
|
2917
|
+
/** Max fraction of container width reservable for left category labels (standard). */
|
|
2918
|
+
declare const MAX_LEFT_LABEL_FRACTION_DEFAULT = 1;
|
|
2919
|
+
|
|
2832
2920
|
/**
|
|
2833
2921
|
* Label collision detection and resolution.
|
|
2834
2922
|
*
|
|
@@ -3151,4 +3239,4 @@ declare function scatterChart(data: DataRow[], x: FieldRef, y: FieldRef, options
|
|
|
3151
3239
|
*/
|
|
3152
3240
|
declare function dataTable(data: DataRow[], options?: TableBuilderOptions): TableSpec;
|
|
3153
3241
|
|
|
3154
|
-
export { type A11yMetadata, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationOffset, type AnnotationPosition, type ArcMark, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, type BarColumnConfig, type BarTableCell, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, CHART_ENCODING_RULES, CHART_TYPES, COMPACT_WIDTH, type CalculateExpression, type CalculateTransform, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type ChartType, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type Condition, type ConditionalValueDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type FieldPredicate, type FieldRef, type FieldType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientDef, type GradientStop, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LayerSpec, type LayoutStrategy, type LegendConfig, type LegendEntry, type LegendLayout, type LegendPosition, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type NodeOverride, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type Point, type PointMark, type RadialGradient, type RangeAnnotation, type Rect, type RectMark, type RefLineAnnotation, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedLabel, type ResolvedTheme, type RuleMarkLayout, SEQUENTIAL_PALETTES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleType, type SequentialPalette, type SeriesStyle, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickMarkLayout, type TimeUnit, type TimeUnitTransform, type TooltipContent, type TooltipField, type Transform, type VizSpec, abbreviateNumber, adaptColorForDarkMode, adaptTheme, areaChart, barChart, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeLabelBounds, contrastRatio, dataTable, detectCollision, donutChart, dotChart, elementRef, estimateTextWidth, findAccessibleColor, formatDate, formatNumber, generateAltText, generateAriaLabels, generateDataTable, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, inferFieldType, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, lineChart, meetsAA, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveTheme, scatterChart, simulateColorBlindness, wrapText };
|
|
3242
|
+
export { type A11yMetadata, 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 AnnotationOffset, type AnnotationPosition, type ArcMark, 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 BarTableCell, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, CHART_ENCODING_RULES, CHART_TYPES, COMPACT_WIDTH, type CalculateExpression, type CalculateTransform, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type ChartType, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type Condition, type ConditionalValueDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type FieldPredicate, type FieldRef, type FieldType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientDef, type GradientStop, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, 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 LayerSpec, type LayoutStrategy, type LegendConfig, type LegendEntry, type LegendLayout, type LegendPosition, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, 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 Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, NARROW_VIEWPORT_MAX, type NodeOverride, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type Point, type PointMark, type RadialGradient, type RangeAnnotation, type Rect, type RectMark, type RefLineAnnotation, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedLabel, type ResolvedTheme, type RuleMarkLayout, SEQUENTIAL_PALETTES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleType, type SequentialPalette, type SeriesStyle, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, 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 TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickMarkLayout, type TimeUnit, type TimeUnitTransform, type TooltipContent, type TooltipField, type Transform, type VizSpec, abbreviateNumber, adaptColorForDarkMode, adaptTheme, areaChart, barChart, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeLabelBounds, contrastRatio, dataTable, detectCollision, donutChart, dotChart, elementRef, estimateTextWidth, findAccessibleColor, formatDate, formatNumber, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, inferFieldType, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, lineChart, meetsAA, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveTheme, scatterChart, simulateColorBlindness, wrapText };
|
package/dist/index.js
CHANGED
|
@@ -1395,6 +1395,27 @@ function getLayoutStrategy(breakpoint, heightClass = "normal") {
|
|
|
1395
1395
|
return applyHeightConstraints(base, heightClass);
|
|
1396
1396
|
}
|
|
1397
1397
|
|
|
1398
|
+
// src/responsive/metrics.ts
|
|
1399
|
+
var AXIS_TITLE_OFFSET_COMPACT = 35;
|
|
1400
|
+
var AXIS_TITLE_OFFSET_DEFAULT = 45;
|
|
1401
|
+
function getAxisTitleOffset(width) {
|
|
1402
|
+
return width < BREAKPOINT_COMPACT_MAX ? AXIS_TITLE_OFFSET_COMPACT : AXIS_TITLE_OFFSET_DEFAULT;
|
|
1403
|
+
}
|
|
1404
|
+
var HPAD_COMPACT_FRACTION = 0.5;
|
|
1405
|
+
var HPAD_COMPACT_MIN = 4;
|
|
1406
|
+
var TICK_LABEL_OFFSET = 6;
|
|
1407
|
+
var AXIS_TITLE_TRAILING_PAD = 4;
|
|
1408
|
+
var NARROW_VIEWPORT_MAX = 500;
|
|
1409
|
+
var TOP_PAD_EXTRA_NARROW = 10;
|
|
1410
|
+
var TOP_PAD_NARROW_MAX = NARROW_VIEWPORT_MAX;
|
|
1411
|
+
var LABEL_GAP_COMPACT = 8;
|
|
1412
|
+
var LABEL_GAP_DEFAULT = 12;
|
|
1413
|
+
var LABEL_GAP_NARROW_MAX = NARROW_VIEWPORT_MAX;
|
|
1414
|
+
var MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX = 600;
|
|
1415
|
+
var MAX_LEFT_LABEL_FRACTION_COMPACT = 0.45;
|
|
1416
|
+
var MAX_LEFT_LABEL_FRACTION_MEDIUM = 0.55;
|
|
1417
|
+
var MAX_LEFT_LABEL_FRACTION_DEFAULT = 1;
|
|
1418
|
+
|
|
1398
1419
|
// src/labels/collision.ts
|
|
1399
1420
|
var PRIORITY_ORDER = {
|
|
1400
1421
|
data: 0,
|
|
@@ -2836,9 +2857,14 @@ function dataTable(data, options) {
|
|
|
2836
2857
|
return spec;
|
|
2837
2858
|
}
|
|
2838
2859
|
export {
|
|
2860
|
+
AXIS_TITLE_OFFSET_COMPACT,
|
|
2861
|
+
AXIS_TITLE_OFFSET_DEFAULT,
|
|
2862
|
+
AXIS_TITLE_TRAILING_PAD,
|
|
2839
2863
|
BRAND_FONT_SIZE,
|
|
2840
2864
|
BRAND_MIN_WIDTH,
|
|
2841
2865
|
BRAND_RESERVE_WIDTH,
|
|
2866
|
+
BREAKPOINT_COMPACT_MAX,
|
|
2867
|
+
BREAKPOINT_MEDIUM_MAX,
|
|
2842
2868
|
CATEGORICAL_PALETTE,
|
|
2843
2869
|
CHART_ENCODING_RULES,
|
|
2844
2870
|
CHART_TYPES,
|
|
@@ -2847,11 +2873,26 @@ export {
|
|
|
2847
2873
|
DIVERGING_PALETTES,
|
|
2848
2874
|
EXTENDED_OFFSET_STRATEGIES,
|
|
2849
2875
|
GRAPH_ENCODING_RULES,
|
|
2876
|
+
HEIGHT_CRAMPED_MAX,
|
|
2877
|
+
HEIGHT_SHORT_MAX,
|
|
2878
|
+
HPAD_COMPACT_FRACTION,
|
|
2879
|
+
HPAD_COMPACT_MIN,
|
|
2880
|
+
LABEL_GAP_COMPACT,
|
|
2881
|
+
LABEL_GAP_DEFAULT,
|
|
2882
|
+
LABEL_GAP_NARROW_MAX,
|
|
2850
2883
|
MARK_DISPLAY_NAMES,
|
|
2851
2884
|
MARK_ENCODING_RULES,
|
|
2852
2885
|
MARK_TYPES,
|
|
2886
|
+
MAX_LEFT_LABEL_FRACTION_COMPACT,
|
|
2887
|
+
MAX_LEFT_LABEL_FRACTION_DEFAULT,
|
|
2888
|
+
MAX_LEFT_LABEL_FRACTION_MEDIUM,
|
|
2889
|
+
MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX,
|
|
2890
|
+
NARROW_VIEWPORT_MAX,
|
|
2853
2891
|
OFFSET_STRATEGIES,
|
|
2854
2892
|
SEQUENTIAL_PALETTES,
|
|
2893
|
+
TICK_LABEL_OFFSET,
|
|
2894
|
+
TOP_PAD_EXTRA_NARROW,
|
|
2895
|
+
TOP_PAD_NARROW_MAX,
|
|
2855
2896
|
abbreviateNumber,
|
|
2856
2897
|
adaptColorForDarkMode,
|
|
2857
2898
|
adaptTheme,
|
|
@@ -2876,6 +2917,7 @@ export {
|
|
|
2876
2917
|
generateAltText,
|
|
2877
2918
|
generateAriaLabels,
|
|
2878
2919
|
generateDataTable,
|
|
2920
|
+
getAxisTitleOffset,
|
|
2879
2921
|
getBreakpoint,
|
|
2880
2922
|
getHeightClass,
|
|
2881
2923
|
getLayoutStrategy,
|