@opendata-ai/openchart-core 6.11.0 → 6.13.0
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 +83 -10
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/__tests__/spec-builders.test.ts +4 -4
- package/src/index.ts +1 -2
- package/src/layout/__tests__/chrome.test.ts +15 -0
- package/src/layout/chrome.ts +6 -4
- package/src/types/index.ts +2 -0
- package/src/types/layout.ts +8 -0
- package/src/types/spec.ts +88 -10
package/dist/index.d.ts
CHANGED
|
@@ -287,7 +287,7 @@ interface MarkDef {
|
|
|
287
287
|
/** Data field type, following Vega-Lite conventions. */
|
|
288
288
|
type FieldType = 'quantitative' | 'temporal' | 'nominal' | 'ordinal';
|
|
289
289
|
/** Aggregate function applied to a field before encoding. */
|
|
290
|
-
type AggregateOp = 'count' | 'sum' | 'mean' | 'median' | 'min' | 'max';
|
|
290
|
+
type AggregateOp = 'count' | 'sum' | 'mean' | 'median' | 'min' | 'max' | 'variance' | 'stdev' | 'distinct' | 'q1' | 'q3';
|
|
291
291
|
/** Axis configuration for an encoding channel. */
|
|
292
292
|
interface AxisConfig {
|
|
293
293
|
/** Axis title text. If omitted, the field name is used. */
|
|
@@ -318,10 +318,6 @@ interface AxisConfig {
|
|
|
318
318
|
titlePadding?: number;
|
|
319
319
|
/** Padding between tick labels and axis. */
|
|
320
320
|
labelPadding?: number;
|
|
321
|
-
/** @deprecated Use `title` instead. */
|
|
322
|
-
label?: string;
|
|
323
|
-
/** @deprecated Use `labelAngle` instead. */
|
|
324
|
-
tickAngle?: number;
|
|
325
321
|
}
|
|
326
322
|
/** Scale configuration for an encoding channel. */
|
|
327
323
|
interface ScaleConfig {
|
|
@@ -382,10 +378,47 @@ interface EncodingChannel {
|
|
|
382
378
|
scale?: ScaleConfig;
|
|
383
379
|
/**
|
|
384
380
|
* Stacking behavior for quantitative channels (Vega-Lite aligned).
|
|
385
|
-
* - undefined | true | 'zero': stack (default
|
|
381
|
+
* - undefined | true | 'zero': stack from zero baseline (default)
|
|
382
|
+
* - 'normalize': stack and normalize to fraction of total (0-1 per category)
|
|
383
|
+
* - 'center': center stacks around zero (streamgraph style)
|
|
386
384
|
* - null | false: no stacking (grouped/dodged side-by-side)
|
|
387
385
|
*/
|
|
388
|
-
stack?: boolean | 'zero' | null;
|
|
386
|
+
stack?: boolean | 'zero' | 'normalize' | 'center' | null;
|
|
387
|
+
/**
|
|
388
|
+
* Encoding-level bin shorthand (Vega-Lite aligned).
|
|
389
|
+
* When set, auto-generates a BinTransform during normalization and updates
|
|
390
|
+
* the field reference to the binned output (convention: `bin_<fieldName>`).
|
|
391
|
+
* - true: bin with default params
|
|
392
|
+
* - BinParams: bin with custom params (maxbins, step, etc.)
|
|
393
|
+
*/
|
|
394
|
+
bin?: boolean | BinParams;
|
|
395
|
+
/**
|
|
396
|
+
* Encoding-level timeUnit shorthand (Vega-Lite aligned).
|
|
397
|
+
* When set, auto-generates a TimeUnitTransform during normalization and
|
|
398
|
+
* updates the field reference to the output (convention: `<timeUnit>_<fieldName>`).
|
|
399
|
+
*/
|
|
400
|
+
timeUnit?: TimeUnit;
|
|
401
|
+
/**
|
|
402
|
+
* Sort order for categorical (nominal/ordinal) scale domains (Vega-Lite aligned).
|
|
403
|
+
* - 'ascending': sort domain values ascending (default VL behavior)
|
|
404
|
+
* - 'descending': sort domain values descending
|
|
405
|
+
* - null: use data order (no sorting)
|
|
406
|
+
* - undefined: ascending (VL default)
|
|
407
|
+
*/
|
|
408
|
+
sort?: 'ascending' | 'descending' | null;
|
|
409
|
+
/**
|
|
410
|
+
* Display title override (Vega-Lite aligned).
|
|
411
|
+
* Used as the label in tooltips instead of the raw field name.
|
|
412
|
+
* Also usable for axis titles, but `axis.title` takes precedence there.
|
|
413
|
+
*/
|
|
414
|
+
title?: string;
|
|
415
|
+
/**
|
|
416
|
+
* Format string for values (Vega-Lite aligned).
|
|
417
|
+
* For quantitative fields: d3-format string (e.g. ",.0f", "$,.2f").
|
|
418
|
+
* For temporal fields: d3-time-format string (e.g. "%Y", "%b %d").
|
|
419
|
+
* Used in tooltips; `axis.format` takes precedence for axis tick labels.
|
|
420
|
+
*/
|
|
421
|
+
format?: string;
|
|
389
422
|
}
|
|
390
423
|
/**
|
|
391
424
|
* Encoding object mapping visual channels to data fields.
|
|
@@ -815,6 +848,8 @@ interface ChartSpec {
|
|
|
815
848
|
theme?: ThemeConfig;
|
|
816
849
|
/** Dark mode behavior. Defaults to "off". */
|
|
817
850
|
darkMode?: DarkMode;
|
|
851
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
852
|
+
watermark?: boolean;
|
|
818
853
|
/** Series names to hide from rendering. Hidden series remain in the legend but are visually dimmed. */
|
|
819
854
|
hiddenSeries?: string[];
|
|
820
855
|
/** Per-series visual overrides, keyed by series name (the color field value). */
|
|
@@ -854,6 +889,8 @@ interface TableSpec {
|
|
|
854
889
|
theme?: ThemeConfig;
|
|
855
890
|
/** Dark mode behavior. */
|
|
856
891
|
darkMode?: DarkMode;
|
|
892
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
893
|
+
watermark?: boolean;
|
|
857
894
|
/** Enable client-side search/filter. */
|
|
858
895
|
search?: boolean;
|
|
859
896
|
/** Pagination configuration. True for defaults, or an object with pageSize. */
|
|
@@ -919,6 +956,8 @@ interface GraphSpec {
|
|
|
919
956
|
theme?: ThemeConfig;
|
|
920
957
|
/** Dark mode behavior. */
|
|
921
958
|
darkMode?: DarkMode;
|
|
959
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
960
|
+
watermark?: boolean;
|
|
922
961
|
}
|
|
923
962
|
/**
|
|
924
963
|
* Resolution strategy for shared resources across layers.
|
|
@@ -965,6 +1004,8 @@ interface LayerSpec {
|
|
|
965
1004
|
theme?: ThemeConfig;
|
|
966
1005
|
/** Dark mode behavior. Defaults to "off". */
|
|
967
1006
|
darkMode?: DarkMode;
|
|
1007
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
1008
|
+
watermark?: boolean;
|
|
968
1009
|
/** Resolution strategy for shared scales/axes/legends. */
|
|
969
1010
|
resolve?: ResolveConfig;
|
|
970
1011
|
/** Hidden series names. */
|
|
@@ -1023,6 +1064,8 @@ interface SankeySpec {
|
|
|
1023
1064
|
theme?: ThemeConfig;
|
|
1024
1065
|
/** Dark mode behavior. Defaults to "off". */
|
|
1025
1066
|
darkMode?: DarkMode;
|
|
1067
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
1068
|
+
watermark?: boolean;
|
|
1026
1069
|
/** Animation configuration for entrance animations. */
|
|
1027
1070
|
animation?: AnimationSpec;
|
|
1028
1071
|
/**
|
|
@@ -1139,8 +1182,30 @@ interface TimeUnitTransform {
|
|
|
1139
1182
|
field: string;
|
|
1140
1183
|
as: string;
|
|
1141
1184
|
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Aggregate transform: group rows and compute summary statistics (VL aligned).
|
|
1187
|
+
* Produces one row per group with the groupby fields and computed aggregates.
|
|
1188
|
+
*/
|
|
1189
|
+
interface AggregateTransform {
|
|
1190
|
+
aggregate: Array<{
|
|
1191
|
+
op: AggregateOp;
|
|
1192
|
+
field: string;
|
|
1193
|
+
as: string;
|
|
1194
|
+
}>;
|
|
1195
|
+
groupby: string[];
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Fold transform: unpivot wide-format columns into key/value rows (VL aligned).
|
|
1199
|
+
* For each input row, produces N output rows (one per fold field) with all
|
|
1200
|
+
* non-fold fields copied plus a key column (field name) and value column (field value).
|
|
1201
|
+
*/
|
|
1202
|
+
interface FoldTransform {
|
|
1203
|
+
fold: string[];
|
|
1204
|
+
/** Output field names for [key, value]. Defaults to ['key', 'value']. */
|
|
1205
|
+
as?: [string, string];
|
|
1206
|
+
}
|
|
1142
1207
|
/** Discriminated union of all transform types. */
|
|
1143
|
-
type Transform = FilterTransform | BinTransform | CalculateTransform | TimeUnitTransform;
|
|
1208
|
+
type Transform = FilterTransform | BinTransform | CalculateTransform | TimeUnitTransform | AggregateTransform | FoldTransform;
|
|
1144
1209
|
/**
|
|
1145
1210
|
* A single condition with a test predicate and resulting value/field.
|
|
1146
1211
|
* When the test passes for a datum, the condition's value/field is used.
|
|
@@ -2124,6 +2189,8 @@ interface ChartLayout {
|
|
|
2124
2189
|
};
|
|
2125
2190
|
/** Resolved animation config. Present only when animation is enabled. */
|
|
2126
2191
|
animation?: ResolvedAnimation;
|
|
2192
|
+
/** Whether the tryOpenData.ai watermark is enabled. */
|
|
2193
|
+
watermark: boolean;
|
|
2127
2194
|
}
|
|
2128
2195
|
/** A resolved column definition with computed properties. */
|
|
2129
2196
|
interface ResolvedColumn {
|
|
@@ -2284,6 +2351,8 @@ interface TableLayout {
|
|
|
2284
2351
|
theme: ResolvedTheme;
|
|
2285
2352
|
/** Resolved animation config. Present only when animation is enabled. */
|
|
2286
2353
|
animation?: ResolvedAnimation;
|
|
2354
|
+
/** Whether the tryOpenData.ai watermark is enabled. */
|
|
2355
|
+
watermark: boolean;
|
|
2287
2356
|
}
|
|
2288
2357
|
/** A resolved graph node with computed position and visual properties. */
|
|
2289
2358
|
interface GraphNodeLayout {
|
|
@@ -2453,6 +2522,8 @@ interface SankeyLayout {
|
|
|
2453
2522
|
};
|
|
2454
2523
|
/** Resolved animation config. Present only when animation is enabled. */
|
|
2455
2524
|
animation?: ResolvedAnimation;
|
|
2525
|
+
/** Whether the tryOpenData.ai watermark is enabled. */
|
|
2526
|
+
watermark: boolean;
|
|
2456
2527
|
}
|
|
2457
2528
|
/** Function signature for text measurement provided by adapters. */
|
|
2458
2529
|
type MeasureTextFn = (text: string, fontSize: number, fontWeight?: number) => {
|
|
@@ -2480,6 +2551,8 @@ interface CompileOptions {
|
|
|
2480
2551
|
* before calling compile. The engine always receives a resolved boolean.
|
|
2481
2552
|
*/
|
|
2482
2553
|
darkMode?: boolean;
|
|
2554
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
2555
|
+
watermark?: boolean;
|
|
2483
2556
|
/**
|
|
2484
2557
|
* Real text measurement function provided by the adapter.
|
|
2485
2558
|
* Uses a hidden canvas or DOM element for accurate text dimensions.
|
|
@@ -2675,7 +2748,7 @@ declare function resolveTheme(userTheme?: ThemeConfig, base?: Theme): ResolvedTh
|
|
|
2675
2748
|
* @param chromeMode - Chrome display mode: full, compact (title only), or hidden.
|
|
2676
2749
|
* @param padding - Override padding (for scaled padding from dimensions).
|
|
2677
2750
|
*/
|
|
2678
|
-
declare function computeChrome(chrome: Chrome | undefined, theme: ResolvedTheme, width: number, measureText?: MeasureTextFn, chromeMode?: ChromeMode, padding?: number): ResolvedChrome;
|
|
2751
|
+
declare function computeChrome(chrome: Chrome | undefined, theme: ResolvedTheme, width: number, measureText?: MeasureTextFn, chromeMode?: ChromeMode, padding?: number, watermark?: boolean): ResolvedChrome;
|
|
2679
2752
|
|
|
2680
2753
|
/**
|
|
2681
2754
|
* Estimate the rendered width of a text string.
|
|
@@ -3022,4 +3095,4 @@ declare function scatterChart(data: DataRow[], x: FieldRef, y: FieldRef, options
|
|
|
3022
3095
|
*/
|
|
3023
3096
|
declare function dataTable(data: DataRow[], options?: TableBuilderOptions): TableSpec;
|
|
3024
3097
|
|
|
3025
|
-
export { type A11yMetadata, type AggregateOp, 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, 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, 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 };
|
|
3098
|
+
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, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1108,7 +1108,7 @@ function estimateLineCount(text, style, maxWidth, _measureText) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
return lines;
|
|
1110
1110
|
}
|
|
1111
|
-
function computeChrome(chrome, theme, width, measureText, chromeMode = "full", padding) {
|
|
1111
|
+
function computeChrome(chrome, theme, width, measureText, chromeMode = "full", padding, watermark = true) {
|
|
1112
1112
|
if (!chrome || chromeMode === "hidden") {
|
|
1113
1113
|
return { topHeight: 0, bottomHeight: 0 };
|
|
1114
1114
|
}
|
|
@@ -1162,7 +1162,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1162
1162
|
const topHeight = hasTopChrome ? topY - pad2 + theme.spacing.chromeToChart - chromeGap : 0;
|
|
1163
1163
|
if (chromeMode === "compact") {
|
|
1164
1164
|
let compactBottom = 0;
|
|
1165
|
-
if (width >= BRAND_MIN_WIDTH) {
|
|
1165
|
+
if (watermark && width >= BRAND_MIN_WIDTH) {
|
|
1166
1166
|
const brandHeight = estimateTextHeight(BRAND_FONT_SIZE, 1);
|
|
1167
1167
|
compactBottom = theme.spacing.chartToFooter + brandHeight + pad2;
|
|
1168
1168
|
}
|
|
@@ -1172,7 +1172,8 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1172
1172
|
...topElements
|
|
1173
1173
|
};
|
|
1174
1174
|
}
|
|
1175
|
-
const
|
|
1175
|
+
const shouldReserveBrandWidth = watermark && width >= BRAND_MIN_WIDTH;
|
|
1176
|
+
const bottomMaxWidth = maxWidth - (shouldReserveBrandWidth ? BRAND_RESERVE_WIDTH : 0);
|
|
1176
1177
|
const bottomElements = {};
|
|
1177
1178
|
let bottomHeight = 0;
|
|
1178
1179
|
const bottomItems = [];
|
|
@@ -1223,7 +1224,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1223
1224
|
bottomHeight += height + chromeGap;
|
|
1224
1225
|
}
|
|
1225
1226
|
bottomHeight -= chromeGap;
|
|
1226
|
-
if (width >= BRAND_MIN_WIDTH) {
|
|
1227
|
+
if (watermark && width >= BRAND_MIN_WIDTH) {
|
|
1227
1228
|
const brandHeight = estimateTextHeight(BRAND_FONT_SIZE, 1);
|
|
1228
1229
|
const contentBelowFirstItem = bottomHeight - theme.spacing.chartToFooter;
|
|
1229
1230
|
if (brandHeight > contentBelowFirstItem) {
|
|
@@ -1231,7 +1232,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1231
1232
|
}
|
|
1232
1233
|
}
|
|
1233
1234
|
bottomHeight += pad2;
|
|
1234
|
-
} else if (width >= BRAND_MIN_WIDTH) {
|
|
1235
|
+
} else if (watermark && width >= BRAND_MIN_WIDTH) {
|
|
1235
1236
|
const brandHeight = estimateTextHeight(BRAND_FONT_SIZE, 1);
|
|
1236
1237
|
bottomHeight = theme.spacing.chartToFooter + brandHeight + pad2;
|
|
1237
1238
|
}
|