@lilt-ui/charts 0.6.0 → 0.7.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/CHANGELOG.md +22 -0
- package/dist/cards/cartesian-card.d.ts +7 -1
- package/dist/chart-context.d.ts +8 -1
- package/dist/chart.d.ts +1 -1
- package/dist/engine/decimate.d.ts +25 -0
- package/dist/finance.js +209 -208
- package/dist/index.js +2048 -2064
- package/dist/primitives/runoff.d.ts +6 -7
- package/dist/{report-context-Cz0AYdV2.js → report-context-CkzH-r8B.js} +130 -129
- package/dist/{skeleton-block-Uf1lywJi.js → skeleton-block-DvtzSsgP.js} +1835 -1670
- package/dist/types.d.ts +6 -0
- package/dist/use-chart-width.d.ts +10 -0
- package/dist/watch.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- Charts inside a CSS-transformed container lay out at their real size instead of the scaled one. Charts in dialogs that scale in, zoom-to-fit dashboards and scaled previews were drawn squashed: the Cartesian plot, Sankey, Radar, Scatter, Slope, Activity Ring and the Funnel's depth look. Untransformed charts measure exactly as before.
|
|
8
|
+
|
|
9
|
+
## 0.7.0
|
|
10
|
+
|
|
11
|
+
Long lines and areas stay smooth to hover from a hundred points to a hundred thousand.
|
|
12
|
+
|
|
13
|
+
### Drawing
|
|
14
|
+
|
|
15
|
+
- Line and area marks with more observations than the plot has pixels draw each pixel column's first, last, lowest and highest observation. The ink is the same and every drawn point is a real reading; gaps and provisional or forecast runs keep their edges, and stacked layers still meet.
|
|
16
|
+
- The headline, tiles, hover, comparison, Watch and exports still read every row.
|
|
17
|
+
- `decimate` on `ChartPlot` and Cartesian cards turns this off. It is on by default.
|
|
18
|
+
|
|
19
|
+
### Fixes
|
|
20
|
+
|
|
21
|
+
- Hover no longer rebuilds the plot and reformats every value on each move when a chart is given inline `margins`, as cards do. A 1,000-point, three-layer stacked area hovers at full frame rate instead of about 12 fps.
|
|
22
|
+
- Charts with more than about 125,000 values in total draw instead of showing an empty plot. Domains, summaries, box plots, scatter, slope, portfolio and Watch no longer spread every value into a single call.
|
|
23
|
+
- Line and area runoff paths are reused between renders instead of being rebuilt on every hover.
|
|
24
|
+
|
|
3
25
|
## 0.6.0
|
|
4
26
|
|
|
5
27
|
Charts have three loading styles, with skeletons shaped for each family and refreshed palettes.
|
|
@@ -118,6 +118,12 @@ export interface CartesianCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
118
118
|
background?: ChartBackground;
|
|
119
119
|
/** Brighten the background around the hovered point. Defaults to true. */
|
|
120
120
|
spotlight?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Draw a long line or area from each pixel column's first, last, lowest and highest
|
|
123
|
+
* observation, so tens of thousands of points stay fast to hover. The ink is the same, and the
|
|
124
|
+
* headline, tiles, hover, Watch and exports still read every row. Defaults to true.
|
|
125
|
+
*/
|
|
126
|
+
decimate?: boolean;
|
|
121
127
|
/** Card treatment: `elevated` (default), `outline`, or `ghost` inside your own card. */
|
|
122
128
|
surface?: ChartSurface;
|
|
123
129
|
/** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */
|
|
@@ -285,7 +291,7 @@ export declare const CARD_PADDING = 20;
|
|
|
285
291
|
* The shared card body: headline, delta, period, plot, and value tiles, with hover sync and
|
|
286
292
|
* range comparison. Area, Line, and Bar cards differ only in their `shape`.
|
|
287
293
|
*/
|
|
288
|
-
export declare function CartesianCard<Row, Key extends NumericKey<Row>>({ shape, title, data: suppliedData, x, series: seriesInput, headline: suppliedHeadline, aggregate: suppliedAggregate, headlineSeries, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, tiles, legend, legendSwatch, depth, height, valueFormat, locale, formatValue: suppliedFormatValue, formatAxisValue: suppliedFormatAxisValue, formatX, xType, compare, target: suppliedTarget, forecast, sync, axis, hover, hoverStyle, background, spotlight, surface, badge, numberStyle, palette, bleed, axisInset, pillSeries, pillValue, pillPosition, tooltipIndicator, loading, loadingStyle, motion, className, style, panes, live, heading, restCaption, normal, onNormalChange, }: Omit<CartesianCardProps<Row, Key>, 'series'> & {
|
|
294
|
+
export declare function CartesianCard<Row, Key extends NumericKey<Row>>({ shape, title, data: suppliedData, x, series: seriesInput, headline: suppliedHeadline, aggregate: suppliedAggregate, headlineSeries, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, tiles, legend, legendSwatch, depth, height, valueFormat, locale, formatValue: suppliedFormatValue, formatAxisValue: suppliedFormatAxisValue, formatX, xType, compare, target: suppliedTarget, forecast, sync, axis, hover, hoverStyle, background, spotlight, decimate, surface, badge, numberStyle, palette, bleed, axisInset, pillSeries, pillValue, pillPosition, tooltipIndicator, loading, loadingStyle, motion, className, style, panes, live, heading, restCaption, normal, onNormalChange, }: Omit<CartesianCardProps<Row, Key>, 'series'> & {
|
|
289
295
|
series: readonly CoreSeries<Key>[];
|
|
290
296
|
shape: CardShape;
|
|
291
297
|
/** Linked panes under the plot, such as volume or indicators. */
|
package/dist/chart-context.d.ts
CHANGED
|
@@ -53,6 +53,11 @@ export interface ChartSnapshot<T> {
|
|
|
53
53
|
/** Series drawn by column marks. */
|
|
54
54
|
columns: readonly string[];
|
|
55
55
|
geometry: PlotGeometry | null;
|
|
56
|
+
/**
|
|
57
|
+
* Lines and areas with more rows than pixels draw from this thinner geometry, which traces the
|
|
58
|
+
* same ink; null when every row is drawn. Inspection and everything else read `geometry`.
|
|
59
|
+
*/
|
|
60
|
+
drawGeometry: PlotGeometry | null;
|
|
56
61
|
plot: PlotBox;
|
|
57
62
|
formatX: (value: number) => string;
|
|
58
63
|
formatY: (value: number) => string;
|
|
@@ -116,5 +121,7 @@ export declare function makeAxisTicks(snapshot: ChartSnapshot<unknown>, previous
|
|
|
116
121
|
export declare function logTicks(domain: readonly [number, number], count: number): number[];
|
|
117
122
|
export declare function buildSnapshot<T>(data: NormalizedData<T>, series: readonly ChartSeries<T>[], xConfig: ChartXConfig<T>, yConfig: ChartYConfig, margins: ChartMargins, width: number, height: number, yDomainOverride?: readonly [number, number] | null, xDomainOverride?: readonly [number, number] | null, geometrySeries?: readonly ChartSeries<T>[], arrangement?: PlotArrangement, stackWeights?: Readonly<Record<string, number>>, barLayout?: ChartBarLayout,
|
|
118
123
|
/** Keeps line and area observations off the plot edges so labels can center on them. */
|
|
119
|
-
edgeInset?: number
|
|
124
|
+
edgeInset?: number,
|
|
125
|
+
/** Draw long lines and areas from at most four rows per pixel column. */
|
|
126
|
+
decimate?: boolean): ChartSnapshot<T>;
|
|
120
127
|
export { ChartContext };
|
package/dist/chart.d.ts
CHANGED
|
@@ -15,5 +15,5 @@ type ChartPlotRendererProps<T> = Omit<ChartProps<T>, 'className' | 'style'> & Om
|
|
|
15
15
|
controllerLinked?: boolean;
|
|
16
16
|
tooltipNode?: ReactNode;
|
|
17
17
|
};
|
|
18
|
-
export declare function ChartPlotRenderer<T>({ data, x, y, series, height, compactHeight, margins: marginProps, arrangement, marks, barLayout: barsProps, compact, tooltipNode, inspectionSeries: plotInspectionSeries, className, style, 'aria-label': ariaLabel, children, status, loadingStyle, interactive, error, renderRetry, motion: motionPreference, animateIn, resetKey, onSelectionChange, controller, linkedSelection, selectedCategoryId, onSelectedCategoryIdChange, compare, focus, live, brush, visibleSeries, onVisibleSeriesChange, toolkit, model, controllerLinked, axis: axisProp, pill, pillSeries, pillValue, pillPosition, axisInset, runoff, labelOverhang, }: ChartPlotRendererProps<T>): ReactElement;
|
|
18
|
+
export declare function ChartPlotRenderer<T>({ data, x, y, series, height, compactHeight, margins: marginProps, arrangement, marks, barLayout: barsProps, compact, tooltipNode, inspectionSeries: plotInspectionSeries, className, style, 'aria-label': ariaLabel, children, status, loadingStyle, interactive, error, renderRetry, motion: motionPreference, animateIn, resetKey, onSelectionChange, controller, linkedSelection, selectedCategoryId, onSelectedCategoryIdChange, compare, focus, live, brush, visibleSeries, onVisibleSeriesChange, toolkit, model, controllerLinked, axis: axisProp, pill, pillSeries, pillValue, pillPosition, axisInset, decimate, runoff, labelOverhang, }: ChartPlotRendererProps<T>): ReactElement;
|
|
19
19
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NormalizedData } from './normalize';
|
|
2
|
+
import { StackMode } from './stack';
|
|
3
|
+
export interface DecimateOptions {
|
|
4
|
+
/** Series drawn as lines or areas, in chart order. Bars are drawn per row and left out. */
|
|
5
|
+
lines: readonly string[];
|
|
6
|
+
/** Stacked layers, in drawing order, whose cumulative boundaries are what the plot draws. */
|
|
7
|
+
stack?: {
|
|
8
|
+
series: readonly string[];
|
|
9
|
+
mode: StackMode;
|
|
10
|
+
weights?: Readonly<Record<string, number>>;
|
|
11
|
+
};
|
|
12
|
+
xDomain: readonly [number, number];
|
|
13
|
+
/** Maps a row's x to its screen pixel. */
|
|
14
|
+
xToPixel: (x: number) => number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The rows worth drawing when a series has more rows than the plot has pixels (M4): in each pixel
|
|
18
|
+
* column, every drawn line's first, last, lowest and highest row. That traces the same ink as
|
|
19
|
+
* every row would, and every kept row is a real observation. Rows at the edge of a gap or a
|
|
20
|
+
* change of status are always kept, so gaps and provisional runs never close up.
|
|
21
|
+
*
|
|
22
|
+
* Returns null when thinning would not save much; the caller then draws every row. Only drawing
|
|
23
|
+
* uses the result: inspection, values and exports keep reading every row.
|
|
24
|
+
*/
|
|
25
|
+
export declare function decimateRows<T>(data: NormalizedData<T>, options: DecimateOptions): NormalizedData<T> | null;
|