@opendata-ai/openchart-core 8.0.0 → 8.1.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/README.md +1 -1
- package/dist/index.d.ts +40 -2
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
- package/schema/chart.schema.json +2 -2
- package/schema/vizspec.schema.json +42 -19
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -725,7 +725,13 @@ interface ScaleConfig {
|
|
|
725
725
|
reverse?: boolean;
|
|
726
726
|
/** Clamp output to the range. */
|
|
727
727
|
clamp?: boolean;
|
|
728
|
-
/**
|
|
728
|
+
/**
|
|
729
|
+
* Padding for band/point scales. Point-scale default (a categorical x/y on a
|
|
730
|
+
* line/area/point mark) is 0 for line and area marks (the trend runs flush
|
|
731
|
+
* to the plot edges) and 0.5 for other marks (e.g. scatter, so points don't
|
|
732
|
+
* collide with the axis). `paddingOuter` is accepted as an alias here since
|
|
733
|
+
* point scales have no inner bands.
|
|
734
|
+
*/
|
|
729
735
|
padding?: number;
|
|
730
736
|
/** Inner padding for band scales. */
|
|
731
737
|
paddingInner?: number;
|
|
@@ -2094,7 +2100,11 @@ interface BaseChartSpec<TData extends DataRow = DataRow> {
|
|
|
2094
2100
|
theme?: ThemeConfig;
|
|
2095
2101
|
/** Dark mode behavior. Defaults to "off". */
|
|
2096
2102
|
darkMode?: DarkMode;
|
|
2097
|
-
/**
|
|
2103
|
+
/**
|
|
2104
|
+
* Whether to show the tryOpenData.ai watermark. Defaults to true; auto-hides
|
|
2105
|
+
* when the container is under 200px tall (the cramped height class) unless
|
|
2106
|
+
* explicitly set.
|
|
2107
|
+
*/
|
|
2098
2108
|
watermark?: boolean;
|
|
2099
2109
|
/**
|
|
2100
2110
|
* Series names to hide from rendering by default. This is the authored
|
|
@@ -2431,6 +2441,26 @@ interface GraphSpec {
|
|
|
2431
2441
|
layout?: GraphLayoutConfig;
|
|
2432
2442
|
/** Per-node visual overrides, keyed by node id. */
|
|
2433
2443
|
nodeOverrides?: Record<string, NodeOverride>;
|
|
2444
|
+
/**
|
|
2445
|
+
* Node treated as the graph's seed/root: gets a distinct ring and an
|
|
2446
|
+
* always-on label without needing a `nodeOverrides` entry, and stays lit when
|
|
2447
|
+
* a category highlight or legend filter dims everything else.
|
|
2448
|
+
*
|
|
2449
|
+
* String shorthand is the node id; the object form adds styling that layers
|
|
2450
|
+
* under any `nodeOverrides` entry for the same id (an explicit override
|
|
2451
|
+
* always wins). The seed's radius is deliberately left to the `nodeSize`
|
|
2452
|
+
* encoding — set `style.radius` to make it bigger.
|
|
2453
|
+
*
|
|
2454
|
+
* NOT related to `layout.seed`, which is the deterministic RNG seed for the
|
|
2455
|
+
* force layout. This field names a node; `layout.seed` is a number.
|
|
2456
|
+
*
|
|
2457
|
+
* An id that isn't in `nodes` warns and is ignored (it does not throw), so a
|
|
2458
|
+
* filtered or paginated node update can't crash the host.
|
|
2459
|
+
*/
|
|
2460
|
+
seedNode?: string | {
|
|
2461
|
+
id: string;
|
|
2462
|
+
style?: NodeOverride;
|
|
2463
|
+
};
|
|
2434
2464
|
/** Editorial chrome. */
|
|
2435
2465
|
chrome?: Chrome;
|
|
2436
2466
|
/** Annotations. */
|
|
@@ -3482,6 +3512,14 @@ interface AxisTick {
|
|
|
3482
3512
|
fullLabel?: string;
|
|
3483
3513
|
/** Secondary label text from axis.labelField. */
|
|
3484
3514
|
subtitle?: string;
|
|
3515
|
+
/**
|
|
3516
|
+
* Pixel position the LABEL is drawn at, set only when it differs from
|
|
3517
|
+
* `position` because the label was nudged inward to stay inside the
|
|
3518
|
+
* container. Point/band x-scales run flush to the plot edges, so a label
|
|
3519
|
+
* centered on the outermost tick can spill past the SVG. Gridlines, marks
|
|
3520
|
+
* and transitions still key off `position`; only the text moves.
|
|
3521
|
+
*/
|
|
3522
|
+
labelPosition?: number;
|
|
3485
3523
|
}
|
|
3486
3524
|
/** A single gridline with computed positions. */
|
|
3487
3525
|
interface Gridline {
|
package/dist/index.js
CHANGED
|
@@ -1939,6 +1939,17 @@ function footnoteBandHeight(count, theme) {
|
|
|
1939
1939
|
}
|
|
1940
1940
|
function computeChrome(chrome, theme, width, measureText, chromeMode = "full", padding, watermark = true, bottomLegendHeight = 0) {
|
|
1941
1941
|
if (!chrome || chromeMode === "hidden") {
|
|
1942
|
+
if (watermark && width >= BRAND_MIN_WIDTH) {
|
|
1943
|
+
const hiddenPad = padding ?? theme.spacing.padding;
|
|
1944
|
+
const brandHeight = estimateTextHeight(BRAND_FONT_SIZE, 1);
|
|
1945
|
+
return {
|
|
1946
|
+
topHeight: 0,
|
|
1947
|
+
bottomHeight: theme.spacing.chartToFooter + brandHeight + hiddenPad + bottomLegendHeight
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
if (bottomLegendHeight > 0) {
|
|
1951
|
+
return { topHeight: 0, bottomHeight: bottomLegendHeight };
|
|
1952
|
+
}
|
|
1942
1953
|
return { topHeight: 0, bottomHeight: 0 };
|
|
1943
1954
|
}
|
|
1944
1955
|
const pad2 = padding ?? theme.spacing.padding;
|