@opendata-ai/openchart-core 6.5.2 → 6.7.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 +150 -6
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/layout/text-measure.ts +3 -3
- package/src/styles/animation.css +20 -0
- package/src/styles/base.css +2 -1
- package/src/styles/reduced-motion.css +3 -1
- package/src/styles/table.css +6 -0
- package/src/styles/tokens.css +2 -1
- package/src/types/index.ts +9 -0
- package/src/types/layout.ts +96 -0
- package/src/types/spec.ts +69 -2
package/dist/index.d.ts
CHANGED
|
@@ -609,6 +609,8 @@ interface LabelConfig {
|
|
|
609
609
|
density?: LabelDensity;
|
|
610
610
|
/** Number format override for label values (d3-format string, e.g. ",.0f"). */
|
|
611
611
|
format?: string;
|
|
612
|
+
/** Literal string prepended to each formatted label value (e.g. "-" or "$"). */
|
|
613
|
+
prefix?: string;
|
|
612
614
|
/** Per-series pixel offsets for fine-tuning label positions, keyed by series name. */
|
|
613
615
|
offsets?: Record<string, AnnotationOffset>;
|
|
614
616
|
}
|
|
@@ -895,6 +897,51 @@ interface LayerSpec {
|
|
|
895
897
|
/** Animation configuration. */
|
|
896
898
|
animation?: AnimationSpec;
|
|
897
899
|
}
|
|
900
|
+
/** Node alignment strategy for sankey layout. */
|
|
901
|
+
type SankeyNodeAlign = 'left' | 'right' | 'center' | 'justify';
|
|
902
|
+
/** Link coloring strategy for sankey diagrams. */
|
|
903
|
+
type SankeyLinkColor = 'gradient' | 'source' | 'target' | 'neutral';
|
|
904
|
+
/** Encoding channels specific to sankey diagrams. */
|
|
905
|
+
interface SankeyEncoding {
|
|
906
|
+
/** Source node field (required, nominal). */
|
|
907
|
+
source: EncodingChannel;
|
|
908
|
+
/** Target node field (required, nominal). */
|
|
909
|
+
target: EncodingChannel;
|
|
910
|
+
/** Flow value field (required, quantitative). */
|
|
911
|
+
value: EncodingChannel;
|
|
912
|
+
/** Color encoding for nodes/links (optional, nominal). */
|
|
913
|
+
color?: EncodingChannel;
|
|
914
|
+
/** Tooltip encoding (optional). */
|
|
915
|
+
tooltip?: EncodingChannel | EncodingChannel[];
|
|
916
|
+
}
|
|
917
|
+
interface SankeySpec {
|
|
918
|
+
/** Discriminant: always "sankey". */
|
|
919
|
+
type: 'sankey';
|
|
920
|
+
/** Tabular flow data. Each row is a source-target-value link. */
|
|
921
|
+
data: DataRow[];
|
|
922
|
+
/** Encoding channels mapping data fields to visual properties. */
|
|
923
|
+
encoding: SankeyEncoding;
|
|
924
|
+
/** Width of node rectangles in pixels. Defaults to 12. */
|
|
925
|
+
nodeWidth?: number;
|
|
926
|
+
/** Vertical padding between nodes in pixels. Defaults to 16. */
|
|
927
|
+
nodePadding?: number;
|
|
928
|
+
/** Node alignment algorithm. Defaults to 'justify'. */
|
|
929
|
+
nodeAlign?: SankeyNodeAlign;
|
|
930
|
+
/** Number of layout relaxation iterations. Defaults to 6. */
|
|
931
|
+
iterations?: number;
|
|
932
|
+
/** Link coloring strategy. Defaults to 'gradient'. */
|
|
933
|
+
linkStyle?: SankeyLinkColor;
|
|
934
|
+
/** Editorial chrome (title, subtitle, source, byline, footer). */
|
|
935
|
+
chrome?: Chrome;
|
|
936
|
+
/** Legend display configuration. */
|
|
937
|
+
legend?: LegendConfig;
|
|
938
|
+
/** Theme configuration overrides. */
|
|
939
|
+
theme?: ThemeConfig;
|
|
940
|
+
/** Dark mode behavior. Defaults to "off". */
|
|
941
|
+
darkMode?: DarkMode;
|
|
942
|
+
/** Animation configuration for entrance animations. */
|
|
943
|
+
animation?: AnimationSpec;
|
|
944
|
+
}
|
|
898
945
|
/**
|
|
899
946
|
* Top-level visualization spec: union discriminated by structural shape.
|
|
900
947
|
*
|
|
@@ -902,16 +949,19 @@ interface LayerSpec {
|
|
|
902
949
|
* - LayerSpec: has `layer` field
|
|
903
950
|
* - TableSpec: has `type: 'table'`
|
|
904
951
|
* - GraphSpec: has `type: 'graph'`
|
|
952
|
+
* - SankeySpec: has `type: 'sankey'`
|
|
905
953
|
*/
|
|
906
|
-
type VizSpec = ChartSpec | LayerSpec | TableSpec | GraphSpec;
|
|
954
|
+
type VizSpec = ChartSpec | LayerSpec | TableSpec | GraphSpec | SankeySpec;
|
|
907
955
|
/** Chart spec without runtime data, for persistence/storage. */
|
|
908
956
|
type ChartSpecWithoutData = Omit<ChartSpec, 'data'>;
|
|
909
957
|
/** Table spec without runtime data and columns, for persistence/storage. Columns can be auto-generated via dataTable(). */
|
|
910
958
|
type TableSpecWithoutData = Omit<TableSpec, 'data' | 'columns'>;
|
|
911
959
|
/** Graph spec without runtime data, for persistence/storage. */
|
|
912
960
|
type GraphSpecWithoutData = Omit<GraphSpec, 'nodes' | 'edges'>;
|
|
961
|
+
/** Sankey spec without runtime data, for persistence/storage. */
|
|
962
|
+
type SankeySpecWithoutData = Omit<SankeySpec, 'data'>;
|
|
913
963
|
/** Union of data-stripped spec types for persistence/storage. */
|
|
914
|
-
type StoredVizSpec = ChartSpecWithoutData | TableSpecWithoutData | GraphSpecWithoutData;
|
|
964
|
+
type StoredVizSpec = ChartSpecWithoutData | TableSpecWithoutData | GraphSpecWithoutData | SankeySpecWithoutData;
|
|
915
965
|
/** Logical AND combinator for filter predicates. */
|
|
916
966
|
interface LogicalAnd<T> {
|
|
917
967
|
and: T[];
|
|
@@ -1053,6 +1103,8 @@ declare function isLayerSpec(spec: VizSpec | Record<string, unknown>): spec is L
|
|
|
1053
1103
|
declare function isTableSpec(spec: VizSpec | Record<string, unknown>): spec is TableSpec;
|
|
1054
1104
|
/** Check if a spec is a GraphSpec. */
|
|
1055
1105
|
declare function isGraphSpec(spec: VizSpec | Record<string, unknown>): spec is GraphSpec;
|
|
1106
|
+
/** Check if a spec is a SankeySpec. */
|
|
1107
|
+
declare function isSankeySpec(spec: VizSpec | Record<string, unknown>): spec is SankeySpec;
|
|
1056
1108
|
/** Check if an annotation is a TextAnnotation. */
|
|
1057
1109
|
declare function isTextAnnotation(annotation: Annotation): annotation is TextAnnotation;
|
|
1058
1110
|
/** Check if an annotation is a RangeAnnotation. */
|
|
@@ -2218,6 +2270,98 @@ interface GraphLayout {
|
|
|
2218
2270
|
height: number;
|
|
2219
2271
|
};
|
|
2220
2272
|
}
|
|
2273
|
+
/** A resolved sankey node with computed position and visual properties. */
|
|
2274
|
+
interface SankeyNodeMark {
|
|
2275
|
+
type: 'sankeyNode';
|
|
2276
|
+
/** Left edge x position. */
|
|
2277
|
+
x: number;
|
|
2278
|
+
/** Top edge y position. */
|
|
2279
|
+
y: number;
|
|
2280
|
+
/** Node rectangle width. */
|
|
2281
|
+
width: number;
|
|
2282
|
+
/** Node rectangle height (proportional to throughput). */
|
|
2283
|
+
height: number;
|
|
2284
|
+
/** Fill color. */
|
|
2285
|
+
fill: string;
|
|
2286
|
+
/** Stroke color. */
|
|
2287
|
+
stroke?: string;
|
|
2288
|
+
/** Stroke width. */
|
|
2289
|
+
strokeWidth?: number;
|
|
2290
|
+
/** Corner radius for subtle rounding. */
|
|
2291
|
+
cornerRadius: number;
|
|
2292
|
+
/** Node label positioned outside the node. */
|
|
2293
|
+
label: ResolvedLabel;
|
|
2294
|
+
/** Node identifier (unique across the diagram). */
|
|
2295
|
+
nodeId: string;
|
|
2296
|
+
/** Total value flowing through this node. */
|
|
2297
|
+
value: number;
|
|
2298
|
+
/** Depth column (0 = leftmost). */
|
|
2299
|
+
depth: number;
|
|
2300
|
+
/** Original data associated with this node. */
|
|
2301
|
+
data: Record<string, unknown>;
|
|
2302
|
+
/** Accessibility attributes. */
|
|
2303
|
+
aria: MarkAria;
|
|
2304
|
+
/** Index for stagger animation ordering. */
|
|
2305
|
+
animationIndex?: number;
|
|
2306
|
+
}
|
|
2307
|
+
/** A resolved sankey link with computed path and visual properties. */
|
|
2308
|
+
interface SankeyLinkMark {
|
|
2309
|
+
type: 'sankeyLink';
|
|
2310
|
+
/** SVG path string for the curved ribbon. */
|
|
2311
|
+
path: string;
|
|
2312
|
+
/** Source node color (for gradient start). */
|
|
2313
|
+
sourceColor: string;
|
|
2314
|
+
/** Target node color (for gradient end). */
|
|
2315
|
+
targetColor: string;
|
|
2316
|
+
/** Fill opacity (0.35 default, increases on hover). */
|
|
2317
|
+
fillOpacity: number;
|
|
2318
|
+
/** Source node identifier. */
|
|
2319
|
+
sourceId: string;
|
|
2320
|
+
/** Target node identifier. */
|
|
2321
|
+
targetId: string;
|
|
2322
|
+
/** Link ribbon width at its thinnest point. */
|
|
2323
|
+
width: number;
|
|
2324
|
+
/** Flow value this link represents. */
|
|
2325
|
+
value: number;
|
|
2326
|
+
/** Original data row for this link. */
|
|
2327
|
+
data: Record<string, unknown>;
|
|
2328
|
+
/** Accessibility attributes. */
|
|
2329
|
+
aria: MarkAria;
|
|
2330
|
+
/** Index for stagger animation ordering. */
|
|
2331
|
+
animationIndex?: number;
|
|
2332
|
+
}
|
|
2333
|
+
/**
|
|
2334
|
+
* SankeyLayout: the complete engine output for sankey diagram visualizations.
|
|
2335
|
+
*
|
|
2336
|
+
* Contains everything an adapter needs to render the sankey: dimensions,
|
|
2337
|
+
* chrome, nodes, links, legend, tooltip descriptors, and accessibility metadata.
|
|
2338
|
+
* No axes (sankey has no traditional axis system).
|
|
2339
|
+
*/
|
|
2340
|
+
interface SankeyLayout {
|
|
2341
|
+
/** The sankey drawing area (after chrome and legend are subtracted). */
|
|
2342
|
+
area: Rect;
|
|
2343
|
+
/** Resolved chrome text elements with positions and styles. */
|
|
2344
|
+
chrome: ResolvedChrome;
|
|
2345
|
+
/** Resolved sankey node marks with positions and colors. */
|
|
2346
|
+
nodes: SankeyNodeMark[];
|
|
2347
|
+
/** Resolved sankey link marks with paths and gradient colors. */
|
|
2348
|
+
links: SankeyLinkMark[];
|
|
2349
|
+
/** Legend layout (position, entries, bounds). */
|
|
2350
|
+
legend: LegendLayout;
|
|
2351
|
+
/** Tooltip descriptors keyed by node/link identifier. */
|
|
2352
|
+
tooltipDescriptors: Map<string, TooltipContent>;
|
|
2353
|
+
/** Accessibility metadata. */
|
|
2354
|
+
a11y: A11yMetadata;
|
|
2355
|
+
/** The resolved theme used for rendering. */
|
|
2356
|
+
theme: ResolvedTheme;
|
|
2357
|
+
/** Total SVG dimensions. */
|
|
2358
|
+
dimensions: {
|
|
2359
|
+
width: number;
|
|
2360
|
+
height: number;
|
|
2361
|
+
};
|
|
2362
|
+
/** Resolved animation config. Present only when animation is enabled. */
|
|
2363
|
+
animation?: ResolvedAnimation;
|
|
2364
|
+
}
|
|
2221
2365
|
/** Function signature for text measurement provided by adapters. */
|
|
2222
2366
|
type MeasureTextFn = (text: string, fontSize: number, fontWeight?: number) => {
|
|
2223
2367
|
width: number;
|
|
@@ -2453,14 +2597,14 @@ declare function computeChrome(chrome: Chrome | undefined, theme: ResolvedTheme,
|
|
|
2453
2597
|
*/
|
|
2454
2598
|
declare function estimateTextWidth(text: string, fontSize: number, fontWeight?: number): number;
|
|
2455
2599
|
/**
|
|
2456
|
-
* Width reserved for the "
|
|
2457
|
-
* Accounts for ~
|
|
2600
|
+
* Width reserved for the "tryOpenData.ai" brand watermark in the bottom-right corner.
|
|
2601
|
+
* Accounts for ~14 chars at font size 12 with mixed weights, plus a gap
|
|
2458
2602
|
* so adjacent text doesn't crowd it. Used by chrome and legend layout to avoid
|
|
2459
2603
|
* overlapping the brand.
|
|
2460
2604
|
*/
|
|
2461
2605
|
declare const BRAND_RESERVE_WIDTH = 110;
|
|
2462
2606
|
/** Font size of the brand watermark (px). Shared between layout and renderer. */
|
|
2463
|
-
declare const BRAND_FONT_SIZE =
|
|
2607
|
+
declare const BRAND_FONT_SIZE = 12;
|
|
2464
2608
|
/** Minimum chart width to render the brand watermark (px). */
|
|
2465
2609
|
declare const BRAND_MIN_WIDTH = 120;
|
|
2466
2610
|
|
|
@@ -2786,4 +2930,4 @@ declare function scatterChart(data: DataRow[], x: FieldRef, y: FieldRef, options
|
|
|
2786
2930
|
*/
|
|
2787
2931
|
declare function dataTable(data: DataRow[], options?: TableBuilderOptions): TableSpec;
|
|
2788
2932
|
|
|
2789
|
-
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 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 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 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 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, inferFieldType, isChartSpec, isConditionalDef, isEncodingChannel, isGraphSpec, isLayerSpec, isRangeAnnotation, isRefLineAnnotation, isTableSpec, isTextAnnotation, lineChart, meetsAA, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveTheme, scatterChart, simulateColorBlindness };
|
|
2933
|
+
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 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 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 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, inferFieldType, isChartSpec, isConditionalDef, isEncodingChannel, isGraphSpec, isLayerSpec, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, lineChart, meetsAA, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveTheme, scatterChart, simulateColorBlindness };
|
package/dist/index.js
CHANGED
|
@@ -201,6 +201,9 @@ function isTableSpec(spec) {
|
|
|
201
201
|
function isGraphSpec(spec) {
|
|
202
202
|
return "type" in spec && spec.type === "graph";
|
|
203
203
|
}
|
|
204
|
+
function isSankeySpec(spec) {
|
|
205
|
+
return "type" in spec && spec.type === "sankey";
|
|
206
|
+
}
|
|
204
207
|
function isTextAnnotation(annotation) {
|
|
205
208
|
return annotation.type === "text";
|
|
206
209
|
}
|
|
@@ -1040,7 +1043,7 @@ function estimateTextWidth(text, fontSize, fontWeight = 400) {
|
|
|
1040
1043
|
return text.length * estimateCharWidth(fontSize, fontWeight);
|
|
1041
1044
|
}
|
|
1042
1045
|
var BRAND_RESERVE_WIDTH = 110;
|
|
1043
|
-
var BRAND_FONT_SIZE =
|
|
1046
|
+
var BRAND_FONT_SIZE = 12;
|
|
1044
1047
|
var BRAND_MIN_WIDTH = 120;
|
|
1045
1048
|
function estimateTextHeight(fontSize, lineCount = 1, lineHeight = 1.3) {
|
|
1046
1049
|
return fontSize * lineHeight * lineCount;
|
|
@@ -2781,6 +2784,7 @@ export {
|
|
|
2781
2784
|
isLayerSpec,
|
|
2782
2785
|
isRangeAnnotation,
|
|
2783
2786
|
isRefLineAnnotation,
|
|
2787
|
+
isSankeySpec,
|
|
2784
2788
|
isTableSpec,
|
|
2785
2789
|
isTextAnnotation,
|
|
2786
2790
|
lineChart,
|