@mstone6969/graph 0.1.0 → 0.2.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 (238) hide show
  1. package/README.md +111 -14
  2. package/dist/ExcelWriter-3ZSYUH4T.cjs +154 -0
  3. package/dist/GraphType.js +24 -38
  4. package/dist/PdfWriter-6HJFYMCO.cjs +205 -0
  5. package/dist/catalog-YWX6FHRM.cjs +8 -0
  6. package/dist/catalog.js +5 -1
  7. package/dist/charts/bars/index.js +2 -12
  8. package/dist/charts/comparison/EffectForestPlot.js +1 -1
  9. package/dist/charts/comparison/index.js +1 -8
  10. package/dist/charts/demography/Nomogram.js +3 -3
  11. package/dist/charts/density/HexbinChart.js +6 -4
  12. package/dist/charts/diagrams/ArchitectureCanvas.js +68 -0
  13. package/dist/charts/diagrams/ArchitectureDiagram.js +331 -0
  14. package/dist/charts/diagrams/ArchitectureLayout.js +106 -0
  15. package/dist/charts/diagrams/ArchitectureLinkLabels.js +78 -0
  16. package/dist/charts/diagrams/ArchitectureModel.js +108 -0
  17. package/dist/charts/diagrams/ArchitectureRouter.js +348 -0
  18. package/dist/charts/diagrams/ArchitectureSamples.js +312 -0
  19. package/dist/charts/diagrams/ArchitectureShapes.js +130 -0
  20. package/dist/charts/diagrams/ArchitectureText.js +25 -0
  21. package/dist/charts/diagrams/DiagramText.js +38 -0
  22. package/dist/charts/diagrams/EntityRelationshipDiagram.js +465 -0
  23. package/dist/charts/diagrams/ErCrowsFoot.js +33 -0
  24. package/dist/charts/diagrams/ErSamples.js +205 -0
  25. package/dist/charts/diagrams/ErSchema.js +122 -0
  26. package/dist/charts/diagrams/LogicCircuit.js +154 -0
  27. package/dist/charts/diagrams/LogicCircuitLayout.js +600 -0
  28. package/dist/charts/diagrams/LogicCircuitSamples.js +66 -0
  29. package/dist/charts/diagrams/LogicGateDiagram.js +216 -0
  30. package/dist/charts/diagrams/LogicGateSymbol.js +113 -0
  31. package/dist/charts/diagrams/NetworkTopologyDiagram.js +247 -0
  32. package/dist/charts/diagrams/SequenceDiagram.js +351 -0
  33. package/dist/charts/diagrams/SequenceLayout.js +422 -0
  34. package/dist/charts/diagrams/SequenceModel.js +221 -0
  35. package/dist/charts/diagrams/TopologyLayout.js +143 -0
  36. package/dist/charts/diagrams/architectureEnums.js +50 -0
  37. package/dist/charts/diagrams/index.js +26 -0
  38. package/dist/charts/diagrams/logicEnums.js +42 -0
  39. package/dist/charts/diagrams/sequenceEnums.js +40 -0
  40. package/dist/charts/distribution/HistogramChart.js +25 -3
  41. package/dist/charts/distribution/index.js +1 -3
  42. package/dist/charts/earthscience/HovmollerDiagram.js +477 -0
  43. package/dist/charts/earthscience/HovmollerEnums.js +42 -0
  44. package/dist/charts/earthscience/HovmollerField.js +180 -0
  45. package/dist/charts/earthscience/HovmollerSample.js +40 -0
  46. package/dist/charts/earthscience/HovmollerSpeed.js +71 -0
  47. package/dist/charts/earthscience/index.js +10 -2
  48. package/dist/charts/engineering/ConstellationDiagram.js +26 -6
  49. package/dist/charts/engineering/EyeDiagram.js +2 -1
  50. package/dist/charts/engineering/PoleZeroPlot.js +32 -8
  51. package/dist/charts/financial/RelativeStrengthRotation.js +434 -0
  52. package/dist/charts/financial/RelativeStrengthRotationMath.js +71 -0
  53. package/dist/charts/financial/RelativeStrengthRotationSamples.js +27 -0
  54. package/dist/charts/financial/index.js +5 -3
  55. package/dist/charts/flow/index.js +1 -5
  56. package/dist/charts/frameworks/AnsoffMatrix.js +523 -0
  57. package/dist/charts/frameworks/FrameworkText.js +98 -0
  58. package/dist/charts/frameworks/NpsGauge.js +279 -0
  59. package/dist/charts/frameworks/NpsSurvey.js +58 -0
  60. package/dist/charts/frameworks/PerceptualMap.js +419 -0
  61. package/dist/charts/frameworks/PerceptualProjection.js +142 -0
  62. package/dist/charts/frameworks/PositioningSamples.js +191 -0
  63. package/dist/charts/frameworks/RaciMatrix.js +458 -0
  64. package/dist/charts/frameworks/RaciPlan.js +81 -0
  65. package/dist/charts/frameworks/RaciSamples.js +76 -0
  66. package/dist/charts/frameworks/SwotMatrix.js +358 -0
  67. package/dist/charts/frameworks/SwotSamples.js +85 -0
  68. package/dist/charts/frameworks/VanWestendorpChart.js +187 -0
  69. package/dist/charts/frameworks/VanWestendorpSurvey.js +197 -0
  70. package/dist/charts/frameworks/index.js +26 -0
  71. package/dist/charts/frameworks/raciEnums.js +30 -0
  72. package/dist/charts/frameworks/swotEnums.js +34 -0
  73. package/dist/charts/genomics/CircosPlot.js +1 -1
  74. package/dist/charts/geoflows/GeoFlowChart.js +2 -2
  75. package/dist/charts/geoflows/GeoFlowSample.js +2 -1
  76. package/dist/charts/geomaps/FloorPlanMap.js +324 -0
  77. package/dist/charts/geomaps/FloorPlanModel.js +179 -0
  78. package/dist/charts/geomaps/FloorPlanSamples.js +416 -0
  79. package/dist/charts/geomaps/GeoLand.js +2 -2
  80. package/dist/charts/geomaps/GeoSamples.js +2 -1
  81. package/dist/charts/geomaps/GraticuleMap.js +2 -2
  82. package/dist/charts/geomaps/RoomLabelFit.js +200 -0
  83. package/dist/charts/geomaps/TissotMap.js +2 -2
  84. package/dist/charts/geomaps/index.js +8 -4
  85. package/dist/charts/hierarchy/SunburstChart.js +17 -10
  86. package/dist/charts/hierarchy/index.js +2 -11
  87. package/dist/charts/indicators/BulletChart.js +8 -2
  88. package/dist/charts/indicators/SpeedometerChart.js +1 -1
  89. package/dist/charts/indicators/ThermometerChart.js +1 -1
  90. package/dist/charts/lifescience/LoessFit.js +113 -0
  91. package/dist/charts/lifescience/MaPlot.js +337 -0
  92. package/dist/charts/lifescience/MaPlotSamples.js +35 -0
  93. package/dist/charts/lifescience/OncoGlyph.js +137 -0
  94. package/dist/charts/lifescience/OncoPrint.js +373 -0
  95. package/dist/charts/lifescience/OncoPrintMatrix.js +107 -0
  96. package/dist/charts/lifescience/OncoPrintSamples.js +142 -0
  97. package/dist/charts/lifescience/PedigreeChart.js +306 -0
  98. package/dist/charts/lifescience/PedigreeLayout.js +261 -0
  99. package/dist/charts/lifescience/PedigreeRows.js +70 -0
  100. package/dist/charts/lifescience/PedigreeSamples.js +161 -0
  101. package/dist/charts/lifescience/PedigreeSymbol.js +47 -0
  102. package/dist/charts/lifescience/RamachandranPlot.js +364 -0
  103. package/dist/charts/lifescience/RamachandranRegions.js +2712 -0
  104. package/dist/charts/lifescience/RamachandranSamples.js +235 -0
  105. package/dist/charts/lifescience/index.js +25 -0
  106. package/dist/charts/lifescience/pedigreeEnums.js +21 -0
  107. package/dist/charts/lifescience/ramachandranEnums.js +34 -0
  108. package/dist/charts/linesareas/DualAxisChart.js +1 -1
  109. package/dist/charts/linesareas/LineEnums.js +1 -15
  110. package/dist/charts/linesareas/MultiLineChart.js +1 -1
  111. package/dist/charts/linesareas/TrendChart.js +15 -5
  112. package/dist/charts/linesareas/index.js +2 -6
  113. package/dist/charts/massive/MassiveChart.js +3 -2
  114. package/dist/charts/mathematical/FourierSeriesChart.js +7 -1
  115. package/dist/charts/mathematical/index.js +2 -6
  116. package/dist/charts/matrix/GridPlot.js +27 -2
  117. package/dist/charts/matrix/TilegramChart.js +2 -2
  118. package/dist/charts/mlcharts/AttentionGrid.js +79 -0
  119. package/dist/charts/mlcharts/AttentionHeatmap.js +329 -0
  120. package/dist/charts/mlcharts/AttentionModel.js +132 -0
  121. package/dist/charts/mlcharts/AttentionSamples.js +82 -0
  122. package/dist/charts/mlcharts/CellNumber.js +8 -0
  123. package/dist/charts/mlcharts/CurveDiagnosticSamples.js +95 -0
  124. package/dist/charts/mlcharts/CurvePickMark.js +31 -0
  125. package/dist/charts/mlcharts/DecisionBoundaryChart.js +316 -0
  126. package/dist/charts/mlcharts/DecisionSamples.js +60 -0
  127. package/dist/charts/mlcharts/DecisionSurface.js +130 -0
  128. package/dist/charts/mlcharts/DistinctTicks.js +13 -0
  129. package/dist/charts/mlcharts/ElbowMath.js +153 -0
  130. package/dist/charts/mlcharts/ElbowPlot.js +273 -0
  131. package/dist/charts/mlcharts/ExplainabilitySamples.js +70 -0
  132. package/dist/charts/mlcharts/FeatureImportanceChart.js +150 -0
  133. package/dist/charts/mlcharts/ImportanceRanking.js +98 -0
  134. package/dist/charts/mlcharts/LearningCurveChart.js +276 -0
  135. package/dist/charts/mlcharts/LearningCurveMath.js +92 -0
  136. package/dist/charts/mlcharts/PartialDependence.js +92 -0
  137. package/dist/charts/mlcharts/PartialDependencePlot.js +225 -0
  138. package/dist/charts/mlcharts/WideLabel.js +28 -0
  139. package/dist/charts/mlcharts/curveDiagnosticEnums.js +37 -0
  140. package/dist/charts/mlcharts/index.js +32 -0
  141. package/dist/charts/proportion/index.js +5 -9
  142. package/dist/charts/scatter/CategoryScatterBase.js +1 -4
  143. package/dist/charts/scatter/ConnectedScatter.js +7 -4
  144. package/dist/charts/scatter/MarginalScatter.js +13 -8
  145. package/dist/charts/scatter/index.js +4 -17
  146. package/dist/charts/scientific/SpectrogramChart.js +9 -3
  147. package/dist/charts/scientific/index.js +2 -2
  148. package/dist/charts/signals/index.js +3 -13
  149. package/dist/charts/statistics/LorenzCurve.js +7 -4
  150. package/dist/charts/threebars/Candlestick3DChart.js +18 -2
  151. package/dist/charts/threeglobe/GlobeChart.js +2 -2
  152. package/dist/charts/threeglobe/GlobeSamples.js +2 -1
  153. package/dist/charts/threeglobe/RingGlobe.js +1 -1
  154. package/dist/charts/threenetwork/ConeTreeChart.js +2 -1
  155. package/dist/charts/threenetwork/Gantt3DChart.js +3 -2
  156. package/dist/charts/threesurfaces/Ridgeline3DChart.js +22 -4
  157. package/dist/charts/threevolume/LorenzAttractor.js +19 -0
  158. package/dist/charts/threevolume/VolumeRaycastChart.js +4 -3
  159. package/dist/charts/threevolume/volumeEnums.js +1 -0
  160. package/dist/charts/timeline/index.js +2 -10
  161. package/dist/chunk-753UBLV2.cjs +33 -0
  162. package/dist/chunk-VX54A7KA.cjs +17 -0
  163. package/dist/{chunk-W5GAAAZY.cjs → chunk-WAODDPYX.cjs} +24874 -17620
  164. package/dist/chunk-Z3JPIJSC.cjs +338 -0
  165. package/dist/core/CartesianChart.js +87 -11
  166. package/dist/core/Chart.js +63 -15
  167. package/dist/core/Chart2D.js +54 -17
  168. package/dist/core/Chart3D.js +56 -20
  169. package/dist/core/ChartExportError.js +2 -0
  170. package/dist/core/ChartExporter.js +50 -8
  171. package/dist/core/ColumnCheck.js +53 -0
  172. package/dist/core/Context2D.js +29 -15
  173. package/dist/core/Context3D.js +7 -2
  174. package/dist/core/ExcelWriter.js +152 -0
  175. package/dist/core/ExportText.js +28 -0
  176. package/dist/core/MarkOrigin.js +88 -0
  177. package/dist/core/MarkStyle.js +294 -0
  178. package/dist/core/Palette.js +27 -7
  179. package/dist/core/PdfPage.js +13 -0
  180. package/dist/core/PdfWriter.js +245 -0
  181. package/dist/core/Scales.js +52 -2
  182. package/dist/core/SceneOverlay.js +4 -4
  183. package/dist/core/TextFit.js +37 -0
  184. package/dist/core/Theme.js +28 -1
  185. package/dist/core/enums.js +33 -1
  186. package/dist/core/pathMorph.js +15 -0
  187. package/dist/data/SampleData.js +1 -17
  188. package/dist/data/WorldSample.js +23 -0
  189. package/dist/index.cjs +810 -691
  190. package/dist/index.d.cts +8390 -2925
  191. package/dist/index.d.ts +8392 -2927
  192. package/dist/index.js +106 -56
  193. package/dist/react/ChartView.js +18 -8
  194. package/dist/react/GraphHandle.js +2 -0
  195. package/dist/react/components.js +74 -116
  196. package/package.json +13 -3
  197. package/dist/catalog-4UP2YFNR.cjs +0 -7
  198. package/dist/charts/bars/BulletBar.js +0 -184
  199. package/dist/charts/bars/ErrorBarColumn.js +0 -147
  200. package/dist/charts/bars/HistogramBar.js +0 -217
  201. package/dist/charts/bars/MarimekkoBar.js +0 -191
  202. package/dist/charts/bars/ParetoBar.js +0 -143
  203. package/dist/charts/comparison/PanelChart.js +0 -70
  204. package/dist/charts/comparison/SmallMultipleBars.js +0 -134
  205. package/dist/charts/comparison/SpanChart.js +0 -118
  206. package/dist/charts/comparison/TrellisChart.js +0 -158
  207. package/dist/charts/distribution/RidgeSlabs3DChart.js +0 -169
  208. package/dist/charts/financial/Candlestick3D.js +0 -157
  209. package/dist/charts/flow/BumpFlow.js +0 -212
  210. package/dist/charts/flow/StreamFlow.js +0 -174
  211. package/dist/charts/geomaps/ThiessenMap.js +0 -106
  212. package/dist/charts/hierarchy/ConeTree3D.js +0 -135
  213. package/dist/charts/hierarchy/Hierarchy3DChart.js +0 -27
  214. package/dist/charts/hierarchy/SpherePack3D.js +0 -81
  215. package/dist/charts/hierarchy/SunburstTower3D.js +0 -93
  216. package/dist/charts/hierarchy/TreemapSkyline3D.js +0 -98
  217. package/dist/charts/linesareas/ConnectedScatterTime.js +0 -206
  218. package/dist/charts/linesareas/SmallMultipleLines.js +0 -153
  219. package/dist/charts/mathematical/ParametricSurface3D.js +0 -234
  220. package/dist/charts/mathematical/StrangeAttractor3D.js +0 -251
  221. package/dist/charts/proportion/ConeFunnel.js +0 -126
  222. package/dist/charts/proportion/ExtrudedPieChart.js +0 -123
  223. package/dist/charts/scatter/BeeswarmScatter.js +0 -151
  224. package/dist/charts/scatter/BinnedScatterBase.js +0 -51
  225. package/dist/charts/scatter/ContourScatter.js +0 -116
  226. package/dist/charts/scatter/GridBinScatter.js +0 -98
  227. package/dist/charts/scatter/HexbinScatter.js +0 -74
  228. package/dist/charts/scatter/StripScatter.js +0 -107
  229. package/dist/charts/scatter/SunflowerScatter.js +0 -109
  230. package/dist/charts/signals/ConstellationChart.js +0 -153
  231. package/dist/charts/signals/CorrelogramChart.js +0 -171
  232. package/dist/charts/signals/EyeDiagramChart.js +0 -155
  233. package/dist/charts/signals/PoleZeroChart.js +0 -164
  234. package/dist/charts/signals/SpectrogramChart.js +0 -79
  235. package/dist/charts/timeline/CalendarSkylineChart.js +0 -128
  236. package/dist/charts/timeline/ScheduleBlocksChart.js +0 -119
  237. package/dist/charts/timeline/SpiralTimeline.js +0 -154
  238. package/dist/charts/timeline/StreamTimeline.js +0 -141
