react-cheminfo 0.15.0 → 0.16.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.
Files changed (142) hide show
  1. package/README.md +96 -0
  2. package/lib/core.d.ts +1 -0
  3. package/lib/core.d.ts.map +1 -1
  4. package/lib/core.js +1 -0
  5. package/lib/core.js.map +1 -1
  6. package/lib/credits/core/credits.d.ts +17 -0
  7. package/lib/credits/core/credits.d.ts.map +1 -1
  8. package/lib/credits/core/credits.js +20 -0
  9. package/lib/credits/core/credits.js.map +1 -1
  10. package/lib/ecosystem/core/sites.d.ts.map +1 -1
  11. package/lib/ecosystem/core/sites.js +40 -0
  12. package/lib/ecosystem/core/sites.js.map +1 -1
  13. package/lib/ecosystem/core/types.d.ts +1 -1
  14. package/lib/ecosystem/core/types.d.ts.map +1 -1
  15. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  16. package/lib/ecosystem/ui/glyphs.js +11 -0
  17. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  18. package/lib/parallel/core/index.d.ts +27 -0
  19. package/lib/parallel/core/index.d.ts.map +1 -0
  20. package/lib/parallel/core/index.js +20 -0
  21. package/lib/parallel/core/index.js.map +1 -0
  22. package/lib/parallel/core/parallelAxes.d.ts +103 -0
  23. package/lib/parallel/core/parallelAxes.d.ts.map +1 -0
  24. package/lib/parallel/core/parallelAxes.js +146 -0
  25. package/lib/parallel/core/parallelAxes.js.map +1 -0
  26. package/lib/parallel/core/parallelBrush.d.ts +79 -0
  27. package/lib/parallel/core/parallelBrush.d.ts.map +1 -0
  28. package/lib/parallel/core/parallelBrush.js +99 -0
  29. package/lib/parallel/core/parallelBrush.js.map +1 -0
  30. package/lib/parallel/core/parallelExtent.d.ts +28 -0
  31. package/lib/parallel/core/parallelExtent.d.ts.map +1 -0
  32. package/lib/parallel/core/parallelExtent.js +47 -0
  33. package/lib/parallel/core/parallelExtent.js.map +1 -0
  34. package/lib/parallel/core/parallelFilter.d.ts +36 -0
  35. package/lib/parallel/core/parallelFilter.d.ts.map +1 -0
  36. package/lib/parallel/core/parallelFilter.js +74 -0
  37. package/lib/parallel/core/parallelFilter.js.map +1 -0
  38. package/lib/parallel/core/parallelHit.d.ts +47 -0
  39. package/lib/parallel/core/parallelHit.d.ts.map +1 -0
  40. package/lib/parallel/core/parallelHit.js +81 -0
  41. package/lib/parallel/core/parallelHit.js.map +1 -0
  42. package/lib/parallel/core/parallelPaint.d.ts +104 -0
  43. package/lib/parallel/core/parallelPaint.d.ts.map +1 -0
  44. package/lib/parallel/core/parallelPaint.js +160 -0
  45. package/lib/parallel/core/parallelPaint.js.map +1 -0
  46. package/lib/parallel/core/parallelPalette.d.ts +31 -0
  47. package/lib/parallel/core/parallelPalette.d.ts.map +1 -0
  48. package/lib/parallel/core/parallelPalette.js +68 -0
  49. package/lib/parallel/core/parallelPalette.js.map +1 -0
  50. package/lib/parallel/core/parallelTicks.d.ts +34 -0
  51. package/lib/parallel/core/parallelTicks.d.ts.map +1 -0
  52. package/lib/parallel/core/parallelTicks.js +116 -0
  53. package/lib/parallel/core/parallelTicks.js.map +1 -0
  54. package/lib/parallel/core/parallelTypes.d.ts +129 -0
  55. package/lib/parallel/core/parallelTypes.d.ts.map +1 -0
  56. package/lib/parallel/core/parallelTypes.js +29 -0
  57. package/lib/parallel/core/parallelTypes.js.map +1 -0
  58. package/lib/parallel/ui/ParallelAxesLayer.d.ts +28 -0
  59. package/lib/parallel/ui/ParallelAxesLayer.d.ts.map +1 -0
  60. package/lib/parallel/ui/ParallelAxesLayer.js +29 -0
  61. package/lib/parallel/ui/ParallelAxesLayer.js.map +1 -0
  62. package/lib/parallel/ui/ParallelCoordinates.d.ts +21 -0
  63. package/lib/parallel/ui/ParallelCoordinates.d.ts.map +1 -0
  64. package/lib/parallel/ui/ParallelCoordinates.js +109 -0
  65. package/lib/parallel/ui/ParallelCoordinates.js.map +1 -0
  66. package/lib/parallel/ui/ParallelLabels.d.ts +26 -0
  67. package/lib/parallel/ui/ParallelLabels.d.ts.map +1 -0
  68. package/lib/parallel/ui/ParallelLabels.js +25 -0
  69. package/lib/parallel/ui/ParallelLabels.js.map +1 -0
  70. package/lib/parallel/ui/ParallelTooltip.d.ts +26 -0
  71. package/lib/parallel/ui/ParallelTooltip.d.ts.map +1 -0
  72. package/lib/parallel/ui/ParallelTooltip.js +30 -0
  73. package/lib/parallel/ui/ParallelTooltip.js.map +1 -0
  74. package/lib/parallel/ui/index.d.ts +25 -0
  75. package/lib/parallel/ui/index.d.ts.map +1 -0
  76. package/lib/parallel/ui/index.js +18 -0
  77. package/lib/parallel/ui/index.js.map +1 -0
  78. package/lib/parallel/ui/parallelCoordinatesProps.d.ts +185 -0
  79. package/lib/parallel/ui/parallelCoordinatesProps.d.ts.map +1 -0
  80. package/lib/parallel/ui/parallelCoordinatesProps.js +11 -0
  81. package/lib/parallel/ui/parallelCoordinatesProps.js.map +1 -0
  82. package/lib/parallel/ui/parallelGestureModel.d.ts +52 -0
  83. package/lib/parallel/ui/parallelGestureModel.d.ts.map +1 -0
  84. package/lib/parallel/ui/parallelGestureModel.js +80 -0
  85. package/lib/parallel/ui/parallelGestureModel.js.map +1 -0
  86. package/lib/parallel/ui/parallelInk.d.ts +76 -0
  87. package/lib/parallel/ui/parallelInk.d.ts.map +1 -0
  88. package/lib/parallel/ui/parallelInk.js +113 -0
  89. package/lib/parallel/ui/parallelInk.js.map +1 -0
  90. package/lib/parallel/ui/parallelPlotModel.d.ts +55 -0
  91. package/lib/parallel/ui/parallelPlotModel.d.ts.map +1 -0
  92. package/lib/parallel/ui/parallelPlotModel.js +113 -0
  93. package/lib/parallel/ui/parallelPlotModel.js.map +1 -0
  94. package/lib/parallel/ui/parallelStyles.d.ts +83 -0
  95. package/lib/parallel/ui/parallelStyles.d.ts.map +1 -0
  96. package/lib/parallel/ui/parallelStyles.js +131 -0
  97. package/lib/parallel/ui/parallelStyles.js.map +1 -0
  98. package/lib/parallel/ui/useParallelCanvas.d.ts +49 -0
  99. package/lib/parallel/ui/useParallelCanvas.d.ts.map +1 -0
  100. package/lib/parallel/ui/useParallelCanvas.js +58 -0
  101. package/lib/parallel/ui/useParallelCanvas.js.map +1 -0
  102. package/lib/parallel/ui/useParallelGesture.d.ts +67 -0
  103. package/lib/parallel/ui/useParallelGesture.d.ts.map +1 -0
  104. package/lib/parallel/ui/useParallelGesture.js +139 -0
  105. package/lib/parallel/ui/useParallelGesture.js.map +1 -0
  106. package/lib/structure/ui/useToolbarFloor.d.ts.map +1 -1
  107. package/lib/structure/ui/useToolbarFloor.js +29 -22
  108. package/lib/structure/ui/useToolbarFloor.js.map +1 -1
  109. package/lib/ui.d.ts +1 -0
  110. package/lib/ui.d.ts.map +1 -1
  111. package/lib/ui.js +1 -0
  112. package/lib/ui.js.map +1 -1
  113. package/package.json +1 -1
  114. package/src/core.ts +1 -0
  115. package/src/credits/core/credits.ts +21 -0
  116. package/src/ecosystem/core/sites.ts +40 -0
  117. package/src/ecosystem/core/types.ts +4 -1
  118. package/src/ecosystem/ui/glyphs.tsx +46 -0
  119. package/src/parallel/core/index.ts +80 -0
  120. package/src/parallel/core/parallelAxes.ts +207 -0
  121. package/src/parallel/core/parallelBrush.ts +145 -0
  122. package/src/parallel/core/parallelExtent.ts +56 -0
  123. package/src/parallel/core/parallelFilter.ts +94 -0
  124. package/src/parallel/core/parallelHit.ts +106 -0
  125. package/src/parallel/core/parallelPaint.ts +231 -0
  126. package/src/parallel/core/parallelPalette.ts +80 -0
  127. package/src/parallel/core/parallelTicks.ts +164 -0
  128. package/src/parallel/core/parallelTypes.ts +147 -0
  129. package/src/parallel/ui/ParallelAxesLayer.tsx +123 -0
  130. package/src/parallel/ui/ParallelCoordinates.tsx +233 -0
  131. package/src/parallel/ui/ParallelLabels.tsx +56 -0
  132. package/src/parallel/ui/ParallelTooltip.tsx +55 -0
  133. package/src/parallel/ui/index.ts +50 -0
  134. package/src/parallel/ui/parallelCoordinatesProps.ts +199 -0
  135. package/src/parallel/ui/parallelGestureModel.ts +109 -0
  136. package/src/parallel/ui/parallelInk.ts +182 -0
  137. package/src/parallel/ui/parallelPlotModel.ts +130 -0
  138. package/src/parallel/ui/parallelStyles.ts +146 -0
  139. package/src/parallel/ui/useParallelCanvas.ts +104 -0
  140. package/src/parallel/ui/useParallelGesture.ts +227 -0
  141. package/src/structure/ui/useToolbarFloor.ts +27 -22
  142. package/src/ui.ts +1 -0
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Which row the pointer is over.
3
+ *
4
+ * Only the segment between the two axes the pointer sits between is tested, so
5
+ * the cost is one distance per row whatever the number of axes. The vertical
6
+ * gap to the segment is projected onto its normal, so a steep line is no
7
+ * harder to pick than a flat one — without which the only rows a reader can
8
+ * ever point at are the uninteresting ones.
9
+ */
10
+ import { parallelPixelAt } from "./parallelAxes.js";
11
+ /** How far the pointer may sit from a line and still pick it, in pixels. */
12
+ export const PARALLEL_HOVER_TOLERANCE = 6;
13
+ /**
14
+ * The pair of axes a horizontal position sits between.
15
+ * @param x - Pixels from the left of the drawing area.
16
+ * @param axes - The axes, from left to right.
17
+ * @param tolerance - How far past the first and the last axis still counts. Defaults to {@link PARALLEL_HOVER_TOLERANCE}.
18
+ * @returns The pair, or `null` when there are fewer than two axes or the
19
+ * position is past either end of the figure.
20
+ */
21
+ export function parallelSegmentAt(x, axes, tolerance = PARALLEL_HOVER_TOLERANCE) {
22
+ const first = axes[0];
23
+ const last = axes.at(-1);
24
+ if (first === undefined || last === undefined || axes.length < 2)
25
+ return null;
26
+ if (x < first.x - tolerance || x > last.x + tolerance)
27
+ return null;
28
+ for (let index = 1; index < axes.length; index++) {
29
+ const right = axes[index];
30
+ if (right === undefined)
31
+ continue;
32
+ if (x <= right.x || index === axes.length - 1) {
33
+ return { left: index - 1, right: index };
34
+ }
35
+ }
36
+ return null;
37
+ }
38
+ /**
39
+ * The row whose line runs closest to the pointer.
40
+ * @param point - Where the pointer is, relative to the drawing area.
41
+ * @param axes - The axes, from left to right.
42
+ * @param values - Each axis's column, in the same order.
43
+ * @param count - How many rows are drawn.
44
+ * @param included - Which rows a brush keeps, a zero meaning the row is not pickable. Defaults to every row.
45
+ * @param tolerance - How far the pointer may sit from a line. Defaults to {@link PARALLEL_HOVER_TOLERANCE}.
46
+ * @returns The row, or `-1` when the pointer is over no line.
47
+ */
48
+ export function parallelNearestRow(point, axes, values, count, included, tolerance = PARALLEL_HOVER_TOLERANCE) {
49
+ const segment = parallelSegmentAt(point.x, axes, tolerance);
50
+ if (segment === null)
51
+ return -1;
52
+ const left = axes[segment.left];
53
+ const right = axes[segment.right];
54
+ const leftColumn = values[segment.left];
55
+ const rightColumn = values[segment.right];
56
+ if (left === undefined || right === undefined)
57
+ return -1;
58
+ if (leftColumn === undefined || rightColumn === undefined)
59
+ return -1;
60
+ const width = right.x - left.x;
61
+ if (width <= 0)
62
+ return -1;
63
+ const ratio = (point.x - left.x) / width;
64
+ const rows = Math.min(count, leftColumn.length, rightColumn.length);
65
+ let nearest = -1;
66
+ let nearestDistance = tolerance;
67
+ for (let row = 0; row < rows; row++) {
68
+ if (included?.[row] === 0)
69
+ continue;
70
+ const leftY = parallelPixelAt(left.pixels, leftColumn[row]);
71
+ const rightY = parallelPixelAt(right.pixels, rightColumn[row]);
72
+ const gap = Math.abs(leftY + (rightY - leftY) * ratio - point.y);
73
+ const distance = (gap * width) / Math.hypot(width, rightY - leftY);
74
+ if (distance < nearestDistance) {
75
+ nearestDistance = distance;
76
+ nearest = row;
77
+ }
78
+ }
79
+ return nearest;
80
+ }
81
+ //# sourceMappingURL=parallelHit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelHit.js","sourceRoot":"","sources":["../../../src/parallel/core/parallelHit.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAkB1C;;;;;;;GAOG;AACH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AC,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;QACnE,IAAI,QAAQ,GAAG,eAAe,EAAE,CAAC;YAC/B,eAAe,GAAG,QAAQ,CAAC;YAC3B,OAAO,GAAG,GAAG,CAAC;QAChB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * The lines, painted into a canvas.
3
+ *
4
+ * The first canvas figure in the family, and for one reason: ten thousand
5
+ * polylines of a dozen points each is a hundred and twenty thousand SVG
6
+ * coordinates the browser would keep as elements. Everything a reader points
7
+ * at, brushes or reads is still SVG or HTML over the top, so only the mass of
8
+ * lines is pixels — which is also why saving the figure keeps the axes and
9
+ * loses the lines, and why a site that needs a downloadable figure should say
10
+ * so before choosing this one.
11
+ */
12
+ import type { ParallelAxisLayout } from './parallelAxes.ts';
13
+ /** How strongly one kept line is drawn, so that the mass reads as a density. */
14
+ export declare const PARALLEL_INCLUDED_ALPHA = 0.35;
15
+ /** What one pass of the line painter needs. */
16
+ export interface ParallelPaint {
17
+ /** The axes, from left to right, already placed and measured. */
18
+ layouts: readonly ParallelAxisLayout[];
19
+ /** Each axis's column, in the same order. */
20
+ values: ReadonlyArray<ArrayLike<number>>;
21
+ /** How many rows to draw. */
22
+ count: number;
23
+ /**
24
+ * Which rows the brushes keep, a zero meaning the row is drawn underneath in
25
+ * the excluded ink.
26
+ * @default null — every row is kept and nothing is drawn underneath
27
+ */
28
+ included?: Uint8Array | null;
29
+ /**
30
+ * Which colour each row takes, as a step into `palette`.
31
+ * @default null — every line takes `line`
32
+ */
33
+ steps?: Uint8Array | null;
34
+ /**
35
+ * The colours a step indexes, from `parallelPalette`.
36
+ * @default [] — nothing to index
37
+ */
38
+ palette?: readonly string[];
39
+ /** The ink a line takes when no quantity is colouring the lines. */
40
+ line: string;
41
+ /** The ink the rows a brush left out are drawn in. */
42
+ excluded: string;
43
+ /**
44
+ * How strongly a kept line is drawn. Turn it down for a dense library.
45
+ * @default PARALLEL_INCLUDED_ALPHA
46
+ */
47
+ includedAlpha?: number;
48
+ }
49
+ /** One row drawn over the mass, and the ink it is drawn in. */
50
+ export interface ParallelHighlight {
51
+ /** The row. */
52
+ row: number;
53
+ /** Its ink. */
54
+ color: string;
55
+ }
56
+ /** What the highlight pass needs. */
57
+ export interface ParallelHighlightPaint {
58
+ /** The rows to draw, the last one on top. */
59
+ highlights: readonly ParallelHighlight[];
60
+ /** The axes, from left to right. */
61
+ layouts: readonly ParallelAxisLayout[];
62
+ /** Each axis's column, in the same order. */
63
+ values: ReadonlyArray<ArrayLike<number>>;
64
+ /** The ink the halo under each line is drawn in. */
65
+ halo: string;
66
+ }
67
+ /**
68
+ * Resize a canvas to the device pixel grid and move its origin to the drawing
69
+ * area, which also clears whatever it held.
70
+ * @param canvas - The canvas, or `null` before it is mounted.
71
+ * @param width - Width of the figure, in CSS pixels.
72
+ * @param height - Its height, in CSS pixels.
73
+ * @returns The context, or `null` when there is nothing to draw on.
74
+ */
75
+ export declare function preparePlotCanvas(canvas: HTMLCanvasElement | null, width: number, height: number): CanvasRenderingContext2D | null;
76
+ /**
77
+ * Draw one line per row: the ones a brush left out first, underneath, then the
78
+ * kept ones over them.
79
+ *
80
+ * The excluded rows are one single path stroked once, in a light grey rather
81
+ * than a translucent black: overlapping segments of one stroked path
82
+ * accumulate alpha, so a translucent black saturates to black wherever the
83
+ * library is dense, while a light grey is a colour the pile can only converge
84
+ * on.
85
+ * @param context - A context already scaled and moved to the drawing area by {@link preparePlotCanvas}.
86
+ * @param paint - See {@link ParallelPaint}.
87
+ */
88
+ export declare function paintParallelLines(context: CanvasRenderingContext2D, paint: ParallelPaint): void;
89
+ /**
90
+ * Draw a few singled-out rows over the mass, each over a halo and dotted at
91
+ * every axis crossing.
92
+ * @param context - A context already scaled and moved to the drawing area.
93
+ * @param paint - See {@link ParallelHighlightPaint}.
94
+ */
95
+ export declare function paintParallelHighlights(context: CanvasRenderingContext2D, paint: ParallelHighlightPaint): void;
96
+ /**
97
+ * Add one row's line to the path being built.
98
+ * @param context - A context already scaled and moved to the drawing area.
99
+ * @param row - The row to trace.
100
+ * @param layouts - The axes, from left to right.
101
+ * @param values - Each axis's column, in the same order.
102
+ */
103
+ export declare function traceParallelRow(context: CanvasRenderingContext2D, row: number, layouts: readonly ParallelAxisLayout[], values: ReadonlyArray<ArrayLike<number>>): void;
104
+ //# sourceMappingURL=parallelPaint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelPaint.d.ts","sourceRoot":"","sources":["../../../src/parallel/core/parallelPaint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,gFAAgF;AAChF,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAa5C,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvC,6CAA6C;IAC7C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,eAAe;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qCAAqC;AACrC,MAAM,WAAW,sBAAsB;IACrC,6CAA6C;IAC7C,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACzC,oCAAoC;IACpC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvC,6CAA6C;IAC7C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,wBAAwB,GAAG,IAAI,CAYjC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,aAAa,GACnB,IAAI,CAoCN;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,sBAAsB,GAC5B,IAAI,CA2BN;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,wBAAwB,EACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,SAAS,kBAAkB,EAAE,EACtC,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GACvC,IAAI,CAiBN"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * The lines, painted into a canvas.
3
+ *
4
+ * The first canvas figure in the family, and for one reason: ten thousand
5
+ * polylines of a dozen points each is a hundred and twenty thousand SVG
6
+ * coordinates the browser would keep as elements. Everything a reader points
7
+ * at, brushes or reads is still SVG or HTML over the top, so only the mass of
8
+ * lines is pixels — which is also why saving the figure keeps the axes and
9
+ * loses the lines, and why a site that needs a downloadable figure should say
10
+ * so before choosing this one.
11
+ */
12
+ import { PARALLEL_MARGIN, parallelPixelAt } from "./parallelAxes.js";
13
+ /** How strongly one kept line is drawn, so that the mass reads as a density. */
14
+ export const PARALLEL_INCLUDED_ALPHA = 0.35;
15
+ /** How wide a singled-out line's halo is, in pixels. */
16
+ const HALO_WIDTH = 5;
17
+ /** How wide a singled-out line itself is. */
18
+ const HIGHLIGHT_WIDTH = 2;
19
+ /** How large the dot at each of its axis crossings is. */
20
+ const HIGHLIGHT_DOT_RADIUS = 3;
21
+ const FULL_TURN = 2 * Math.PI;
22
+ /**
23
+ * Resize a canvas to the device pixel grid and move its origin to the drawing
24
+ * area, which also clears whatever it held.
25
+ * @param canvas - The canvas, or `null` before it is mounted.
26
+ * @param width - Width of the figure, in CSS pixels.
27
+ * @param height - Its height, in CSS pixels.
28
+ * @returns The context, or `null` when there is nothing to draw on.
29
+ */
30
+ export function preparePlotCanvas(canvas, width, height) {
31
+ if (canvas === null)
32
+ return null;
33
+ const context = canvas.getContext('2d');
34
+ if (context === null)
35
+ return null;
36
+ const pixelRatio = Math.max(globalThis.devicePixelRatio || 1, 1);
37
+ // Assigning the backing store is what clears it; there is no second clear.
38
+ canvas.width = Math.round(width * pixelRatio);
39
+ canvas.height = Math.round(height * pixelRatio);
40
+ context.resetTransform();
41
+ context.scale(pixelRatio, pixelRatio);
42
+ context.translate(PARALLEL_MARGIN.left, PARALLEL_MARGIN.top);
43
+ return context;
44
+ }
45
+ /**
46
+ * Draw one line per row: the ones a brush left out first, underneath, then the
47
+ * kept ones over them.
48
+ *
49
+ * The excluded rows are one single path stroked once, in a light grey rather
50
+ * than a translucent black: overlapping segments of one stroked path
51
+ * accumulate alpha, so a translucent black saturates to black wherever the
52
+ * library is dense, while a light grey is a colour the pile can only converge
53
+ * on.
54
+ * @param context - A context already scaled and moved to the drawing area by {@link preparePlotCanvas}.
55
+ * @param paint - See {@link ParallelPaint}.
56
+ */
57
+ export function paintParallelLines(context, paint) {
58
+ const { layouts, values, count, line, excluded, includedAlpha } = paint;
59
+ if (layouts.length < 2)
60
+ return;
61
+ const included = paint.included ?? null;
62
+ const steps = paint.steps ?? null;
63
+ const palette = paint.palette ?? [];
64
+ context.lineWidth = 1;
65
+ if (included !== null) {
66
+ context.strokeStyle = excluded;
67
+ context.beginPath();
68
+ for (let row = 0; row < count; row++) {
69
+ if (included[row] !== 0)
70
+ continue;
71
+ traceParallelRow(context, row, layouts, values);
72
+ }
73
+ context.stroke();
74
+ }
75
+ context.globalAlpha = includedAlpha ?? PARALLEL_INCLUDED_ALPHA;
76
+ context.strokeStyle = line;
77
+ let previousStep = -1;
78
+ for (let row = 0; row < count; row++) {
79
+ if (included !== null && included[row] === 0)
80
+ continue;
81
+ if (steps !== null) {
82
+ const step = steps[row];
83
+ if (step !== previousStep) {
84
+ const color = palette[step];
85
+ if (color !== undefined)
86
+ context.strokeStyle = color;
87
+ previousStep = step;
88
+ }
89
+ }
90
+ context.beginPath();
91
+ traceParallelRow(context, row, layouts, values);
92
+ context.stroke();
93
+ }
94
+ context.globalAlpha = 1;
95
+ }
96
+ /**
97
+ * Draw a few singled-out rows over the mass, each over a halo and dotted at
98
+ * every axis crossing.
99
+ * @param context - A context already scaled and moved to the drawing area.
100
+ * @param paint - See {@link ParallelHighlightPaint}.
101
+ */
102
+ export function paintParallelHighlights(context, paint) {
103
+ const { highlights, layouts, values, halo } = paint;
104
+ if (layouts.length < 2)
105
+ return;
106
+ context.lineJoin = 'round';
107
+ context.lineCap = 'round';
108
+ for (const { row, color } of highlights) {
109
+ context.beginPath();
110
+ traceParallelRow(context, row, layouts, values);
111
+ context.strokeStyle = halo;
112
+ context.lineWidth = HALO_WIDTH;
113
+ context.stroke();
114
+ context.strokeStyle = color;
115
+ context.lineWidth = HIGHLIGHT_WIDTH;
116
+ context.stroke();
117
+ context.fillStyle = color;
118
+ for (let index = 0; index < layouts.length; index++) {
119
+ const layout = layouts[index];
120
+ const column = values[index];
121
+ if (layout === undefined || column === undefined)
122
+ continue;
123
+ const y = parallelPixelAt(layout.pixels, column[row]);
124
+ if (!Number.isFinite(y))
125
+ continue;
126
+ context.beginPath();
127
+ context.arc(layout.x, y, HIGHLIGHT_DOT_RADIUS, 0, FULL_TURN);
128
+ context.fill();
129
+ }
130
+ }
131
+ }
132
+ /**
133
+ * Add one row's line to the path being built.
134
+ * @param context - A context already scaled and moved to the drawing area.
135
+ * @param row - The row to trace.
136
+ * @param layouts - The axes, from left to right.
137
+ * @param values - Each axis's column, in the same order.
138
+ */
139
+ export function traceParallelRow(context, row, layouts, values) {
140
+ let started = false;
141
+ for (let index = 0; index < layouts.length; index++) {
142
+ const layout = layouts[index];
143
+ const column = values[index];
144
+ if (layout === undefined || column === undefined)
145
+ continue;
146
+ const y = parallelPixelAt(layout.pixels, column[row]);
147
+ // A row whose value on this axis is not known yet has no point to draw:
148
+ // the line skips that axis rather than collapsing onto one of its ends.
149
+ if (!Number.isFinite(y))
150
+ continue;
151
+ if (started) {
152
+ context.lineTo(layout.x, y);
153
+ }
154
+ else {
155
+ context.moveTo(layout.x, y);
156
+ started = true;
157
+ }
158
+ }
159
+ }
160
+ //# sourceMappingURL=parallelPaint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelPaint.js","sourceRoot":"","sources":["../../../src/parallel/core/parallelPaint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAErE,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,wDAAwD;AACxD,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,6CAA6C;AAC7C,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,0DAA0D;AAC1D,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAyD9B;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E,SAAS;YAClC,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YAC7D,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAiC,EACjC,GAAW,EACX,OAAsC,EACtC,MAAwC;IAExC,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;YAAE,SAAS;QAC3D,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAW,CAAC,CAAC;QAChE,wEAAwE;QACxE,wEAAwE;QACxE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,SAAS;QAClC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC5B,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The colour each line is drawn in, as a step into a sampled ramp.
3
+ *
4
+ * A canvas reassigns `strokeStyle` once per line, and a thousand different
5
+ * colours is a thousand style writes. Quantising the ramp to 121 steps and
6
+ * keeping the rows in the order they came means the style is written about
7
+ * 121 times for the whole figure — while no reader can tell a hundred-and-
8
+ * twenty-first of a ramp apart from its neighbour.
9
+ */
10
+ import type { ColorScale } from '../../color/core/interpolate.ts';
11
+ import type { ParallelColorBy } from './parallelTypes.ts';
12
+ /** How many steps the ramp is quantised into; there is one more colour than steps. */
13
+ export declare const PARALLEL_PALETTE_STEPS = 120;
14
+ /**
15
+ * The ramp, sampled into the steps a line's colour is looked up by.
16
+ * @param scale - The ramp, as the registry hands it over or as a plain list of colours. Defaults to viridis.
17
+ * @returns `PARALLEL_PALETTE_STEPS + 1` colours, from the low end to the high end.
18
+ */
19
+ export declare function parallelPalette(scale?: ColorScale | readonly string[]): readonly string[];
20
+ /**
21
+ * Which step of the ramp each row takes.
22
+ *
23
+ * Worked out once per data change rather than per repaint, and held as bytes:
24
+ * a library of ten thousand rows costs ten kilobytes and the painter's inner
25
+ * loop reads an integer instead of placing a value on a ramp.
26
+ * @param color - The quantity the lines are coloured by.
27
+ * @param count - How many rows there are.
28
+ * @returns One step per row, from `0` to {@link PARALLEL_PALETTE_STEPS}.
29
+ */
30
+ export declare function parallelColorSteps(color: ParallelColorBy, count: number): Uint8Array;
31
+ //# sourceMappingURL=parallelPalette.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelPalette.d.ts","sourceRoot":"","sources":["../../../src/parallel/core/parallelPalette.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAOlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,MAAM,EAAE,GACrC,SAAS,MAAM,EAAE,CAEnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE,MAAM,GACZ,UAAU,CAkBZ"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The colour each line is drawn in, as a step into a sampled ramp.
3
+ *
4
+ * A canvas reassigns `strokeStyle` once per line, and a thousand different
5
+ * colours is a thousand style writes. Quantising the ramp to 121 steps and
6
+ * keeping the rows in the order they came means the style is written about
7
+ * 121 times for the whole figure — while no reader can tell a hundred-and-
8
+ * twenty-first of a ramp apart from its neighbour.
9
+ */
10
+ import { evenScale, sampleScale } from "../../color/core/interpolate.js";
11
+ import { positionInRange } from "../../color/core/scale.js";
12
+ import { resolveColorScale } from "../../color/core/scaleText.js";
13
+ import { DEFAULT_COLOR_SCALE_ID } from "../../color/core/scales.js";
14
+ import { parallelExtent } from "./parallelExtent.js";
15
+ /** How many steps the ramp is quantised into; there is one more colour than steps. */
16
+ export const PARALLEL_PALETTE_STEPS = 120;
17
+ /**
18
+ * The ramp, sampled into the steps a line's colour is looked up by.
19
+ * @param scale - The ramp, as the registry hands it over or as a plain list of colours. Defaults to viridis.
20
+ * @returns `PARALLEL_PALETTE_STEPS + 1` colours, from the low end to the high end.
21
+ */
22
+ export function parallelPalette(scale) {
23
+ return sampleScale(resolveRamp(scale), PARALLEL_PALETTE_STEPS + 1);
24
+ }
25
+ /**
26
+ * Which step of the ramp each row takes.
27
+ *
28
+ * Worked out once per data change rather than per repaint, and held as bytes:
29
+ * a library of ten thousand rows costs ten kilobytes and the painter's inner
30
+ * loop reads an integer instead of placing a value on a ramp.
31
+ * @param color - The quantity the lines are coloured by.
32
+ * @param count - How many rows there are.
33
+ * @returns One step per row, from `0` to {@link PARALLEL_PALETTE_STEPS}.
34
+ */
35
+ export function parallelColorSteps(color, count) {
36
+ const steps = new Uint8Array(count);
37
+ const extent = parallelExtent(color.values, count);
38
+ const min = color.min ?? extent.min;
39
+ const max = color.max ?? extent.max;
40
+ const logarithmic = color.logarithmic ?? false;
41
+ const span = max - min;
42
+ const rows = Math.min(count, color.values.length);
43
+ for (let row = 0; row < rows; row++) {
44
+ const value = color.values[row];
45
+ steps[row] = logarithmic
46
+ ? Math.round(positionInRange(value, min, max, { logarithmic: true }) *
47
+ PARALLEL_PALETTE_STEPS)
48
+ : colorStep(value, min, span);
49
+ }
50
+ return steps;
51
+ }
52
+ function resolveRamp(scale) {
53
+ if (scale === undefined) {
54
+ return resolveColorScale(DEFAULT_COLOR_SCALE_ID).scale;
55
+ }
56
+ return 'stops' in scale ? scale : evenScale(scale);
57
+ }
58
+ function colorStep(value, min, span) {
59
+ if (span <= 0)
60
+ return 0;
61
+ const ratio = (value - min) / span;
62
+ if (Number.isNaN(ratio) || ratio < 0)
63
+ return 0;
64
+ if (ratio > 1)
65
+ return PARALLEL_PALETTE_STEPS;
66
+ return Math.round(ratio * PARALLEL_PALETTE_STEPS);
67
+ }
68
+ //# sourceMappingURL=parallelPalette.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelPalette.js","sourceRoot":"","sources":["../../../src/parallel/core/parallelPalette.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,sFAAsF;AACtF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAsC;IAEtC,OAAO,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,sBAAsB,GAAG,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAk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rD,CAAC;AAED,SAAS,SAAS,CAAC,KAAa,EAAE,GAAW,EAAE,IAAY;IACzD,IAAI,IAAI,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACxB,MAAM,KAAK,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IAC/C,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,sBAAsB,CAAC;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,sBAAsB,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * How one axis is graduated.
3
+ *
4
+ * Five evenly spaced marks across the raw extent, not `chartAxisScale`'s nice
5
+ * ones: nicing moves the ends of the axis, and a figure whose whole job is to
6
+ * compare rows against each other must end exactly where the data does. A
7
+ * caller who wants round numbers asks for them with `nice`, per axis.
8
+ */
9
+ import type { ParallelAxis, ParallelTick } from './parallelTypes.ts';
10
+ /** How many graduations an axis carries when the caller asks for no number. */
11
+ export declare const PARALLEL_TICK_COUNT = 5;
12
+ /** An axis's ends and the graduations written along it. */
13
+ export interface ParallelGraduation {
14
+ /** The two ends of the axis, low first, after any nicing. */
15
+ domain: readonly [number, number];
16
+ /** The graduations, from the bottom of the axis to the top. */
17
+ ticks: readonly ParallelTick[];
18
+ }
19
+ /**
20
+ * The graduations of one axis, and the ends they are spread between.
21
+ *
22
+ * Three ways, in order: the caller's own list wins outright — a coded quantity
23
+ * reading `none`, `low`, `high` is nobody else's to invent; `nice` hands the
24
+ * axis to `chartAxisScale`, which rounds both ends outward to whole steps; and
25
+ * otherwise the extent is divided evenly and a mark whose label repeats the
26
+ * one below it is dropped, so an axis of whole numbers from 0 to 2 reads
27
+ * `0 1 2` rather than writing `1` twice.
28
+ * @param axis - The axis, for its formatting and how many marks it wants.
29
+ * @param min - The value at the bottom of the axis.
30
+ * @param max - The value at its top.
31
+ * @returns The ends and the graduations. See {@link ParallelGraduation}.
32
+ */
33
+ export declare function parallelTicks(axis: ParallelAxis, min: number, max: number): ParallelGraduation;
34
+ //# sourceMappingURL=parallelTicks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelTicks.d.ts","sourceRoot":"","sources":["../../../src/parallel/core/parallelTicks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAErE,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAQrC,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,+DAA+D;IAC/D,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CAChC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,kBAAkB,CAWpB"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * How one axis is graduated.
3
+ *
4
+ * Five evenly spaced marks across the raw extent, not `chartAxisScale`'s nice
5
+ * ones: nicing moves the ends of the axis, and a figure whose whole job is to
6
+ * compare rows against each other must end exactly where the data does. A
7
+ * caller who wants round numbers asks for them with `nice`, per axis.
8
+ */
9
+ import { chartAxisScale, chartTickDecimals, } from "../../chart/core/chartAxisScale.js";
10
+ import { formatDecimal } from "../../format/core/numbers.js";
11
+ import { roundTo } from "../../format/core/roundTo.js";
12
+ /** How many graduations an axis carries when the caller asks for no number. */
13
+ export const PARALLEL_TICK_COUNT = 5;
14
+ /** The most decimals a graduation is ever written with. */
15
+ const MOST_TICK_DECIMALS = 6;
16
+ /** How far a label may sit from its own value: a tenth of the spacing. */
17
+ const LABEL_TOLERANCE = 10;
18
+ /**
19
+ * The graduations of one axis, and the ends they are spread between.
20
+ *
21
+ * Three ways, in order: the caller's own list wins outright — a coded quantity
22
+ * reading `none`, `low`, `high` is nobody else's to invent; `nice` hands the
23
+ * axis to `chartAxisScale`, which rounds both ends outward to whole steps; and
24
+ * otherwise the extent is divided evenly and a mark whose label repeats the
25
+ * one below it is dropped, so an axis of whole numbers from 0 to 2 reads
26
+ * `0 1 2` rather than writing `1` twice.
27
+ * @param axis - The axis, for its formatting and how many marks it wants.
28
+ * @param min - The value at the bottom of the axis.
29
+ * @param max - The value at its top.
30
+ * @returns The ends and the graduations. See {@link ParallelGraduation}.
31
+ */
32
+ export function parallelTicks(axis, min, max) {
33
+ const domain = [min, max];
34
+ if (axis.ticks !== undefined)
35
+ return { domain, ticks: axis.ticks };
36
+ const wanted = Math.max(2, Math.trunc(axis.tickCount ?? PARALLEL_TICK_COUNT));
37
+ if (axis.nice === true && axis.scale !== 'log') {
38
+ return nicedGraduation(axis, min, max, wanted);
39
+ }
40
+ const values = evenValues(min, max, wanted, axis.scale === 'log');
41
+ return { domain, ticks: labelled(values, axis.format) };
42
+ }
43
+ function nicedGraduation(axis, min, max, wanted) {
44
+ const scale = chartAxisScale(min, max, { count: wanted, nice: true });
45
+ const ticks = [];
46
+ for (let index = 0; index < scale.values.length; index++) {
47
+ const value = scale.values[index];
48
+ const label = axis.format === undefined
49
+ ? (scale.labels[index] ?? formatDecimal(value, scale.decimals))
50
+ : axis.format(value);
51
+ if (ticks.at(-1)?.label === label)
52
+ continue;
53
+ ticks.push({ value, label });
54
+ }
55
+ return { domain: scale.domain, ticks };
56
+ }
57
+ function evenValues(min, max, wanted, logarithmic) {
58
+ const values = [];
59
+ const low = logarithmic ? Math.log10(Math.max(min, smallestStep(max))) : min;
60
+ const high = logarithmic ? Math.log10(Math.max(max, smallestStep(max))) : max;
61
+ const span = high - low;
62
+ for (let index = 0; index < wanted; index++) {
63
+ const placed = low + (span * index) / (wanted - 1);
64
+ values.push(logarithmic ? 10 ** placed : placed);
65
+ }
66
+ return values;
67
+ }
68
+ function labelled(values, format) {
69
+ const decimals = format === undefined ? tickDecimals(values) : 0;
70
+ const ticks = [];
71
+ for (const value of values) {
72
+ const label = format === undefined ? formatDecimal(value, decimals) : format(value);
73
+ if (ticks.at(-1)?.label === label)
74
+ continue;
75
+ ticks.push({ value, label });
76
+ }
77
+ return ticks;
78
+ }
79
+ /**
80
+ * As many decimals as the spacing needs, and one more whenever rounding would
81
+ * move a mark by more than a tenth of that spacing — which is what keeps an
82
+ * axis from 12.3 to 157 reading `12 48 85 121 157` while one from −1.5 to 2.5
83
+ * still reads `−1.5 −0.5 0.5 1.5 2.5` rather than rounding both away.
84
+ * @param values - The graduations, in the axis's own units.
85
+ * @returns How many decimals each of their labels carries.
86
+ */
87
+ function tickDecimals(values) {
88
+ const step = smallestGap(values);
89
+ const tolerance = step / LABEL_TOLERANCE;
90
+ let decimals = chartTickDecimals(step);
91
+ while (decimals < MOST_TICK_DECIMALS &&
92
+ !faithful(values, decimals, tolerance)) {
93
+ decimals++;
94
+ }
95
+ return decimals;
96
+ }
97
+ function faithful(values, decimals, tolerance) {
98
+ for (const value of values) {
99
+ if (Math.abs(value - roundTo(value, decimals)) > tolerance)
100
+ return false;
101
+ }
102
+ return true;
103
+ }
104
+ function smallestGap(values) {
105
+ let smallest = Number.POSITIVE_INFINITY;
106
+ for (let index = 1; index < values.length; index++) {
107
+ const gap = Math.abs(values[index] - values[index - 1]);
108
+ if (gap > 0 && gap < smallest)
109
+ smallest = gap;
110
+ }
111
+ return Number.isFinite(smallest) ? smallest : 1;
112
+ }
113
+ function smallestStep(max) {
114
+ return max > 0 ? max * 1e-12 : 1;
115
+ }
116
+ //# sourceMappingURL=parallelTicks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelTicks.js","sourceRoot":"","sources":["../../../src/parallel/core/parallelTicks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,cAAc,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