@sophistry/charts 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +32 -2
- package/dist/3d/bar-chart3d.d.ts +55 -0
- package/dist/3d/definitions.d.ts +37 -0
- package/dist/3d/definitions.js +14 -0
- package/dist/3d/forward.d.ts +64 -0
- package/dist/3d/index.d.ts +30 -0
- package/dist/3d/index.js +1 -0
- package/dist/3d/quiver3d.d.ts +52 -0
- package/dist/3d/scatter3d.d.ts +44 -0
- package/dist/3d/stem3d.d.ts +45 -0
- package/dist/3d/surface-grid3d.d.ts +33 -0
- package/dist/3d/tri-surface3d.d.ts +45 -0
- package/dist/3d/voxels3d.d.ts +25 -0
- package/dist/3d/wireframe3d.d.ts +30 -0
- package/dist/band.d.ts +20 -0
- package/dist/bars/bar-chart.d.ts +143 -0
- package/dist/bars/bar-labels.d.ts +116 -0
- package/dist/bars/bars.d.ts +223 -0
- package/dist/bars/bullet.d.ts +157 -0
- package/dist/bars/candlestick.d.ts +97 -0
- package/dist/bars/funnel.d.ts +90 -0
- package/dist/bars/histogram.d.ts +108 -0
- package/dist/bars/index.d.ts +22 -0
- package/dist/bars/race.d.ts +28 -0
- package/dist/bars/rules.d.ts +121 -0
- package/dist/bars/shared.d.ts +41 -0
- package/dist/bars/transforms.d.ts +249 -0
- package/dist/bars/waterfall.d.ts +106 -0
- package/dist/batch.d.ts +142 -0
- package/dist/channels-_Xf-p6Lx.js +56 -0
- package/dist/chart.d.ts +87 -0
- package/dist/color-norm.d.ts +90 -0
- package/dist/context.d.ts +111 -0
- package/dist/curves/density.d.ts +125 -0
- package/dist/curves/ecdf.d.ts +72 -0
- package/dist/curves/fill-between.d.ts +100 -0
- package/dist/curves/index.d.ts +15 -0
- package/dist/curves/line-plot.d.ts +104 -0
- package/dist/curves/regression.d.ts +124 -0
- package/dist/curves/shared.d.ts +52 -0
- package/dist/curves/stack-plot.d.ts +140 -0
- package/dist/curves/stairs.d.ts +170 -0
- package/dist/data/channels.d.ts +170 -0
- package/dist/end-space.d.ts +81 -0
- package/dist/entries/definitions.d.ts +20 -0
- package/dist/entries/definitions.js +6 -0
- package/dist/frame/band-axis.d.ts +42 -0
- package/dist/frame/coords.d.ts +111 -0
- package/dist/frame/fit.d.ts +170 -0
- package/dist/frame/format.d.ts +40 -0
- package/dist/frame/guide-metrics.d.ts +36 -0
- package/dist/frame/guides.d.ts +67 -0
- package/dist/frame/keys.d.ts +96 -0
- package/dist/frame/layout.d.ts +145 -0
- package/dist/frame/registry.d.ts +31 -0
- package/dist/frame/reports.d.ts +53 -0
- package/dist/frame/secondary-axes.d.ts +73 -0
- package/dist/frame/secondary.d.ts +56 -0
- package/dist/frame/tooltip-overlay.d.ts +64 -0
- package/dist/frame/types.d.ts +658 -0
- package/dist/grids/barbs.d.ts +51 -0
- package/dist/grids/cell-rects.d.ts +37 -0
- package/dist/grids/cells.d.ts +130 -0
- package/dist/grids/contour-f.d.ts +80 -0
- package/dist/grids/contour-shared.d.ts +53 -0
- package/dist/grids/contour.d.ts +84 -0
- package/dist/grids/dendrogram.d.ts +104 -0
- package/dist/grids/heatmap.d.ts +163 -0
- package/dist/grids/hex-bin.d.ts +93 -0
- package/dist/grids/hist2d.d.ts +107 -0
- package/dist/grids/imshow.d.ts +84 -0
- package/dist/grids/index.d.ts +26 -0
- package/dist/grids/pcolormesh.d.ts +90 -0
- package/dist/grids/ramp-cells.d.ts +66 -0
- package/dist/grids/tri-contour.d.ts +120 -0
- package/dist/grids/tri-shared.d.ts +61 -0
- package/dist/grids/tripcolor.d.ts +73 -0
- package/dist/guides/colorbar.d.ts +110 -0
- package/dist/guides/index.d.ts +11 -0
- package/dist/guides/legend.d.ts +118 -0
- package/dist/guides/nodes.d.ts +13 -0
- package/dist/guides/size-legend.d.ts +233 -0
- package/dist/hierarchy/breadcrumbs.d.ts +133 -0
- package/dist/hierarchy/circle-pack.d.ts +72 -0
- package/dist/hierarchy/drill.d.ts +245 -0
- package/dist/hierarchy/frame.d.ts +67 -0
- package/dist/hierarchy/icicle.d.ts +76 -0
- package/dist/hierarchy/index.d.ts +20 -0
- package/dist/hierarchy/labels.d.ts +24 -0
- package/dist/hierarchy/mosaic.d.ts +130 -0
- package/dist/hierarchy/own-tooltip.d.ts +12 -0
- package/dist/hierarchy/props.d.ts +13 -0
- package/dist/hierarchy/sankey.d.ts +132 -0
- package/dist/hierarchy/shared.d.ts +247 -0
- package/dist/hierarchy/sunburst.d.ts +74 -0
- package/dist/hierarchy/tree.d.ts +124 -0
- package/dist/hierarchy/treemap.d.ts +76 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +5 -0
- package/dist/item-tooltip.d.ts +33 -0
- package/dist/join.d.ts +223 -0
- package/dist/math/3d/bar3d.d.ts +27 -0
- package/dist/math/3d/quiver3d.d.ts +26 -0
- package/dist/math/3d/scatter3d.d.ts +15 -0
- package/dist/math/3d/stem3d.d.ts +22 -0
- package/dist/math/3d/surfaceGrid3d.d.ts +33 -0
- package/dist/math/3d/trisurface.d.ts +11 -0
- package/dist/math/3d/voxels.d.ts +17 -0
- package/dist/math/aggregate.d.ts +68 -0
- package/dist/math/bar.d.ts +31 -0
- package/dist/math/barLabels.d.ts +83 -0
- package/dist/math/barbs.d.ts +36 -0
- package/dist/math/boxplot.d.ts +36 -0
- package/dist/math/breadcrumbs.d.ts +128 -0
- package/dist/math/bubble.d.ts +38 -0
- package/dist/math/bullet.d.ts +110 -0
- package/dist/math/chord.d.ts +103 -0
- package/dist/math/cluster.d.ts +88 -0
- package/dist/math/contour.d.ts +48 -0
- package/dist/math/contourf.d.ts +50 -0
- package/dist/math/dodge.d.ts +36 -0
- package/dist/math/ecdf.d.ts +41 -0
- package/dist/math/errorbar.d.ts +27 -0
- package/dist/math/eventplot.d.ts +26 -0
- package/dist/math/facet.d.ts +90 -0
- package/dist/math/fillBetween.d.ts +28 -0
- package/dist/math/gauge.d.ts +71 -0
- package/dist/math/hexbin.d.ts +20 -0
- package/dist/math/hierarchy.d.ts +179 -0
- package/dist/math/hierarchyJoin.d.ts +59 -0
- package/dist/math/histogram.d.ts +36 -0
- package/dist/math/histogram2d.d.ts +44 -0
- package/dist/math/imshow.d.ts +26 -0
- package/dist/math/index.d.ts +139 -0
- package/dist/math/index.js +3 -0
- package/dist/math/jitter.d.ts +16 -0
- package/dist/math/join.d.ts +135 -0
- package/dist/math/keyframes.d.ts +127 -0
- package/dist/math/legend.d.ts +120 -0
- package/dist/math/line.d.ts +53 -0
- package/dist/math/morph.d.ts +81 -0
- package/dist/math/mosaic.d.ts +119 -0
- package/dist/math/ordinal.d.ts +79 -0
- package/dist/math/parallel.d.ts +38 -0
- package/dist/math/pcolormesh.d.ts +22 -0
- package/dist/math/pie.d.ts +105 -0
- package/dist/math/polarArea.d.ts +34 -0
- package/dist/math/radar.d.ts +110 -0
- package/dist/math/range.d.ts +98 -0
- package/dist/math/regression.d.ts +109 -0
- package/dist/math/reveal.d.ts +63 -0
- package/dist/math/sankey.d.ts +154 -0
- package/dist/math/scatter.d.ts +14 -0
- package/dist/math/shared/binning.d.ts +23 -0
- package/dist/math/shared/gridCells.d.ts +41 -0
- package/dist/math/shared/gridExtent.d.ts +5 -0
- package/dist/math/shared/pairs.d.ts +2 -0
- package/dist/math/shared/polar.d.ts +23 -0
- package/dist/math/stack.d.ts +69 -0
- package/dist/math/stackplot.d.ts +35 -0
- package/dist/math/stairs.d.ts +17 -0
- package/dist/math/stem.d.ts +21 -0
- package/dist/math/symbol.d.ts +25 -0
- package/dist/math/tree.d.ts +117 -0
- package/dist/math/tricontour.d.ts +76 -0
- package/dist/math/violin.d.ts +99 -0
- package/dist/math/waffle.d.ts +48 -0
- package/dist/math/waterfall.d.ts +28 -0
- package/dist/math-CSHNpGej.js +3648 -0
- package/dist/mix.d.ts +24 -0
- package/dist/multiview/brush.d.ts +165 -0
- package/dist/multiview/chart-group.d.ts +265 -0
- package/dist/multiview/chart-link.d.ts +188 -0
- package/dist/multiview/chart-zoom.d.ts +144 -0
- package/dist/multiview/facet.d.ts +238 -0
- package/dist/multiview/group-guides.d.ts +99 -0
- package/dist/multiview/index.d.ts +17 -0
- package/dist/multiview/joint-plot.d.ts +114 -0
- package/dist/multiview/pair-plot.d.ts +153 -0
- package/dist/multiview/panels.d.ts +22 -0
- package/dist/multiview/parallel-coordinates.d.ts +109 -0
- package/dist/points/event-plot.d.ts +67 -0
- package/dist/points/index.d.ts +19 -0
- package/dist/points/labels.d.ts +70 -0
- package/dist/points/links.d.ts +123 -0
- package/dist/points/rects.d.ts +80 -0
- package/dist/points/rug.d.ts +72 -0
- package/dist/points/scatter.d.ts +169 -0
- package/dist/points/segment-marks.d.ts +39 -0
- package/dist/points/shared.d.ts +34 -0
- package/dist/points/stem.d.ts +75 -0
- package/dist/points/strip.d.ts +145 -0
- package/dist/points/symbol-marker.d.ts +33 -0
- package/dist/points/ticks.d.ts +102 -0
- package/dist/props.d.ts +126 -0
- package/dist/radial/chord.d.ts +148 -0
- package/dist/radial/gauge.d.ts +126 -0
- package/dist/radial/index.d.ts +15 -0
- package/dist/radial/pie-chart.d.ts +143 -0
- package/dist/radial/polar-area-chart.d.ts +135 -0
- package/dist/radial/radar-chart.d.ts +176 -0
- package/dist/radial/radial-bar-chart.d.ts +116 -0
- package/dist/radial/shared.d.ts +78 -0
- package/dist/radial/waffle.d.ts +130 -0
- package/dist/raster.d.ts +43 -0
- package/dist/series.d.ts +71 -0
- package/dist/src-CwGo1bes.js +19221 -0
- package/dist/stagger.d.ts +54 -0
- package/dist/statistics/box-plot.d.ts +151 -0
- package/dist/statistics/error-bar.d.ts +148 -0
- package/dist/statistics/groups.d.ts +140 -0
- package/dist/statistics/index.d.ts +7 -0
- package/dist/statistics/violin-plot.d.ts +143 -0
- package/dist/text-width.d.ts +9 -0
- package/dist/tooltip.d.ts +276 -0
- package/dist/util.d.ts +33 -0
- package/dist/voxels-9lJ2TZS4.js +235 -0
- package/dist/wireframe3d-D157GZAq.js +345 -0
- package/package.json +86 -3
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour norms: how a colour-mapped layer turns a value into a place on its
|
|
3
|
+
* ramp (0..1), and the {@link Scale} its colour bar reads the same mapping
|
|
4
|
+
* from, so cells and colour bar always agree.
|
|
5
|
+
*/
|
|
6
|
+
import type { DivergingKind, Scale } from "@sophistry/core/geometry";
|
|
7
|
+
import type { Colormap } from "@sophistry/core/themes";
|
|
8
|
+
import type { RampExtent } from "./frame/types.js";
|
|
9
|
+
/**
|
|
10
|
+
* How a colour layer spreads values over its colormap: `"linear"` even
|
|
11
|
+
* steps; `"log"` even ratios (zero, negative and non-finite values are not
|
|
12
|
+
* drawn, and the automatic range is the positive extent); `"symlog"`
|
|
13
|
+
* logarithmic away from zero, linear through it; `"sqrt"` square-root
|
|
14
|
+
* steps, lifting small values.
|
|
15
|
+
*
|
|
16
|
+
* @see https://sophistry.dev/guides/charts/#color
|
|
17
|
+
* @category Charts
|
|
18
|
+
*/
|
|
19
|
+
export type RampScaleName = DivergingKind;
|
|
20
|
+
/**
|
|
21
|
+
* The colour-norm props of the colour-mapped layers (`<Imshow>`,
|
|
22
|
+
* `<Pcolormesh>`, `<Cells>`/`<Heatmap>`, `<Tripcolor>`, the contours).
|
|
23
|
+
* `<Hist2D>` and `<HexBin>` take `rampScale` alone.
|
|
24
|
+
*
|
|
25
|
+
* @see https://sophistry.dev/guides/charts/#color
|
|
26
|
+
* @category Charts
|
|
27
|
+
*/
|
|
28
|
+
export interface RampScaleProps {
|
|
29
|
+
/** How values spread over the colormap; see {@link RampScaleName}. @default "linear" */
|
|
30
|
+
rampScale?: RampScaleName;
|
|
31
|
+
/**
|
|
32
|
+
* A diverging centre: this value takes the colormap's middle, each half
|
|
33
|
+
* spread on its own, so a diverging colormap's neutral colour sits on "no
|
|
34
|
+
* change". Without `rampMin`/`rampMax`, the range is symmetric about it
|
|
35
|
+
* (in ratio under `"log"`).
|
|
36
|
+
*/
|
|
37
|
+
rampMidpoint?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A layer's resolved colour norm.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export interface ColorNorm {
|
|
45
|
+
/** The values the colormap spans, `[low, high]`, ascending. */
|
|
46
|
+
domain: readonly [number, number];
|
|
47
|
+
/** The mapping over `domain`, for the colour bar: its ticks and their places. */
|
|
48
|
+
scale: Scale;
|
|
49
|
+
/** A value's place on the ramp: 0 at `domain[0]`, 1 at `domain[1]`, beyond for values past them; `NaN` for values with no place. */
|
|
50
|
+
unit(value: number): number;
|
|
51
|
+
/** True for the default linear mapping, which needs no colour-bar scale of its own. */
|
|
52
|
+
linear: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Options for {@link colorNorm}: the layer's norm props and its `rampMin`/`rampMax`.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export interface RampScaleOptions extends RampScaleProps {
|
|
60
|
+
rampMin?: number;
|
|
61
|
+
rampMax?: number;
|
|
62
|
+
/** Return a norm even for the default linear mapping. */
|
|
63
|
+
always?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The colour norm a layer colours `values` through.
|
|
67
|
+
*
|
|
68
|
+
* @param values - Only their finite (positive, under `"log"`) extent is read.
|
|
69
|
+
* @returns The norm; without `always`, undefined unless a non-linear `rampScale` or a `rampMidpoint` is given.
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export declare function colorNorm(values: Iterable<number>, options: RampScaleOptions & {
|
|
73
|
+
always: true;
|
|
74
|
+
}): ColorNorm;
|
|
75
|
+
export declare function colorNorm(values: Iterable<number>, options: RampScaleOptions): ColorNorm | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Contour levels evenly spaced along a norm (geometric under `"log"`, split
|
|
78
|
+
* evenly either side of a `rampMidpoint`).
|
|
79
|
+
*
|
|
80
|
+
* @param ends - `"between"` for iso-lines strictly inside the domain, `"cover"` for band boundaries including both ends.
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
export declare function normLevels(norm: ColorNorm, count: number, ends: "between" | "cover"): number[];
|
|
84
|
+
/**
|
|
85
|
+
* What a layer reports to its frame's colour bar: its norm's domain and
|
|
86
|
+
* scale when it has a non-linear one, else `domain` (linear).
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
export declare function rampOf(norm: ColorNorm | undefined, domain: readonly [number, number], colormap: Colormap): RampExtent;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How layers find their chart: the context keys a `chart` provides and the
|
|
3
|
+
* helper every layer calls ({@link chartLayer}), the imperative form of
|
|
4
|
+
* a chart, layer and colour scale lookup.
|
|
5
|
+
*
|
|
6
|
+
* - {@link chartContext}: the frame snapshot ({@link ChartFrame}). A new
|
|
7
|
+
* object whenever the fit, the reveal, the colour scale or a transition
|
|
8
|
+
* stage changes; a layer reading it with `ctx.context(chartContext)` reruns
|
|
9
|
+
* its `update` exactly then.
|
|
10
|
+
* - {@link chartLayersContext}: where reports go ({@link ChartLayers}),
|
|
11
|
+
* stable for the chart's life.
|
|
12
|
+
* - `coordsContext` (core): the chart publishes its coordinate system there
|
|
13
|
+
* too, so core's graphs and annotations plot inside a chart.
|
|
14
|
+
* - `tooltipContext`, `dateSinkContext`: the chart's tooltip and date sink.
|
|
15
|
+
*/
|
|
16
|
+
import type { CompositeContext, ContextKey, CoordinateSystem } from "@sophistry/core";
|
|
17
|
+
import type { BandKey } from "@sophistry/core/geometry";
|
|
18
|
+
import type { ChartFrame, ChartLayerExtent, ChartLayers } from "./frame/types.js";
|
|
19
|
+
import type { OrdinalColorScale } from "./math/ordinal.js";
|
|
20
|
+
/**
|
|
21
|
+
* The enclosing chart's frame, or null outside one (a plain `axes`, or no
|
|
22
|
+
* coordinate system at all). Read it with `ctx.context(chartContext)` inside
|
|
23
|
+
* `setup`/`update`; see {@link ChartFrame}.
|
|
24
|
+
*
|
|
25
|
+
* @category Extending
|
|
26
|
+
*/
|
|
27
|
+
export declare const chartContext: ContextKey<ChartFrame | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Where the enclosing chart's layers report their extents, or null outside a
|
|
30
|
+
* chart. Layers use {@link chartLayer} rather than reading it directly.
|
|
31
|
+
*
|
|
32
|
+
* @category Extending
|
|
33
|
+
*/
|
|
34
|
+
export declare const chartLayersContext: ContextKey<ChartLayers | null>;
|
|
35
|
+
/**
|
|
36
|
+
* A layer's link to its chart. See {@link chartLayer}.
|
|
37
|
+
*
|
|
38
|
+
* @category Extending
|
|
39
|
+
*/
|
|
40
|
+
export interface ChartLayer {
|
|
41
|
+
/**
|
|
42
|
+
* The chart's current frame, or null outside a chart. Reading it reruns
|
|
43
|
+
* the layer's `update` when the chart publishes a new frame.
|
|
44
|
+
*/
|
|
45
|
+
frame(): ChartFrame | null;
|
|
46
|
+
/**
|
|
47
|
+
* The coordinate system in scope: the chart's (or an `axes`'), else null.
|
|
48
|
+
* Reading it reruns `update` when it changes.
|
|
49
|
+
*/
|
|
50
|
+
coords(): CoordinateSystem | null;
|
|
51
|
+
/**
|
|
52
|
+
* Sends the layer's extent to the chart (a no-op outside one). Call from
|
|
53
|
+
* every `update` with the current report; the chart refits only when it
|
|
54
|
+
* changed by value. `undefined` withdraws the report.
|
|
55
|
+
*/
|
|
56
|
+
report(extent: ChartLayerExtent | undefined): void;
|
|
57
|
+
/** The layer's own `progress`, scaled by the frame's data phase (as given outside a chart). */
|
|
58
|
+
progress(own: number | undefined): number | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* The categorical colour scale `series` maps through: inside a chart the
|
|
61
|
+
* frame's shared scale (report the categories as `color: { categories }`),
|
|
62
|
+
* outside one a scale over `categories` cycling the theme's colours.
|
|
63
|
+
*/
|
|
64
|
+
colorScale(categories: readonly BandKey[]): OrdinalColorScale;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Wires a layer composite into its chart: reports its extent so the frame
|
|
68
|
+
* can fit its axes, and scales its reveal by the frame's data phase. Outside
|
|
69
|
+
* a chart it reports nothing and leaves `progress` untouched, so layers also
|
|
70
|
+
* work in a plain `axes`. Call once, in `setup`; the report is withdrawn
|
|
71
|
+
* when the layer is disposed.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* import { type CompositeContext, circle, defineComposite, Invalidate } from "@sophistry/core";
|
|
76
|
+
* import { type ChartLayer, chartLayer } from "@sophistry/charts";
|
|
77
|
+
*
|
|
78
|
+
* interface PinsProps {
|
|
79
|
+
* xs: readonly number[];
|
|
80
|
+
* ys: readonly number[];
|
|
81
|
+
* }
|
|
82
|
+
*
|
|
83
|
+
* const layers = new WeakMap<object, ChartLayer>();
|
|
84
|
+
*
|
|
85
|
+
* function draw(ctx: CompositeContext<PinsProps>) {
|
|
86
|
+
* const layer = layers.get(ctx.node)!;
|
|
87
|
+
* const { xs, ys } = ctx.props;
|
|
88
|
+
* layer.report({ x: { values: xs }, y: { values: ys, zero: true } });
|
|
89
|
+
* const coords = layer.coords();
|
|
90
|
+
* if (!coords) return [];
|
|
91
|
+
* // Build children in data space through `coords`.
|
|
92
|
+
* return xs.map((x, i) => circle.create({ center: coords.coordsToPoint(x, ys[i]), radius: 0.08 }));
|
|
93
|
+
* }
|
|
94
|
+
*
|
|
95
|
+
* export const pins = defineComposite<PinsProps>({
|
|
96
|
+
* name: "Pins",
|
|
97
|
+
* props: {
|
|
98
|
+
* xs: { default: [], invalidates: Invalidate.UPDATE },
|
|
99
|
+
* ys: { default: [], invalidates: Invalidate.UPDATE },
|
|
100
|
+
* },
|
|
101
|
+
* setup: (ctx) => {
|
|
102
|
+
* layers.set(ctx.node, chartLayer(ctx));
|
|
103
|
+
* return draw(ctx);
|
|
104
|
+
* },
|
|
105
|
+
* update: (_changed, ctx) => draw(ctx),
|
|
106
|
+
* });
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @category Extending
|
|
110
|
+
*/
|
|
111
|
+
export declare function chartLayer<P>(ctx: CompositeContext<P>): ChartLayer;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `density`: a kernel density estimate per `series`, drawn as one path
|
|
3
|
+
* batch (per curve a closed fill item, then its open line) in a group whose
|
|
4
|
+
* clip the `"x"` reveal sweeps. With `row`, curves stand in a band axis's
|
|
5
|
+
* rows: a ridgeline.
|
|
6
|
+
*/
|
|
7
|
+
import type { ColorInput } from "@sophistry/core/color";
|
|
8
|
+
import type { BandKey } from "@sophistry/core/geometry";
|
|
9
|
+
import type { Channel } from "../data/channels.js";
|
|
10
|
+
import type { DensityReveal, SeriesTransitionProps } from "../props.js";
|
|
11
|
+
/**
|
|
12
|
+
* Props of {@link density}: `x` defaults to the datum when `data` is
|
|
13
|
+
* `number[]`; name it otherwise.
|
|
14
|
+
*
|
|
15
|
+
* @category Charts
|
|
16
|
+
*/
|
|
17
|
+
export interface DensityProps<T = unknown> extends SeriesTransitionProps<T> {
|
|
18
|
+
/** The sample: one value per datum. */
|
|
19
|
+
data: readonly T[];
|
|
20
|
+
/**
|
|
21
|
+
* The sample value, in data units. Defaults to the datum when `data` is `number[]`; required
|
|
22
|
+
* otherwise. Non-finite values are dropped.
|
|
23
|
+
*/
|
|
24
|
+
x?: Channel<T, number>;
|
|
25
|
+
/** Gaussian kernel bandwidth, in data units. Defaults to Silverman's rule of thumb. */
|
|
26
|
+
bandwidth?: number;
|
|
27
|
+
/**
|
|
28
|
+
* How many points the curve is evaluated at.
|
|
29
|
+
* @default 80
|
|
30
|
+
*/
|
|
31
|
+
samples?: number;
|
|
32
|
+
/** The x span to evaluate over. Defaults to the data's extent padded by three bandwidths. */
|
|
33
|
+
domain?: [number, number];
|
|
34
|
+
/**
|
|
35
|
+
* The category of each datum: one curve per category (each with area 1), coloured through the
|
|
36
|
+
* chart's shared colour scale and legend. `color` wins.
|
|
37
|
+
*/
|
|
38
|
+
series?: Channel<T, BandKey>;
|
|
39
|
+
/**
|
|
40
|
+
* With a `series`: scale each curve by its share of the data, so all areas add up to 1.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
commonNorm?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* `"vertical"`: values along x, density up y. `"horizontal"`: values up y, density to the right
|
|
46
|
+
* (a marginal beside a y axis).
|
|
47
|
+
* @default "vertical"
|
|
48
|
+
*/
|
|
49
|
+
orientation?: "vertical" | "horizontal";
|
|
50
|
+
/**
|
|
51
|
+
* Sit the curve in a category's band on a band axis instead of on a density axis: a ridgeline,
|
|
52
|
+
* one `density` per row. `true` with a `series` puts each category on its own row.
|
|
53
|
+
*/
|
|
54
|
+
row?: BandKey | true;
|
|
55
|
+
/**
|
|
56
|
+
* With `row`: the peak height, in band slots (above 1 overlaps the next row).
|
|
57
|
+
* @default 1.4
|
|
58
|
+
*/
|
|
59
|
+
rowHeight?: number;
|
|
60
|
+
/**
|
|
61
|
+
* With `row`: what reaches `rowHeight`: `"own"` each curve's own peak, `"shared"` the tallest
|
|
62
|
+
* among this layer's curves, or a density shared across several layers.
|
|
63
|
+
* @default "own"
|
|
64
|
+
*/
|
|
65
|
+
rowScale?: "own" | "shared" | number;
|
|
66
|
+
/**
|
|
67
|
+
* Curve and fill colour. Defaults to the `series` colour, else the theme's first series colour.
|
|
68
|
+
*/
|
|
69
|
+
color?: ColorInput;
|
|
70
|
+
/**
|
|
71
|
+
* Fill opacity under the curve, 0..1 (0 for the curve alone).
|
|
72
|
+
* @default 0.3
|
|
73
|
+
*/
|
|
74
|
+
fillOpacity?: number;
|
|
75
|
+
/** Width of the curve. */
|
|
76
|
+
strokeWidth?: number;
|
|
77
|
+
/** Opacity 0..1. @default 1 */
|
|
78
|
+
opacity?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Reveal, 0..1: `reveal="x"` sweeps the curve in along the values; `"grow"` raises it from its
|
|
81
|
+
* baseline.
|
|
82
|
+
* @default 1
|
|
83
|
+
* @see https://sophistry.dev/guides/chart-animation/#reveals
|
|
84
|
+
*/
|
|
85
|
+
progress?: number;
|
|
86
|
+
/** How `progress` reveals. @default "x" */
|
|
87
|
+
reveal?: DensityReveal;
|
|
88
|
+
/**
|
|
89
|
+
* The sample to transition to, curves matched by `series`: shared curves morph in place, new
|
|
90
|
+
* ones sweep (or grow) in, leaving ones fade out. See {@link SeriesTransitionProps}.
|
|
91
|
+
* @see https://sophistry.dev/guides/chart-animation/#data-transitions
|
|
92
|
+
*/
|
|
93
|
+
to?: readonly T[];
|
|
94
|
+
/** Paint order (both curve and fill paint under the axes of that order). */
|
|
95
|
+
zIndex?: number;
|
|
96
|
+
/** Set to false to hide the curves. */
|
|
97
|
+
visible?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A kernel density estimate of a sample, drawn as an area whose y axis reads
|
|
101
|
+
* probability density. With `row`, curves sit in a band axis's rows: a
|
|
102
|
+
* ridgeline. Inside a `chart` or `axes`. See `gaussianKde` for the estimate
|
|
103
|
+
* alone.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { chart, density } from "@sophistry/charts";
|
|
108
|
+
*
|
|
109
|
+
* const rows = [
|
|
110
|
+
* { group: "a", height: 162 },
|
|
111
|
+
* { group: "a", height: 171 },
|
|
112
|
+
* { group: "b", height: 175 },
|
|
113
|
+
* { group: "b", height: 183 },
|
|
114
|
+
* ];
|
|
115
|
+
* chart.create({
|
|
116
|
+
* width: 8,
|
|
117
|
+
* height: 4,
|
|
118
|
+
* children: [density.create({ data: rows, x: "height", series: "group", row: true })],
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @see https://sophistry.dev/reference/chart-catalogue/#distributions
|
|
123
|
+
* @category Charts
|
|
124
|
+
*/
|
|
125
|
+
export declare const density: import("@sophistry/core").Definition<DensityProps<any>, import("@sophistry/core/internal").CompositeNode<DensityProps<any>>, keyof DensityProps<any>>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ecdf`: an empirical cumulative distribution function per `series`, drawn
|
|
3
|
+
* as `stairs` draws its lines (one path batch, see {@link drawStepLines}).
|
|
4
|
+
*/
|
|
5
|
+
import type { BandKey } from "@sophistry/core/geometry";
|
|
6
|
+
import type { Channel } from "../data/channels.js";
|
|
7
|
+
import type { CurveReveal, SeriesTransitionProps } from "../props.js";
|
|
8
|
+
import type { StepLineStyleProps } from "./stairs.js";
|
|
9
|
+
/**
|
|
10
|
+
* Props of {@link ecdf}: `value` defaults to the datum when `data` is
|
|
11
|
+
* `number[]`; name it otherwise.
|
|
12
|
+
*
|
|
13
|
+
* @category Charts
|
|
14
|
+
*/
|
|
15
|
+
export interface EcdfProps<T = unknown> extends SeriesTransitionProps<T>, StepLineStyleProps {
|
|
16
|
+
/** One observation per datum. */
|
|
17
|
+
data: readonly T[];
|
|
18
|
+
/**
|
|
19
|
+
* The observed value, in data units. Defaults to the datum when `data` is `number[]`; required
|
|
20
|
+
* otherwise. Non-finite values are dropped.
|
|
21
|
+
*/
|
|
22
|
+
value?: Channel<T, number>;
|
|
23
|
+
/**
|
|
24
|
+
* Data-space padding left of the smallest and right of the largest value; see {@link
|
|
25
|
+
* ecdfSteps}. Defaults to 5% of the span (0.5 when all values are equal).
|
|
26
|
+
*/
|
|
27
|
+
pad?: number;
|
|
28
|
+
/**
|
|
29
|
+
* How `progress` reveals the curve: along x or by arc length.
|
|
30
|
+
* @default "x"
|
|
31
|
+
* @see https://sophistry.dev/guides/chart-animation/#reveals
|
|
32
|
+
*/
|
|
33
|
+
reveal?: CurveReveal;
|
|
34
|
+
/**
|
|
35
|
+
* The category of each datum: one curve per category, coloured through the chart's shared
|
|
36
|
+
* colour scale and legend. `stroke` wins.
|
|
37
|
+
*/
|
|
38
|
+
series?: Channel<T, BandKey>;
|
|
39
|
+
/**
|
|
40
|
+
* The sample to transition to, curves matched by `series`: shared curves morph and stay step
|
|
41
|
+
* functions, new ones sweep in, leaving ones fade out. See {@link SeriesTransitionProps}.
|
|
42
|
+
* @see https://sophistry.dev/guides/chart-animation/#data-transitions
|
|
43
|
+
*/
|
|
44
|
+
to?: readonly T[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* An empirical cumulative distribution function: a step function rising
|
|
48
|
+
* from 0 to 1, jumping at each observed value. One curve per `series`.
|
|
49
|
+
* Inside a `chart` or an `axes` with a y range like `[0, 1, 0.25]`. See
|
|
50
|
+
* {@link ecdfSteps} for the steps alone.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { chart, ecdf } from "@sophistry/charts";
|
|
55
|
+
*
|
|
56
|
+
* const samples = [
|
|
57
|
+
* { group: "a", height: 162 },
|
|
58
|
+
* { group: "a", height: 171 },
|
|
59
|
+
* { group: "b", height: 175 },
|
|
60
|
+
* { group: "b", height: 183 },
|
|
61
|
+
* ];
|
|
62
|
+
* chart.create({
|
|
63
|
+
* width: 8,
|
|
64
|
+
* height: 4,
|
|
65
|
+
* children: [ecdf.create({ data: samples, value: "height", series: "group" })],
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @see https://sophistry.dev/reference/chart-catalogue/#distributions
|
|
70
|
+
* @category Charts
|
|
71
|
+
*/
|
|
72
|
+
export declare const ecdf: import("@sophistry/core").Definition<EcdfProps<any>, import("@sophistry/core/internal").CompositeNode<EcdfProps<any>>, keyof EcdfProps<any>>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fillBetween`: the shaded region between two channels (or one and the
|
|
3
|
+
* baseline), one region per `series`, drawn as one path batch (a closed
|
|
4
|
+
* item per region) in a group whose clip the `"x"` reveal sweeps;
|
|
5
|
+
* `reveal="length"` traces each region's outline instead (the item's
|
|
6
|
+
* `progress`), its fill coming up with it.
|
|
7
|
+
*/
|
|
8
|
+
import type { PaintSpec } from "@sophistry/core";
|
|
9
|
+
import type { BandKey, CurveKind } from "@sophistry/core/geometry";
|
|
10
|
+
import type { Channel, PositionValue } from "../data/channels.js";
|
|
11
|
+
import type { CurveReveal, SeriesTransitionProps } from "../props.js";
|
|
12
|
+
/**
|
|
13
|
+
* Props of {@link fillBetween}: `x` and `y1` default to the index and the
|
|
14
|
+
* datum when `data` is `number[]`; name them otherwise.
|
|
15
|
+
*
|
|
16
|
+
* @category Charts
|
|
17
|
+
*/
|
|
18
|
+
export interface FillBetweenProps<T = unknown> extends SeriesTransitionProps<T> {
|
|
19
|
+
/** One sample per datum along x; the region splits wherever `x`, `y1` or `y2` is non-finite. */
|
|
20
|
+
data: readonly T[];
|
|
21
|
+
/**
|
|
22
|
+
* X position, in data units (a `Date` reads as epoch ms). Defaults to the index when `data` is
|
|
23
|
+
* `number[]`; required otherwise.
|
|
24
|
+
*/
|
|
25
|
+
x?: Channel<T, PositionValue>;
|
|
26
|
+
/**
|
|
27
|
+
* One boundary, in data units. Defaults to the datum when `data` is `number[]`; required
|
|
28
|
+
* otherwise.
|
|
29
|
+
*/
|
|
30
|
+
y1?: Channel<T, number>;
|
|
31
|
+
/** The other boundary, in data units. Defaults to a flat line at the axis baseline. */
|
|
32
|
+
y2?: Channel<T, number>;
|
|
33
|
+
/**
|
|
34
|
+
* How `progress` reveals the region: `"x"` fills it left to right behind a straight front;
|
|
35
|
+
* `"length"` traces its outline and fades the fill up.
|
|
36
|
+
* @default "x"
|
|
37
|
+
* @see https://sophistry.dev/guides/chart-animation/#reveals
|
|
38
|
+
*/
|
|
39
|
+
reveal?: CurveReveal;
|
|
40
|
+
/**
|
|
41
|
+
* How both boundaries run between points: `"linear"` or any {@link CurveKind}. A `linePlot`
|
|
42
|
+
* with the same `curve` traces the region's edge.
|
|
43
|
+
* @default "linear"
|
|
44
|
+
*/
|
|
45
|
+
curve?: CurveKind;
|
|
46
|
+
/**
|
|
47
|
+
* The category of each datum: one region per category (a band per group), filled through the
|
|
48
|
+
* chart's shared colour scale and legend. `fill` wins.
|
|
49
|
+
*/
|
|
50
|
+
series?: Channel<T, BandKey>;
|
|
51
|
+
/**
|
|
52
|
+
* The data to transition to, regions matched by `series`: shared regions morph (both bounds
|
|
53
|
+
* blended per x), new ones sweep in, leaving ones fade out. See {@link SeriesTransitionProps}.
|
|
54
|
+
* @see https://sophistry.dev/guides/chart-animation/#data-transitions
|
|
55
|
+
*/
|
|
56
|
+
to?: readonly T[];
|
|
57
|
+
/** Region fill for every region. Defaults to the `series` colour, else the theme's first series colour. */
|
|
58
|
+
fill?: string;
|
|
59
|
+
/** Fill opacity 0..1. @default 0.3 */
|
|
60
|
+
fillOpacity?: number;
|
|
61
|
+
/** Region outline. @default "none" */
|
|
62
|
+
stroke?: PaintSpec;
|
|
63
|
+
/** Outline width. */
|
|
64
|
+
strokeWidth?: number;
|
|
65
|
+
/** Opacity 0..1. @default 1 */
|
|
66
|
+
opacity?: number;
|
|
67
|
+
/** Reveal 0..1 (see `reveal`). @default 1 */
|
|
68
|
+
progress?: number;
|
|
69
|
+
/** Paint order (the fill paints under the axes of that order). */
|
|
70
|
+
zIndex?: number;
|
|
71
|
+
/** Set to false to hide the regions. */
|
|
72
|
+
visible?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The shaded region between two channels of the same data, or between one
|
|
76
|
+
* and the baseline when `y2` is omitted: a translucent band behind a
|
|
77
|
+
* {@link linePlot}. Gaps in the data split it. Inside a `chart` or `axes`.
|
|
78
|
+
* For a function, use `areaUnderGraph`. See {@link fillBetweenRings} for the
|
|
79
|
+
* geometry alone.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { chart, fillBetween } from "@sophistry/charts";
|
|
84
|
+
*
|
|
85
|
+
* const rows = [
|
|
86
|
+
* { t: 0, low: 1, high: 3 },
|
|
87
|
+
* { t: 1, low: 2, high: 5 },
|
|
88
|
+
* { t: 2, low: 1.5, high: 4 },
|
|
89
|
+
* ];
|
|
90
|
+
* chart.create({
|
|
91
|
+
* width: 8,
|
|
92
|
+
* height: 4,
|
|
93
|
+
* children: [fillBetween.create({ data: rows, x: "t", y1: "high", y2: "low" })],
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @see https://sophistry.dev/reference/chart-catalogue/#lines-scatter-and-error-bars
|
|
98
|
+
* @category Charts
|
|
99
|
+
*/
|
|
100
|
+
export declare const fillBetween: import("@sophistry/core").Definition<FillBetweenProps<any>, import("@sophistry/core/internal").CompositeNode<FillBetweenProps<any>>, keyof FillBetweenProps<any>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Family barrel: lines and areas. Re-exported from the package entry. */
|
|
2
|
+
export type { DensityProps } from "./density.js";
|
|
3
|
+
export { density } from "./density.js";
|
|
4
|
+
export type { EcdfProps } from "./ecdf.js";
|
|
5
|
+
export { ecdf } from "./ecdf.js";
|
|
6
|
+
export type { FillBetweenProps } from "./fill-between.js";
|
|
7
|
+
export { fillBetween } from "./fill-between.js";
|
|
8
|
+
export type { LinePlotProps } from "./line-plot.js";
|
|
9
|
+
export { linePlot } from "./line-plot.js";
|
|
10
|
+
export type { RegressionProps } from "./regression.js";
|
|
11
|
+
export { regressionPlot } from "./regression.js";
|
|
12
|
+
export type { StackPlotProps } from "./stack-plot.js";
|
|
13
|
+
export { stackPlot } from "./stack-plot.js";
|
|
14
|
+
export type { StairsProps, StepLineStyleProps } from "./stairs.js";
|
|
15
|
+
export { stairs } from "./stairs.js";
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `linePlot`: a line through data points, one per `series`, drawn as one
|
|
3
|
+
* path batch (an open outline per line, each with its own stroke and fade).
|
|
4
|
+
*
|
|
5
|
+
* A keyed transition (`to` + `blend`) matches lines by `series`: shared lines
|
|
6
|
+
* morph on one x grid (`morphRuns`), entering ones sweep in along x, leaving
|
|
7
|
+
* ones fade. `progress` cuts every line at one front along x (the cut
|
|
8
|
+
* geometry is drawn whole), or with `reveal="length"` draws each line along
|
|
9
|
+
* its arc length (the item's `progress`).
|
|
10
|
+
* A line far longer than the plot is wide is decimated to the plot's
|
|
11
|
+
* columns at rest.
|
|
12
|
+
*/
|
|
13
|
+
import type { PaintSpec } from "@sophistry/core";
|
|
14
|
+
import type { BandKey, CurveKind } from "@sophistry/core/geometry";
|
|
15
|
+
import type { Channel, PositionValue } from "../data/channels.js";
|
|
16
|
+
import type { CurveReveal, SeriesTransitionProps } from "../props.js";
|
|
17
|
+
/**
|
|
18
|
+
* Props of {@link linePlot}: `x` and `y` default to the index and the datum
|
|
19
|
+
* when `data` is `number[]`; name them otherwise.
|
|
20
|
+
*
|
|
21
|
+
* @category Charts
|
|
22
|
+
*/
|
|
23
|
+
export interface LinePlotProps<T = unknown> extends SeriesTransitionProps<T> {
|
|
24
|
+
/** One point per datum, in order; a datum with a non-finite `x` or `y` lifts the pen. */
|
|
25
|
+
data: readonly T[];
|
|
26
|
+
/**
|
|
27
|
+
* X position, in data units (a `Date` reads as epoch ms). Defaults to the index when `data` is
|
|
28
|
+
* `number[]`; required otherwise.
|
|
29
|
+
*/
|
|
30
|
+
x?: Channel<T, PositionValue>;
|
|
31
|
+
/**
|
|
32
|
+
* Y position, in data units (a `Date` reads as epoch ms). Defaults to the datum when `data` is
|
|
33
|
+
* `number[]`; required otherwise.
|
|
34
|
+
*/
|
|
35
|
+
y?: Channel<T, PositionValue>;
|
|
36
|
+
/**
|
|
37
|
+
* How `progress` reveals the line: `"x"` sweeps it in left to right at a constant rate along x;
|
|
38
|
+
* `"length"` draws it by arc length (better for a connected scatter).
|
|
39
|
+
* @default "x"
|
|
40
|
+
* @see https://sophistry.dev/guides/chart-animation/#reveals
|
|
41
|
+
*/
|
|
42
|
+
reveal?: CurveReveal;
|
|
43
|
+
/**
|
|
44
|
+
* How the line runs between points: `"linear"`, `"monotone"` (smooth, never overshoots),
|
|
45
|
+
* `"natural"`, `"catmull-rom"`, or `"step"`/`"step-before"`/`"step-after"`. See {@link
|
|
46
|
+
* CurveKind}.
|
|
47
|
+
* @default "linear"
|
|
48
|
+
*/
|
|
49
|
+
curve?: CurveKind;
|
|
50
|
+
/**
|
|
51
|
+
* The category of each datum: one line per category, coloured through the chart's shared colour
|
|
52
|
+
* scale and legend. `stroke` wins.
|
|
53
|
+
*/
|
|
54
|
+
series?: Channel<T, BandKey>;
|
|
55
|
+
/**
|
|
56
|
+
* The data to transition to, lines matched by `series`: shared lines morph (y blended per x),
|
|
57
|
+
* new ones sweep in, leaving ones fade out. See {@link SeriesTransitionProps}.
|
|
58
|
+
* @see https://sophistry.dev/guides/chart-animation/#data-transitions
|
|
59
|
+
*/
|
|
60
|
+
to?: readonly T[];
|
|
61
|
+
/** Line colour (or gradient) for every line. Defaults to the `series` colour, else the theme's foreground. */
|
|
62
|
+
stroke?: PaintSpec;
|
|
63
|
+
/** Line width. Defaults to the theme's stroke width. */
|
|
64
|
+
strokeWidth?: number;
|
|
65
|
+
/** Dash pattern, in scene units. Solid when omitted. */
|
|
66
|
+
dash?: number[];
|
|
67
|
+
/** Offset into `dash`. @default 0 */
|
|
68
|
+
dashOffset?: number;
|
|
69
|
+
/** How line ends are capped. @default "round" */
|
|
70
|
+
lineCap?: CanvasLineCap;
|
|
71
|
+
/** How corners are joined. @default "round" */
|
|
72
|
+
lineJoin?: CanvasLineJoin;
|
|
73
|
+
/** Opacity 0..1. @default 1 */
|
|
74
|
+
opacity?: number;
|
|
75
|
+
/** Reveal 0..1 (see `reveal`). @default 1 */
|
|
76
|
+
progress?: number;
|
|
77
|
+
/** Paint order. */
|
|
78
|
+
zIndex?: number;
|
|
79
|
+
/** Set to false to hide the lines. */
|
|
80
|
+
visible?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A line through data points, in data coordinates; one line per `series`.
|
|
84
|
+
* Non-finite points split the line into runs. Inside a `chart` (or any
|
|
85
|
+
* `axes`). For a function `y = f(x)`, use `functionGraph`. Drawn as one path
|
|
86
|
+
* batch: one item per line.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* import { chart, linePlot } from "@sophistry/charts";
|
|
91
|
+
*
|
|
92
|
+
* // number[] data: x is the index, y the value. With records, name the
|
|
93
|
+
* // channels: linePlot.create({ data: rows, x: "year", y: (d) => d.sales / 1000 }).
|
|
94
|
+
* chart.create({
|
|
95
|
+
* width: 8,
|
|
96
|
+
* height: 5,
|
|
97
|
+
* children: [linePlot.create({ data: [1, 4, 3, 7, 6, 9] })],
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @see https://sophistry.dev/reference/chart-catalogue/#lines-scatter-and-error-bars
|
|
102
|
+
* @category Charts
|
|
103
|
+
*/
|
|
104
|
+
export declare const linePlot: import("@sophistry/core").Definition<LinePlotProps<any>, import("@sophistry/core/internal").CompositeNode<LinePlotProps<any>>, keyof LinePlotProps<any>>;
|