@opendata-ai/openchart-core 8.0.0-rc.7 → 8.0.0-rc.9
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 +99 -14
- package/dist/index.js +23 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
- package/src/responsive/breakpoints.ts +7 -2
- package/src/styles/animation.css +6 -1
- package/src/types/events.ts +95 -13
- package/src/types/index.ts +1 -0
- package/src/types/layout.ts +25 -2
- package/src/types/spec.ts +22 -3
package/src/types/index.ts
CHANGED
package/src/types/layout.ts
CHANGED
|
@@ -747,8 +747,9 @@ export interface BaseLegendLayout {
|
|
|
747
747
|
* read them silently pick whichever comes first.
|
|
748
748
|
*/
|
|
749
749
|
channel?: LegendChannel;
|
|
750
|
-
/** Where the legend is positioned relative to the chart area.
|
|
751
|
-
|
|
750
|
+
/** Where the legend is positioned relative to the chart area. `'top-left'`
|
|
751
|
+
* is a map-only overlay position (floats inside the map area). */
|
|
752
|
+
position: 'top' | 'top-left' | 'right' | 'bottom' | 'bottom-right' | 'inline';
|
|
752
753
|
/** Bounding box for the legend (pixel coordinates). */
|
|
753
754
|
bounds: Rect;
|
|
754
755
|
/** Entry label style. */
|
|
@@ -1133,6 +1134,24 @@ export interface YouDrawItYInvert {
|
|
|
1133
1134
|
bottomData: number;
|
|
1134
1135
|
}
|
|
1135
1136
|
|
|
1137
|
+
/**
|
|
1138
|
+
* Scale inversion anchors serialized from the engine so the vanilla layer
|
|
1139
|
+
* can convert pixel positions to data-space values without holding d3
|
|
1140
|
+
* scale objects. Generalizes the YouDrawItYInvert pattern to both axes.
|
|
1141
|
+
*/
|
|
1142
|
+
export interface ScaleInvert {
|
|
1143
|
+
/** For continuous scales: two reference pixel-to-data anchor points. */
|
|
1144
|
+
topPixel: number;
|
|
1145
|
+
bottomPixel: number;
|
|
1146
|
+
topData: number;
|
|
1147
|
+
bottomData: number;
|
|
1148
|
+
/** Scale type so the vanilla layer applies the correct inverse transform. */
|
|
1149
|
+
scaleType?: 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time';
|
|
1150
|
+
/** For band/point scales: ordered domain values and their pixel centers. */
|
|
1151
|
+
domain?: (string | number)[];
|
|
1152
|
+
positions?: number[];
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1136
1155
|
/**
|
|
1137
1156
|
* Resolved geometry and config for the "you draw it" interactive format
|
|
1138
1157
|
* (`youDrawIt`). The vanilla adapter uses this to render the hatched drawing
|
|
@@ -1266,6 +1285,10 @@ export interface ChartLayout {
|
|
|
1266
1285
|
crosshair: boolean;
|
|
1267
1286
|
/** Real text measurement function from the adapter (for accurate SVG text wrapping). */
|
|
1268
1287
|
measureText?: MeasureTextFn;
|
|
1288
|
+
/** Scale inversion anchors for the x axis. Used by anchor drag to convert pixel to data-space. */
|
|
1289
|
+
xInvert?: ScaleInvert;
|
|
1290
|
+
/** Scale inversion anchors for the y axis. Used by anchor drag to convert pixel to data-space. */
|
|
1291
|
+
yInvert?: ScaleInvert;
|
|
1269
1292
|
/** Faceted (small-multiples) layout. When present, renderers iterate panels instead of using top-level marks/axes. */
|
|
1270
1293
|
facet?: FacetLayout;
|
|
1271
1294
|
}
|
package/src/types/spec.ts
CHANGED
|
@@ -1789,7 +1789,12 @@ interface BaseChartSpec<TData extends DataRow = DataRow> {
|
|
|
1789
1789
|
darkMode?: DarkMode;
|
|
1790
1790
|
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
1791
1791
|
watermark?: boolean;
|
|
1792
|
-
/**
|
|
1792
|
+
/**
|
|
1793
|
+
* Series names to hide from rendering by default. This is the authored
|
|
1794
|
+
* persistence target for legend visibility. Runtime legend toggles
|
|
1795
|
+
* (legend-toggle edit events) layer on top of this via ephemeral runtime
|
|
1796
|
+
* sets but never modify it.
|
|
1797
|
+
*/
|
|
1793
1798
|
hiddenSeries?: string[];
|
|
1794
1799
|
/** Per-series visual overrides, keyed by series name (the color field value). */
|
|
1795
1800
|
seriesStyles?: Record<string, SeriesStyle>;
|
|
@@ -2109,7 +2114,16 @@ export interface LayerSpec<TData extends DataRow = DataRow> {
|
|
|
2109
2114
|
height?: number;
|
|
2110
2115
|
/** Accepted for Vega-Lite compatibility and ignored (with a compile warning). */
|
|
2111
2116
|
$schema?: string;
|
|
2112
|
-
/**
|
|
2117
|
+
/**
|
|
2118
|
+
* Annotations for the layered chart. When present, these are the
|
|
2119
|
+
* annotations rendered and available for editing. When absent, falls back
|
|
2120
|
+
* to the first leaf layer's annotations. Annotations on second and later
|
|
2121
|
+
* leaf layers are not rendered.
|
|
2122
|
+
*
|
|
2123
|
+
* For edit persistence: the `data-annotation-index` stamped on each
|
|
2124
|
+
* rendered annotation maps to this array (or the first leaf's if this is
|
|
2125
|
+
* unset). Place annotations here for reliable index-based edit matching.
|
|
2126
|
+
*/
|
|
2113
2127
|
annotations?: Annotation[];
|
|
2114
2128
|
/** Label display configuration. `false` disables all labels, `true` uses defaults. */
|
|
2115
2129
|
labels?: LabelSpec;
|
|
@@ -2125,7 +2139,12 @@ export interface LayerSpec<TData extends DataRow = DataRow> {
|
|
|
2125
2139
|
watermark?: boolean;
|
|
2126
2140
|
/** Resolution strategy for shared scales/axes/legends. */
|
|
2127
2141
|
resolve?: ResolveConfig;
|
|
2128
|
-
/**
|
|
2142
|
+
/**
|
|
2143
|
+
* Series names to hide from rendering by default. This is the authored
|
|
2144
|
+
* persistence target for legend visibility. Runtime legend toggles
|
|
2145
|
+
* (legend-toggle edit events) layer on top of this via ephemeral runtime
|
|
2146
|
+
* sets but never modify it.
|
|
2147
|
+
*/
|
|
2129
2148
|
hiddenSeries?: string[];
|
|
2130
2149
|
/** Endpoint labels column, inherited by child layers that don't set their own. */
|
|
2131
2150
|
endpointLabels?: boolean | EndpointLabelsConfig;
|