@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
package/dist/series.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared by marks with a `series` channel: reading it, grouping data by it,
|
|
3
|
+
* the colour-scale and legend report, and per-datum keys. Colours come from
|
|
4
|
+
* the enclosing chart's scale (or the layer's own) unless an explicit colour
|
|
5
|
+
* prop overrides it; an overridden layer adds nothing to the legend.
|
|
6
|
+
* Internal.
|
|
7
|
+
*/
|
|
8
|
+
import type { BandKey } from "@sophistry/core/geometry";
|
|
9
|
+
import type { ChartLayer } from "./context.js";
|
|
10
|
+
import type { Channel, DateSink } from "./data/channels.js";
|
|
11
|
+
import type { ColorExtent, LegendMark } from "./frame/types.js";
|
|
12
|
+
import type { OrdinalColorScale } from "./math/ordinal.js";
|
|
13
|
+
/** The one group of a grouped mark drawn without a `series`. */
|
|
14
|
+
export declare const WHOLE: unique symbol;
|
|
15
|
+
/** A group of a grouped mark: a category, or {@link WHOLE}. */
|
|
16
|
+
export type GroupKey = BandKey | typeof WHOLE;
|
|
17
|
+
/** A datum's category, as read: nullish when the channel gives none. */
|
|
18
|
+
export type Category = BandKey | null | undefined;
|
|
19
|
+
/** One update's view of a layer's `series`. See {@link createSeries}. */
|
|
20
|
+
export interface SeriesState {
|
|
21
|
+
/** Each datum's category, or undefined without a `series`. */
|
|
22
|
+
of: Category[] | undefined;
|
|
23
|
+
/** The categories, in first-seen order (empty without a `series`). */
|
|
24
|
+
categories: readonly BandKey[];
|
|
25
|
+
/** True when colours come from the scale: a `series`, and no override. */
|
|
26
|
+
scaled: boolean;
|
|
27
|
+
/** The layer's `color` report, or undefined when not scaled. */
|
|
28
|
+
extent: ColorExtent | undefined;
|
|
29
|
+
/** The scale (the frame's inside a chart, else the layer's own). */
|
|
30
|
+
scale: OrdinalColorScale;
|
|
31
|
+
/** A category's colour, or undefined when not scaled. */
|
|
32
|
+
colorOf(category: Category): string | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** What {@link createSeries}'s function takes on each update. */
|
|
35
|
+
export interface SeriesSpec<T> {
|
|
36
|
+
data: readonly T[];
|
|
37
|
+
series: Channel<T, BandKey> | undefined;
|
|
38
|
+
/** An explicit colour prop is set: the scale (and legend) step aside. */
|
|
39
|
+
overridden: boolean;
|
|
40
|
+
mark: LegendMark;
|
|
41
|
+
/** Only these indices count towards the categories. */
|
|
42
|
+
counted?: readonly number[] | undefined;
|
|
43
|
+
dates?: DateSink | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Reads a layer's `series` channel and its colour scale. Call once, in
|
|
47
|
+
* `setup`; call the result in each `update`. Caches the per-datum read by
|
|
48
|
+
* `data` and channel identity, and the categories by value.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createSeries<T>(layer: ChartLayer): (spec: SeriesSpec<T>) => SeriesState;
|
|
51
|
+
/**
|
|
52
|
+
* The indices of each group, in first-seen order: one {@link WHOLE} group of
|
|
53
|
+
* every index without a `series`, else one per category (nullish and NaN
|
|
54
|
+
* categories dropped).
|
|
55
|
+
*/
|
|
56
|
+
export declare function groupIndices(count: number, of: readonly Category[] | undefined): Map<GroupKey, number[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Each datum's key: the `key` channel, else its place within its series,
|
|
59
|
+
* else its index.
|
|
60
|
+
*/
|
|
61
|
+
export declare function datumKeysOf<T>(data: readonly T[], key: Channel<T, BandKey> | undefined, of: readonly Category[] | undefined, dates?: DateSink | null): BandKey[];
|
|
62
|
+
/**
|
|
63
|
+
* Dodge slots for a `series`: each category's slot in the colour scale's
|
|
64
|
+
* order (categories the scale lacks go last).
|
|
65
|
+
*/
|
|
66
|
+
export declare function dodgeSlotsFor(of: readonly Category[], categories: readonly BandKey[], scale: OrdinalColorScale): {
|
|
67
|
+
count: number;
|
|
68
|
+
of: (index: number) => number | undefined;
|
|
69
|
+
};
|
|
70
|
+
/** Each key's position in `keys`. */
|
|
71
|
+
export declare function slotsOf(keys: readonly BandKey[]): Map<BandKey, number>;
|