@@ -1,116 +0,0 @@
1
- import { ChartFamily, DataShape, Dimension } from "../../core/enums.js";
2
- import { SampleData } from "../../data/SampleData.js";
3
- import { ScatterBase } from "./ScatterBase.js";
4
- import { contourDensity, descending, geoPath, group, max, quantile, range } from "d3";
5
- // src/charts/scatter/ContourScatter.ts
6
- var ScatterContourLevels = /* @__PURE__ */ function(ScatterContourLevels) {
7
- ScatterContourLevels["Equal"] = "equal-steps";
8
- ScatterContourLevels["Highest"] = "highest-density";
9
- return ScatterContourLevels;
10
- }({});
11
- var ScatterContourPoints = /* @__PURE__ */ function(ScatterContourPoints) {
12
- ScatterContourPoints["All"] = "all-points";
13
- ScatterContourPoints["Outliers"] = "outliers-only";
14
- ScatterContourPoints["None"] = "contours-only";
15
- return ScatterContourPoints;
16
- }({});
17
- var ScatterContourScope = /* @__PURE__ */ function(ScatterContourScope) {
18
- ScatterContourScope["Overall"] = "overall";
19
- ScatterContourScope["PerGroup"] = "per-group";
20
- return ScatterContourScope;
21
- }({});
22
- var HIGHEST = [
23
- .95,
24
- .8,
25
- .5
26
- ];
27
- var OUTLIER_SHARE = .06;
28
- /** Scatter underlaid with kernel density contours, or highest-density regions containing fixed shares. */
29
- var ContourScatter = class extends ScatterBase {
30
- static meta = {
31
- id: "contour-scatter",
32
- name: "Contour scatter",
33
- family: ChartFamily.Relationship,
34
- dimension: Dimension.Two,
35
- shape: DataShape.Table,
36
- description: "Draws density contours over a dense scatter so the shape of the cloud is readable.",
37
- tags: [
38
- "kernel density",
39
- "isodensity",
40
- "highest density region",
41
- "kde2d"
42
- ],
43
- sample: (seed) => SampleData.points(seed, 320, 3),
44
- variants: {
45
- bandwidth: [
46
- 16,
47
- 10,
48
- 26
49
- ],
50
- levels: ["equal-steps", "highest-density"],
51
- steps: [6, 10],
52
- showPoints: [
53
- "outliers-only",
54
- "all-points",
55
- "contours-only"
56
- ],
57
- scope: ["overall", "per-group"]
58
- },
59
- valid: (v) => v.levels === "equal-steps" || v.steps === 6
60
- };
61
- defaults() {
62
- return {
63
- ...super.defaults(),
64
- bandwidth: 16,
65
- levels: "equal-steps",
66
- steps: 6,
67
- showPoints: "outliers-only",
68
- scope: "overall",
69
- radius: 3
70
- };
71
- }
72
- density(point, set) {
73
- const sigma = this.options.bandwidth;
74
- return set.reduce((sum, other) => sum + Math.exp(-((point.px - other.px) ** 2 + (point.py - other.py) ** 2) / (2 * sigma ** 2)), 0) / (2 * Math.PI * sigma ** 2);
75
- }
76
- plotPoints(ctx, _axes, points) {
77
- const { bandwidth, levels, steps, showPoints, scope } = this.options, { width, height } = ctx.plot;
78
- const perGroup = scope === "per-group";
79
- const sets = perGroup ? [...group(points, (point) => point.group)] : points.length ? [["All", points]] : [];
80
- const estimator = contourDensity().x((d) => d.px).y((d) => d.py).size([width, height]).bandwidth(bandwidth);
81
- const layers = sets.flatMap(([key, set]) => {
82
- const field = estimator.contours(set);
83
- const own = set.map((point) => this.density(point, set)).sort((a, b) => a - b), top = own[own.length - 1] ?? 1;
84
- const levelsAt = levels === "highest-density" ? HIGHEST.map((share) => quantile(own, 1 - share) ?? 0) : range(1, steps + 1).map((i) => top * i / (steps + 1));
85
- return levelsAt.map((value, i) => ({
86
- id: `${key}/${i}`,
87
- key,
88
- value,
89
- share: (i + 1) / levelsAt.length,
90
- level: levels === "highest-density" ? HIGHEST[i] : null,
91
- shape: field(value * field.max / top)
92
- }));
93
- });
94
- const peak = max(layers, (layer) => layer.share) ?? 1;
95
- const tone = (d) => perGroup ? ctx.palette.color(d.key) : ctx.palette.sequential(.15 + d.share / peak * .75);
96
- const shapes = ctx.marks("contours", "path", [...layers].sort((a, b) => descending(b.share, a.share)), (d) => d.id).attr("fill", tone).attr("fill-opacity", perGroup ? .1 : .55).attr("stroke", perGroup ? tone : ctx.theme.surface).attr("stroke-width", perGroup ? 1.5 : 1).attr("stroke-linejoin", "round");
97
- ctx.set(shapes, { d: (d) => geoPath()(d.shape) });
98
- ctx.hover(shapes, (d) => ({
99
- title: d.key,
100
- color: tone(d),
101
- rows: d.level ? [["Contains", `${Math.round(d.level * 100)}%`]] : [["Density", +d.value.toFixed(5)]]
102
- }));
103
- const sparsest = sets.flatMap(([, set]) => {
104
- return set.map((point) => ({
105
- point,
106
- density: this.density(point, set)
107
- })).sort((a, b) => a.density - b.density).slice(0, Math.ceil(set.length * OUTLIER_SHARE)).map((item) => item.point);
108
- });
109
- const visible = showPoints === "contours-only" ? [] : showPoints === "all-points" ? points : sparsest;
110
- this.drawDots(ctx, visible);
111
- }
112
- legendItems() {
113
- return this.options.scope === "per-group" || this.options.showPoints !== "contours-only" ? super.legendItems() : [];
114
- }
115
- };
116
- export { ContourScatter, ScatterContourLevels, ScatterContourPoints, ScatterContourScope };
@@ -1,98 +0,0 @@
1
- import { ChartFamily, DataShape, Dimension } from "../../core/enums.js";
2
- import { SampleData } from "../../data/SampleData.js";
3
- import { BinEncoding, BinnedScatterBase } from "./BinnedScatterBase.js";
4
- import { extent, max, thresholdFreedmanDiaconis, thresholdScott, thresholdSturges } from "d3";
5
- // src/charts/scatter/GridBinScatter.ts
6
- var ScatterBinRule = /* @__PURE__ */ function(ScatterBinRule) {
7
- ScatterBinRule["Sturges"] = "sturges";
8
- ScatterBinRule["Scott"] = "scott";
9
- ScatterBinRule["FreedmanDiaconis"] = "freedman-diaconis";
10
- return ScatterBinRule;
11
- }({});
12
- var ScatterGridCell = /* @__PURE__ */ function(ScatterGridCell) {
13
- ScatterGridCell["Square"] = "square-cells";
14
- ScatterGridCell["Circle"] = "circle-cells";
15
- return ScatterGridCell;
16
- }({});
17
- var RULES = {
18
- ["sturges"]: thresholdSturges,
19
- ["scott"]: thresholdScott,
20
- ["freedman-diaconis"]: thresholdFreedmanDiaconis
21
- };
22
- /** A two-dimensional histogram over x/y, with statistical bin-width rules. */
23
- var GridBinScatter = class extends BinnedScatterBase {
24
- static meta = {
25
- id: "gridbin-scatter",
26
- name: "Grid-binned scatter",
27
- family: ChartFamily.Relationship,
28
- dimension: Dimension.Two,
29
- shape: DataShape.Table,
30
- description: "Counts x/y points in a rectangular grid chosen by a statistical bin-width rule.",
31
- tags: [
32
- "2d histogram",
33
- "heatmap",
34
- "binned scatter"
35
- ],
36
- sample: (seed) => SampleData.points(seed, 700, 3),
37
- variants: {
38
- rule: [
39
- "scott",
40
- "sturges",
41
- "freedman-diaconis"
42
- ],
43
- encoding: [BinEncoding.Color, BinEncoding.Both],
44
- cell: ["square-cells", "circle-cells"],
45
- raw: [false, true]
46
- }
47
- };
48
- defaults() {
49
- return {
50
- ...super.defaults(),
51
- rule: "scott",
52
- cell: "square-cells"
53
- };
54
- }
55
- plotPoints(ctx, _axes, points) {
56
- const { rule, cell } = this.options, { width, height } = ctx.plot;
57
- const divisions = (values, top) => {
58
- const [low = 0, high = top] = extent(values);
59
- return Math.max(2, Math.min(40, RULES[rule](values, low, high) || 2));
60
- };
61
- const columns = divisions(points.map((p) => p.px), width), rows = divisions(points.map((p) => p.py), height);
62
- const cw = width / columns, ch = height / rows;
63
- const cells = /* @__PURE__ */ new Map();
64
- for (const point of points) {
65
- const col = Math.min(columns - 1, Math.floor(point.px / cw)), row = Math.min(rows - 1, Math.floor(point.py / ch)), key = `${col}/${row}`;
66
- if (!cells.has(key)) cells.set(key, {
67
- col,
68
- row,
69
- points: []
70
- });
71
- cells.get(key).points.push(point);
72
- }
73
- const list = [...cells.values()], peak = max(list, (d) => d.points.length) ?? 1;
74
- const span = (d) => this.extent(this.share(d.points.length, peak));
75
- const color = (d) => this.shade(ctx, this.share(d.points.length, peak));
76
- const key = (d) => `${d.col}/${d.row}`;
77
- this.drawRaw(ctx, points);
78
- const squares = ctx.marks("squares", "rect", cell === "square-cells" ? list : [], key).attr("fill", color).attr("rx", 2);
79
- ctx.set(squares, {
80
- x: (d) => (d.col + .5 - span(d) / 2) * cw + 1,
81
- y: (d) => (d.row + .5 - span(d) / 2) * ch + 1,
82
- width: (d) => Math.max(1, cw * span(d) - 2),
83
- height: (d) => Math.max(1, ch * span(d) - 2)
84
- });
85
- const circles = ctx.marks("circles", "circle", cell === "circle-cells" ? list : [], key).attr("fill", color);
86
- ctx.set(circles, {
87
- cx: (d) => (d.col + .5) * cw,
88
- cy: (d) => (d.row + .5) * ch,
89
- r: (d) => Math.max(1, (Math.min(cw, ch) / 2 - 1) * span(d))
90
- });
91
- for (const marks of [squares, circles]) ctx.hover(marks, (d) => ({
92
- title: `${d.points.length} points`,
93
- color: color(d)
94
- }));
95
- this.drawCountKey(ctx, points, peak, (t) => this.shade(ctx, t));
96
- }
97
- };
98
- export { GridBinScatter, ScatterBinRule, ScatterGridCell };
@@ -1,74 +0,0 @@
1
- import { ChartFamily, DataShape, Dimension } from "../../core/enums.js";
2
- import { SampleData } from "../../data/SampleData.js";
3
- import { BinCount, BinEncoding, BinnedScatterBase } from "./BinnedScatterBase.js";
4
- import { max } from "d3";
5
- import { hexbin } from "d3-hexbin";
6
- // src/charts/scatter/HexbinScatter.ts
7
- /** Hexagonal binning for overplotted scatters: thousands of points become a count surface. */
8
- var HexbinScatter = class extends BinnedScatterBase {
9
- static meta = {
10
- id: "hexbin-scatter",
11
- name: "Hexbin scatter",
12
- family: ChartFamily.Relationship,
13
- dimension: Dimension.Two,
14
- shape: DataShape.Table,
15
- description: "Bins dense x/y points into hexagons and shows the count in each.",
16
- tags: [
17
- "hexagonal binning",
18
- "density",
19
- "overplotting",
20
- "big data"
21
- ],
22
- sample: (seed) => SampleData.points(seed, 900, 3),
23
- variants: {
24
- encoding: [BinEncoding.Color, BinEncoding.Both],
25
- count: [
26
- BinCount.Linear,
27
- BinCount.Sqrt,
28
- BinCount.Log
29
- ],
30
- binRadius: [
31
- 11,
32
- 7,
33
- 16
34
- ],
35
- lattice: [false, true],
36
- raw: [false, true]
37
- },
38
- valid: (v) => v.encoding !== BinEncoding.Color || v.count === BinCount.Linear
39
- };
40
- defaults() {
41
- return {
42
- ...super.defaults(),
43
- binRadius: 11,
44
- lattice: false
45
- };
46
- }
47
- inset() {
48
- return this.options.binRadius;
49
- }
50
- plotPoints(ctx, _axes, points) {
51
- const { width, height } = ctx.plot, { binRadius, lattice } = this.options;
52
- const layout = hexbin().x((d) => d.px).y((d) => d.py).radius(binRadius).extent([[binRadius, binRadius], [width - binRadius, height - binRadius]]);
53
- const bins = layout(points).map((bin) => bin);
54
- const peak = max(bins, (bin) => bin.length) ?? 1;
55
- const mesh = ctx.marks("lattice", "path", lattice ? [layout.mesh()] : []).attr("fill", "none").attr("stroke", ctx.theme.grid).attr("stroke-width", 1);
56
- ctx.set(mesh, { d: (d) => d });
57
- this.drawRaw(ctx, points);
58
- const inner = Math.max(1, binRadius - 1);
59
- const hexes = ctx.marks("hexes", "path", bins, (bin) => `${bin.x},${bin.y}`).attr("fill", (bin) => this.shade(ctx, this.share(bin.length, peak))).attr("stroke", ctx.theme.surface).attr("stroke-width", 1);
60
- ctx.set(hexes, {
61
- d: (bin) => layout.hexagon(inner * this.extent(this.share(bin.length, peak))),
62
- transform: (bin) => `translate(${bin.x},${bin.y})`
63
- }, {
64
- transform: (bin) => `translate(${bin.x},${bin.y})`,
65
- d: layout.hexagon(.01)
66
- }, 1);
67
- ctx.hover(hexes, (bin) => ({
68
- title: `${bin.length} points`,
69
- color: this.shade(ctx, this.share(bin.length, peak))
70
- }));
71
- this.drawCountKey(ctx, points, peak, (t) => this.shade(ctx, t));
72
- }
73
- };
74
- export { HexbinScatter };
@@ -1,107 +0,0 @@
1
- import { ChartFamily, DataShape, Dimension, Orientation, ScaleKind } from "../../core/enums.js";
2
- import { SampleData } from "../../data/SampleData.js";
3
- import { CategoryScatterBase, CategorySort, CategorySummary } from "./CategoryScatterBase.js";
4
- // src/charts/scatter/StripScatter.ts
5
- var StripScatterMark = /* @__PURE__ */ function(StripScatterMark) {
6
- StripScatterMark["Tick"] = "tick";
7
- StripScatterMark["Dot"] = "dot";
8
- StripScatterMark["Diamond"] = "diamond";
9
- return StripScatterMark;
10
- }({});
11
- /** Every observation on one line per category: the tidiest view for modest samples. */
12
- var StripScatter = class extends CategoryScatterBase {
13
- static meta = {
14
- id: "strip-scatter",
15
- name: "Strip plot",
16
- family: ChartFamily.Distribution,
17
- dimension: Dimension.Two,
18
- shape: DataShape.Table,
19
- description: "Lines up every observation along one axis per category, showing spread without binning.",
20
- tags: [
21
- "barcode",
22
- "tick plot",
23
- "one-dimensional"
24
- ],
25
- sample: (seed) => SampleData.distribution(seed, 50, 4),
26
- variants: {
27
- orientation: [Orientation.Horizontal, Orientation.Vertical],
28
- mark: [
29
- "tick",
30
- "dot",
31
- "diamond"
32
- ],
33
- scale: [ScaleKind.Linear, ScaleKind.Log],
34
- sort: [CategorySort.Data, CategorySort.Descending],
35
- summary: [
36
- CategorySummary.None,
37
- CategorySummary.Median,
38
- CategorySummary.Box
39
- ],
40
- thickness: [.5, .8]
41
- },
42
- valid: (v) => v.mark === "tick" || v.thickness === .5
43
- };
44
- defaults() {
45
- return {
46
- ...super.defaults(),
47
- orientation: Orientation.Horizontal,
48
- mark: "tick",
49
- thickness: .5
50
- };
51
- }
52
- plotLanes(ctx, axes, lanes) {
53
- const { mark, thickness } = this.options, vertical = this.vertical;
54
- const placed = lanes.flatMap((lane) => lane.points.map((point) => ({
55
- ...point,
56
- center: lane.center,
57
- half: lane.breadth / 2 * thickness
58
- })));
59
- const color = (d) => ctx.palette.color(d.group);
60
- const along = (d) => axes.value(d.value);
61
- const ticks = ctx.marks("ticks", "line", mark === "tick" ? placed : [], (d) => d.index).attr("stroke", color).attr("stroke-width", 2).attr("stroke-linecap", "round").attr("stroke-opacity", .7);
62
- ctx.set(ticks, vertical ? {
63
- x1: (d) => d.center - d.half,
64
- x2: (d) => d.center + d.half,
65
- y1: along,
66
- y2: along
67
- } : {
68
- y1: (d) => d.center - d.half,
69
- y2: (d) => d.center + d.half,
70
- x1: along,
71
- x2: along
72
- }, vertical ? {
73
- x1: (d) => d.center,
74
- x2: (d) => d.center,
75
- y1: along,
76
- y2: along
77
- } : {
78
- y1: (d) => d.center,
79
- y2: (d) => d.center,
80
- x1: along,
81
- x2: along
82
- }, 1);
83
- ctx.hover(ticks, (d) => this.tooltip(ctx, d));
84
- const glyphs = ctx.marks("glyphs", "rect", mark === "diamond" ? placed : [], (d) => d.index).attr("fill", color).attr("fill-opacity", .8);
85
- const spot = (d) => vertical ? [d.center, along(d)] : [along(d), d.center];
86
- ctx.set(glyphs, {
87
- x: -4,
88
- y: -4,
89
- width: 8,
90
- height: 8,
91
- transform: (d) => `translate(${spot(d)[0]},${spot(d)[1]}) rotate(45)`
92
- });
93
- ctx.hover(glyphs, (d) => this.tooltip(ctx, d));
94
- const dots = ctx.marks("dots", "circle", mark === "dot" ? placed : [], (d) => d.index).attr("fill", color).attr("fill-opacity", .65);
95
- ctx.set(dots, {
96
- cx: (d) => spot(d)[0],
97
- cy: (d) => spot(d)[1],
98
- r: this.options.radius
99
- }, {
100
- cx: (d) => spot(d)[0],
101
- cy: (d) => spot(d)[1],
102
- r: 0
103
- });
104
- ctx.hover(dots, (d) => this.tooltip(ctx, d));
105
- }
106
- };
107
- export { StripScatter, StripScatterMark };
@@ -1,109 +0,0 @@
1
- import { ChartFamily, DataShape, Dimension } from "../../core/enums.js";
2
- import { SampleData } from "../../data/SampleData.js";
3
- import { ScatterBase } from "./ScatterBase.js";
4
- import { hexbin } from "d3-hexbin";
5
- // src/charts/scatter/SunflowerScatter.ts
6
- var SunflowerScatterPetal = /* @__PURE__ */ function(SunflowerScatterPetal) {
7
- SunflowerScatterPetal["Line"] = "line-petals";
8
- SunflowerScatterPetal["Leaf"] = "leaf-petals";
9
- return SunflowerScatterPetal;
10
- }({});
11
- var SunflowerLattice = /* @__PURE__ */ function(SunflowerLattice) {
12
- SunflowerLattice["Hex"] = "hex-lattice";
13
- SunflowerLattice["Square"] = "square-lattice";
14
- return SunflowerLattice;
15
- }({});
16
- var MAX_PETALS = 16;
17
- /** Counts overplotted points by petals on a glyph, staying readable as discrete units. */
18
- var SunflowerScatter = class extends ScatterBase {
19
- static meta = {
20
- id: "sunflower-scatter",
21
- name: "Sunflower scatter",
22
- family: ChartFamily.Relationship,
23
- dimension: Dimension.Two,
24
- shape: DataShape.Table,
25
- description: "Replaces clumps of overlapping points with glyphs whose petals count the observations.",
26
- tags: [
27
- "sunflower plot",
28
- "overplotting",
29
- "count glyph"
30
- ],
31
- sample: (seed) => SampleData.points(seed, 380, 3),
32
- variants: {
33
- cell: [
34
- 13,
35
- 9,
36
- 18
37
- ],
38
- unit: [1, 3],
39
- petal: ["line-petals", "leaf-petals"],
40
- lattice: ["hex-lattice", "square-lattice"]
41
- }
42
- };
43
- defaults() {
44
- return {
45
- ...super.defaults(),
46
- cell: 13,
47
- unit: 1,
48
- petal: "line-petals",
49
- lattice: "hex-lattice"
50
- };
51
- }
52
- inset() {
53
- return this.options.cell;
54
- }
55
- legendItems() {
56
- return [];
57
- }
58
- flowers(points) {
59
- const { cell, unit, lattice } = this.options;
60
- const pack = (x, y, count) => ({
61
- id: `${x},${y}`,
62
- x,
63
- y,
64
- count,
65
- petals: Math.min(MAX_PETALS, Math.round(count / unit))
66
- });
67
- if (lattice === "hex-lattice") return hexbin().x((d) => d.px).y((d) => d.py).radius(cell)(points).map((bin) => pack(bin.x, bin.y, bin.length));
68
- const size = cell * 1.8, cells = /* @__PURE__ */ new Map();
69
- for (const point of points) {
70
- const key = `${Math.floor(point.px / size)}/${Math.floor(point.py / size)}`;
71
- cells.set(key, [...cells.get(key) ?? [], point]);
72
- }
73
- return [...cells].map(([key, set]) => {
74
- const [c, r] = key.split("/").map(Number);
75
- return pack((c + .5) * size, (r + .5) * size, set.length);
76
- });
77
- }
78
- glyph(petals) {
79
- if (petals < 2) return "";
80
- const reach = this.options.cell * .82, core = 2.5;
81
- return Array.from({ length: petals }, (_, i) => {
82
- const t = i / petals * Math.PI * 2 - Math.PI / 2, c = Math.cos(t), s = Math.sin(t);
83
- if (this.options.petal === "line-petals") return `M${core * c},${core * s}L${reach * c},${reach * s}`;
84
- const mx = (reach + core) / 2 * c, my = (reach + core) / 2 * s, w = 2.2;
85
- return `M${core * c},${core * s}Q${mx - s * w},${my + c * w} ${reach * c},${reach * s}Q${mx + s * w},${my - c * w} ${core * c},${core * s}Z`;
86
- }).join("");
87
- }
88
- plotPoints(ctx, _axes, points) {
89
- const flowers = this.flowers(points), ink = ctx.palette.sequential(.68);
90
- const leaf = this.options.petal === "leaf-petals";
91
- const glyphs = ctx.marks("flowers", "path", flowers, (d) => d.id).attr("fill", leaf ? ink : "none").attr("stroke", ink).attr("stroke-width", leaf ? .5 : 1.5).attr("stroke-linecap", "round");
92
- ctx.set(glyphs, {
93
- d: (d) => this.glyph(d.petals),
94
- transform: (d) => `translate(${d.x},${d.y})`
95
- });
96
- ctx.hover(glyphs, (d) => ({
97
- title: `${d.count} points`,
98
- color: ink,
99
- rows: [["Petals", d.petals]]
100
- }));
101
- const hearts = ctx.marks("hearts", "circle", flowers, (d) => d.id).attr("fill", ink);
102
- ctx.set(hearts, {
103
- cx: (d) => d.x,
104
- cy: (d) => d.y,
105
- r: 2.5
106
- });
107
- }
108
- };
109
- export { SunflowerLattice, SunflowerScatter, SunflowerScatterPetal };
@@ -1,153 +0,0 @@
1
- import { ChartFamily, DataShape, Dimension } from "../../core/enums.js";
2
- import { SampleData } from "../../data/SampleData.js";
3
- import { SignalChart } from "./SignalChart.js";
4
- import { SignalRaster } from "./SignalRaster.js";
5
- import { SignalScales } from "./SignalScales.js";
6
- import { max, scaleLinear } from "d3";
7
- // src/charts/signals/ConstellationChart.ts
8
- var ConstellationDisplay = /* @__PURE__ */ function(ConstellationDisplay) {
9
- ConstellationDisplay["Points"] = "points";
10
- ConstellationDisplay["Density"] = "density";
11
- ConstellationDisplay["Path"] = "symbol-path";
12
- return ConstellationDisplay;
13
- }({});
14
- var CELL = 4;
15
- var LEVELS = 4;
16
- /** I/Q scatter of a digital modulation, for reading noise, compression and phase error at a glance. */
17
- var ConstellationChart = class extends SignalChart {
18
- static meta = {
19
- id: "signal-constellation",
20
- name: "Constellation diagram",
21
- family: ChartFamily.Scientific,
22
- dimension: Dimension.Two,
23
- shape: DataShape.Table,
24
- description: "Plots received I/Q symbols around their ideal points to diagnose noise and distortion in digital modulation.",
25
- tags: [
26
- "iq",
27
- "qam",
28
- "qpsk",
29
- "evm",
30
- "modulation"
31
- ],
32
- sample: (seed) => {
33
- const noise = SampleData.points(seed, 256, 1), mean = noise.reduce((sum, row) => sum + +row.x, 0) / noise.length;
34
- const rail = (value) => [
35
- -3,
36
- -1,
37
- 1,
38
- 3
39
- ][Math.abs(Math.floor(value * 7)) % 4];
40
- return noise.map((row, i) => {
41
- const [a, b] = [(+row.x - mean) / 8, (+row.y - +row.x * .8 - 10) / 9];
42
- return {
43
- i: +((rail(+row.size * (i + 3)) + a * .14) / 3.3).toFixed(4),
44
- q: +((rail(+row.y * (i + 5)) + b * .14) / 3.3).toFixed(4)
45
- };
46
- });
47
- },
48
- variants: {
49
- display: Object.values(ConstellationDisplay),
50
- decision: [true, false],
51
- errors: [false, true],
52
- ring: [false, true]
53
- },
54
- valid: (values) => values.errors === false || values.display === "points"
55
- };
56
- defaults() {
57
- return {
58
- ...super.defaults(),
59
- x: "i",
60
- y: "q",
61
- xLabel: "In-phase",
62
- yLabel: "Quadrature",
63
- grid: false,
64
- display: "points",
65
- levels: LEVELS,
66
- decision: true,
67
- errors: false,
68
- ring: false
69
- };
70
- }
71
- get legended() {
72
- return false;
73
- }
74
- get symbols() {
75
- const { data, x, y, levels } = this.options, rows = (data ?? []).filter((row) => Number.isFinite(+row[x]) && Number.isFinite(+row[y]) && row[x] !== null && row[y] !== null);
76
- const reach = Math.max(1e-9, ...rows.map((row) => Math.max(Math.abs(+row[x]), Math.abs(+row[y]))));
77
- const count = levels, unit = reach * .96 / (count - 1);
78
- const snap = (value) => (Math.max(0, Math.min(count - 1, Math.round((value / unit + count - 1) / 2))) * 2 - (count - 1)) * unit;
79
- return rows.map((row, key) => ({
80
- key,
81
- i: +row[x],
82
- q: +row[y],
83
- idealI: snap(+row[x]),
84
- idealQ: snap(+row[y]),
85
- rail: unit
86
- }));
87
- }
88
- scales(ctx) {
89
- const { width, height } = ctx.plot, symbols = this.symbols;
90
- const outer = symbols[0] ? (this.options.levels - 1) * symbols[0].rail : 1, ring = this.options.ring ? Math.SQRT2 * outer * 1.03 : 0;
91
- const reach = Math.max(ring, Math.max(1, ...symbols.map((symbol) => Math.max(Math.abs(symbol.i), Math.abs(symbol.q)))) * 1.1), ratio = width / height;
92
- return {
93
- x: scaleLinear([-reach * ratio, reach * ratio], [0, width]),
94
- y: scaleLinear([-reach, reach], [height, 0])
95
- };
96
- }
97
- plotMarks(ctx, { x, y }) {
98
- const { display, decision, errors, ring, levels } = this.options, { width, height } = ctx.plot, symbols = this.symbols, unit = symbols[0]?.rail ?? .3;
99
- const color = ctx.palette.color("Symbols");
100
- const rails = Array.from({ length: levels - 1 }, (_, i) => (i * 2 - (levels - 2)) * unit);
101
- if (decision) {
102
- ctx.marks("decision-x", "line", rails, (rail) => rail).attr("x1", (rail) => x(rail)).attr("x2", (rail) => x(rail)).attr("y1", 0).attr("y2", height).attr("stroke", ctx.theme.grid).attr("stroke-width", 1);
103
- ctx.marks("decision-y", "line", rails, (rail) => rail).attr("x1", 0).attr("x2", width).attr("y1", (rail) => y(rail)).attr("y2", (rail) => y(rail)).attr("stroke", ctx.theme.grid).attr("stroke-width", 1);
104
- }
105
- ctx.marks("axes", "path", [0]).attr("fill", "none").attr("stroke", ctx.theme.axis).attr("d", `M${x(0)} 0V${height}M0 ${y(0)}H${width}`);
106
- if (ring) {
107
- const reach = Math.hypot(1, 1) * (levels - 1) * unit, step = Math.abs(x(1) - x(0));
108
- ctx.marks("ring", "circle", [reach], (_, i) => i).attr("cx", x(0)).attr("cy", y(0)).attr("r", reach * step).attr("fill", "none").attr("stroke", ctx.theme.axis).attr("stroke-dasharray", "4 3");
109
- }
110
- if (display === "density") this.density(ctx, symbols, x, y);
111
- if (display === "symbol-path") this.stroke(ctx, "path", [symbols.slice(0, 64)], () => 0, (list) => this.path(list.map((symbol) => [symbol.i, symbol.q]), x, y), () => color, 1).attr("stroke-opacity", .55);
112
- if (errors) ctx.marks("errors", "line", symbols, (symbol) => symbol.key).attr("stroke", ctx.theme.inkSecondary).attr("stroke-width", 1).attr("x1", (symbol) => x(symbol.idealI)).attr("y1", (symbol) => y(symbol.idealQ)).attr("x2", (symbol) => x(symbol.i)).attr("y2", (symbol) => y(symbol.q));
113
- if (display !== "density") {
114
- const list = display === "symbol-path" ? symbols.slice(0, 64) : symbols;
115
- const dots = ctx.marks("symbols", "circle", list, (symbol) => symbol.key).attr("fill", color).attr("stroke", ctx.theme.surface).attr("stroke-width", 1);
116
- ctx.set(dots, {
117
- cx: (symbol) => x(symbol.i),
118
- cy: (symbol) => y(symbol.q),
119
- r: 4
120
- }, { r: 0 }, 2);
121
- ctx.hover(dots, (symbol) => ({
122
- title: `Symbol ${symbol.key + 1}`,
123
- color,
124
- rows: [
125
- ["I", SignalScales.number(symbol.i)],
126
- ["Q", SignalScales.number(symbol.q)],
127
- ["Error", SignalScales.number(Math.hypot(symbol.i - symbol.idealI, symbol.q - symbol.idealQ))]
128
- ]
129
- }));
130
- }
131
- const rms = Math.sqrt(symbols.reduce((sum, symbol) => sum + (symbol.i - symbol.idealI) ** 2 + (symbol.q - symbol.idealQ) ** 2, 0) / (symbols.reduce((sum, symbol) => sum + symbol.idealI ** 2 + symbol.idealQ ** 2, 0) || 1));
132
- if (symbols.length) ctx.text(ctx.marks("evm", "text", [0]).attr("x", width - 4).attr("y", 12).attr("text-anchor", "end").text(`EVM ${(rms * 100).toFixed(1)}%`), 11, "ink");
133
- }
134
- density(ctx, symbols, x, y) {
135
- const { width, height } = ctx.plot, columns = Math.ceil(width / CELL), rows = Math.ceil(height / CELL), counts = new Array(columns * rows).fill(0), blur = 2;
136
- for (const symbol of symbols) {
137
- const c = Math.floor(x(symbol.i) / CELL), r = Math.floor(y(symbol.q) / CELL);
138
- for (let dr = -2; dr <= blur; dr++) for (let dc = -2; dc <= blur; dc++) if (c + dc >= 0 && c + dc < columns && r + dr >= 0 && r + dr < rows) counts[(r + dr) * columns + c + dc] += Math.exp(-(dr * dr + dc * dc) / 3);
139
- }
140
- const top = max(counts) || 1, cells = [];
141
- counts.forEach((count, i) => {
142
- if (count / top > .04) cells.push({
143
- x: i % columns * CELL,
144
- y: Math.floor(i / columns) * CELL,
145
- width: CELL,
146
- height: CELL,
147
- level: Math.sqrt(count / top)
148
- });
149
- });
150
- SignalRaster.paint(ctx, "density", cells, ctx.palette.sequential);
151
- }
152
- };
153
- export { ConstellationChart, ConstellationDisplay };