@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.
- package/README.md +111 -14
- package/dist/ExcelWriter-3ZSYUH4T.cjs +154 -0
- package/dist/GraphType.js +24 -38
- package/dist/PdfWriter-6HJFYMCO.cjs +205 -0
- package/dist/catalog-YWX6FHRM.cjs +8 -0
- package/dist/catalog.js +5 -1
- package/dist/charts/bars/index.js +2 -12
- package/dist/charts/comparison/EffectForestPlot.js +1 -1
- package/dist/charts/comparison/index.js +1 -8
- package/dist/charts/demography/Nomogram.js +3 -3
- package/dist/charts/density/HexbinChart.js +6 -4
- package/dist/charts/diagrams/ArchitectureCanvas.js +68 -0
- package/dist/charts/diagrams/ArchitectureDiagram.js +331 -0
- package/dist/charts/diagrams/ArchitectureLayout.js +106 -0
- package/dist/charts/diagrams/ArchitectureLinkLabels.js +78 -0
- package/dist/charts/diagrams/ArchitectureModel.js +108 -0
- package/dist/charts/diagrams/ArchitectureRouter.js +348 -0
- package/dist/charts/diagrams/ArchitectureSamples.js +312 -0
- package/dist/charts/diagrams/ArchitectureShapes.js +130 -0
- package/dist/charts/diagrams/ArchitectureText.js +25 -0
- package/dist/charts/diagrams/DiagramText.js +38 -0
- package/dist/charts/diagrams/EntityRelationshipDiagram.js +465 -0
- package/dist/charts/diagrams/ErCrowsFoot.js +33 -0
- package/dist/charts/diagrams/ErSamples.js +205 -0
- package/dist/charts/diagrams/ErSchema.js +122 -0
- package/dist/charts/diagrams/LogicCircuit.js +154 -0
- package/dist/charts/diagrams/LogicCircuitLayout.js +600 -0
- package/dist/charts/diagrams/LogicCircuitSamples.js +66 -0
- package/dist/charts/diagrams/LogicGateDiagram.js +216 -0
- package/dist/charts/diagrams/LogicGateSymbol.js +113 -0
- package/dist/charts/diagrams/NetworkTopologyDiagram.js +247 -0
- package/dist/charts/diagrams/SequenceDiagram.js +351 -0
- package/dist/charts/diagrams/SequenceLayout.js +422 -0
- package/dist/charts/diagrams/SequenceModel.js +221 -0
- package/dist/charts/diagrams/TopologyLayout.js +143 -0
- package/dist/charts/diagrams/architectureEnums.js +50 -0
- package/dist/charts/diagrams/index.js +26 -0
- package/dist/charts/diagrams/logicEnums.js +42 -0
- package/dist/charts/diagrams/sequenceEnums.js +40 -0
- package/dist/charts/distribution/HistogramChart.js +25 -3
- package/dist/charts/distribution/index.js +1 -3
- package/dist/charts/earthscience/HovmollerDiagram.js +477 -0
- package/dist/charts/earthscience/HovmollerEnums.js +42 -0
- package/dist/charts/earthscience/HovmollerField.js +180 -0
- package/dist/charts/earthscience/HovmollerSample.js +40 -0
- package/dist/charts/earthscience/HovmollerSpeed.js +71 -0
- package/dist/charts/earthscience/index.js +10 -2
- package/dist/charts/engineering/ConstellationDiagram.js +26 -6
- package/dist/charts/engineering/EyeDiagram.js +2 -1
- package/dist/charts/engineering/PoleZeroPlot.js +32 -8
- package/dist/charts/financial/RelativeStrengthRotation.js +434 -0
- package/dist/charts/financial/RelativeStrengthRotationMath.js +71 -0
- package/dist/charts/financial/RelativeStrengthRotationSamples.js +27 -0
- package/dist/charts/financial/index.js +5 -3
- package/dist/charts/flow/index.js +1 -5
- package/dist/charts/frameworks/AnsoffMatrix.js +523 -0
- package/dist/charts/frameworks/FrameworkText.js +98 -0
- package/dist/charts/frameworks/NpsGauge.js +279 -0
- package/dist/charts/frameworks/NpsSurvey.js +58 -0
- package/dist/charts/frameworks/PerceptualMap.js +419 -0
- package/dist/charts/frameworks/PerceptualProjection.js +142 -0
- package/dist/charts/frameworks/PositioningSamples.js +191 -0
- package/dist/charts/frameworks/RaciMatrix.js +458 -0
- package/dist/charts/frameworks/RaciPlan.js +81 -0
- package/dist/charts/frameworks/RaciSamples.js +76 -0
- package/dist/charts/frameworks/SwotMatrix.js +358 -0
- package/dist/charts/frameworks/SwotSamples.js +85 -0
- package/dist/charts/frameworks/VanWestendorpChart.js +187 -0
- package/dist/charts/frameworks/VanWestendorpSurvey.js +197 -0
- package/dist/charts/frameworks/index.js +26 -0
- package/dist/charts/frameworks/raciEnums.js +30 -0
- package/dist/charts/frameworks/swotEnums.js +34 -0
- package/dist/charts/genomics/CircosPlot.js +1 -1
- package/dist/charts/geoflows/GeoFlowChart.js +2 -2
- package/dist/charts/geoflows/GeoFlowSample.js +2 -1
- package/dist/charts/geomaps/FloorPlanMap.js +324 -0
- package/dist/charts/geomaps/FloorPlanModel.js +179 -0
- package/dist/charts/geomaps/FloorPlanSamples.js +416 -0
- package/dist/charts/geomaps/GeoLand.js +2 -2
- package/dist/charts/geomaps/GeoSamples.js +2 -1
- package/dist/charts/geomaps/GraticuleMap.js +2 -2
- package/dist/charts/geomaps/RoomLabelFit.js +200 -0
- package/dist/charts/geomaps/TissotMap.js +2 -2
- package/dist/charts/geomaps/index.js +8 -4
- package/dist/charts/hierarchy/SunburstChart.js +17 -10
- package/dist/charts/hierarchy/index.js +2 -11
- package/dist/charts/indicators/BulletChart.js +8 -2
- package/dist/charts/indicators/SpeedometerChart.js +1 -1
- package/dist/charts/indicators/ThermometerChart.js +1 -1
- package/dist/charts/lifescience/LoessFit.js +113 -0
- package/dist/charts/lifescience/MaPlot.js +337 -0
- package/dist/charts/lifescience/MaPlotSamples.js +35 -0
- package/dist/charts/lifescience/OncoGlyph.js +137 -0
- package/dist/charts/lifescience/OncoPrint.js +373 -0
- package/dist/charts/lifescience/OncoPrintMatrix.js +107 -0
- package/dist/charts/lifescience/OncoPrintSamples.js +142 -0
- package/dist/charts/lifescience/PedigreeChart.js +306 -0
- package/dist/charts/lifescience/PedigreeLayout.js +261 -0
- package/dist/charts/lifescience/PedigreeRows.js +70 -0
- package/dist/charts/lifescience/PedigreeSamples.js +161 -0
- package/dist/charts/lifescience/PedigreeSymbol.js +47 -0
- package/dist/charts/lifescience/RamachandranPlot.js +364 -0
- package/dist/charts/lifescience/RamachandranRegions.js +2712 -0
- package/dist/charts/lifescience/RamachandranSamples.js +235 -0
- package/dist/charts/lifescience/index.js +25 -0
- package/dist/charts/lifescience/pedigreeEnums.js +21 -0
- package/dist/charts/lifescience/ramachandranEnums.js +34 -0
- package/dist/charts/linesareas/DualAxisChart.js +1 -1
- package/dist/charts/linesareas/LineEnums.js +1 -15
- package/dist/charts/linesareas/MultiLineChart.js +1 -1
- package/dist/charts/linesareas/TrendChart.js +15 -5
- package/dist/charts/linesareas/index.js +2 -6
- package/dist/charts/massive/MassiveChart.js +3 -2
- package/dist/charts/mathematical/FourierSeriesChart.js +7 -1
- package/dist/charts/mathematical/index.js +2 -6
- package/dist/charts/matrix/GridPlot.js +27 -2
- package/dist/charts/matrix/TilegramChart.js +2 -2
- package/dist/charts/mlcharts/AttentionGrid.js +79 -0
- package/dist/charts/mlcharts/AttentionHeatmap.js +329 -0
- package/dist/charts/mlcharts/AttentionModel.js +132 -0
- package/dist/charts/mlcharts/AttentionSamples.js +82 -0
- package/dist/charts/mlcharts/CellNumber.js +8 -0
- package/dist/charts/mlcharts/CurveDiagnosticSamples.js +95 -0
- package/dist/charts/mlcharts/CurvePickMark.js +31 -0
- package/dist/charts/mlcharts/DecisionBoundaryChart.js +316 -0
- package/dist/charts/mlcharts/DecisionSamples.js +60 -0
- package/dist/charts/mlcharts/DecisionSurface.js +130 -0
- package/dist/charts/mlcharts/DistinctTicks.js +13 -0
- package/dist/charts/mlcharts/ElbowMath.js +153 -0
- package/dist/charts/mlcharts/ElbowPlot.js +273 -0
- package/dist/charts/mlcharts/ExplainabilitySamples.js +70 -0
- package/dist/charts/mlcharts/FeatureImportanceChart.js +150 -0
- package/dist/charts/mlcharts/ImportanceRanking.js +98 -0
- package/dist/charts/mlcharts/LearningCurveChart.js +276 -0
- package/dist/charts/mlcharts/LearningCurveMath.js +92 -0
- package/dist/charts/mlcharts/PartialDependence.js +92 -0
- package/dist/charts/mlcharts/PartialDependencePlot.js +225 -0
- package/dist/charts/mlcharts/WideLabel.js +28 -0
- package/dist/charts/mlcharts/curveDiagnosticEnums.js +37 -0
- package/dist/charts/mlcharts/index.js +32 -0
- package/dist/charts/proportion/index.js +5 -9
- package/dist/charts/scatter/CategoryScatterBase.js +1 -4
- package/dist/charts/scatter/ConnectedScatter.js +7 -4
- package/dist/charts/scatter/MarginalScatter.js +13 -8
- package/dist/charts/scatter/index.js +4 -17
- package/dist/charts/scientific/SpectrogramChart.js +9 -3
- package/dist/charts/scientific/index.js +2 -2
- package/dist/charts/signals/index.js +3 -13
- package/dist/charts/statistics/LorenzCurve.js +7 -4
- package/dist/charts/threebars/Candlestick3DChart.js +18 -2
- package/dist/charts/threeglobe/GlobeChart.js +2 -2
- package/dist/charts/threeglobe/GlobeSamples.js +2 -1
- package/dist/charts/threeglobe/RingGlobe.js +1 -1
- package/dist/charts/threenetwork/ConeTreeChart.js +2 -1
- package/dist/charts/threenetwork/Gantt3DChart.js +3 -2
- package/dist/charts/threesurfaces/Ridgeline3DChart.js +22 -4
- package/dist/charts/threevolume/LorenzAttractor.js +19 -0
- package/dist/charts/threevolume/VolumeRaycastChart.js +4 -3
- package/dist/charts/threevolume/volumeEnums.js +1 -0
- package/dist/charts/timeline/index.js +2 -10
- package/dist/chunk-753UBLV2.cjs +33 -0
- package/dist/chunk-VX54A7KA.cjs +17 -0
- package/dist/{chunk-W5GAAAZY.cjs → chunk-WAODDPYX.cjs} +24874 -17620
- package/dist/chunk-Z3JPIJSC.cjs +338 -0
- package/dist/core/CartesianChart.js +87 -11
- package/dist/core/Chart.js +63 -15
- package/dist/core/Chart2D.js +54 -17
- package/dist/core/Chart3D.js +56 -20
- package/dist/core/ChartExportError.js +2 -0
- package/dist/core/ChartExporter.js +50 -8
- package/dist/core/ColumnCheck.js +53 -0
- package/dist/core/Context2D.js +29 -15
- package/dist/core/Context3D.js +7 -2
- package/dist/core/ExcelWriter.js +152 -0
- package/dist/core/ExportText.js +28 -0
- package/dist/core/MarkOrigin.js +88 -0
- package/dist/core/MarkStyle.js +294 -0
- package/dist/core/Palette.js +27 -7
- package/dist/core/PdfPage.js +13 -0
- package/dist/core/PdfWriter.js +245 -0
- package/dist/core/Scales.js +52 -2
- package/dist/core/SceneOverlay.js +4 -4
- package/dist/core/TextFit.js +37 -0
- package/dist/core/Theme.js +28 -1
- package/dist/core/enums.js +33 -1
- package/dist/core/pathMorph.js +15 -0
- package/dist/data/SampleData.js +1 -17
- package/dist/data/WorldSample.js +23 -0
- package/dist/index.cjs +810 -691
- package/dist/index.d.cts +8390 -2925
- package/dist/index.d.ts +8392 -2927
- package/dist/index.js +106 -56
- package/dist/react/ChartView.js +18 -8
- package/dist/react/GraphHandle.js +2 -0
- package/dist/react/components.js +74 -116
- package/package.json +13 -3
- package/dist/catalog-4UP2YFNR.cjs +0 -7
- package/dist/charts/bars/BulletBar.js +0 -184
- package/dist/charts/bars/ErrorBarColumn.js +0 -147
- package/dist/charts/bars/HistogramBar.js +0 -217
- package/dist/charts/bars/MarimekkoBar.js +0 -191
- package/dist/charts/bars/ParetoBar.js +0 -143
- package/dist/charts/comparison/PanelChart.js +0 -70
- package/dist/charts/comparison/SmallMultipleBars.js +0 -134
- package/dist/charts/comparison/SpanChart.js +0 -118
- package/dist/charts/comparison/TrellisChart.js +0 -158
- package/dist/charts/distribution/RidgeSlabs3DChart.js +0 -169
- package/dist/charts/financial/Candlestick3D.js +0 -157
- package/dist/charts/flow/BumpFlow.js +0 -212
- package/dist/charts/flow/StreamFlow.js +0 -174
- package/dist/charts/geomaps/ThiessenMap.js +0 -106
- package/dist/charts/hierarchy/ConeTree3D.js +0 -135
- package/dist/charts/hierarchy/Hierarchy3DChart.js +0 -27
- package/dist/charts/hierarchy/SpherePack3D.js +0 -81
- package/dist/charts/hierarchy/SunburstTower3D.js +0 -93
- package/dist/charts/hierarchy/TreemapSkyline3D.js +0 -98
- package/dist/charts/linesareas/ConnectedScatterTime.js +0 -206
- package/dist/charts/linesareas/SmallMultipleLines.js +0 -153
- package/dist/charts/mathematical/ParametricSurface3D.js +0 -234
- package/dist/charts/mathematical/StrangeAttractor3D.js +0 -251
- package/dist/charts/proportion/ConeFunnel.js +0 -126
- package/dist/charts/proportion/ExtrudedPieChart.js +0 -123
- package/dist/charts/scatter/BeeswarmScatter.js +0 -151
- package/dist/charts/scatter/BinnedScatterBase.js +0 -51
- package/dist/charts/scatter/ContourScatter.js +0 -116
- package/dist/charts/scatter/GridBinScatter.js +0 -98
- package/dist/charts/scatter/HexbinScatter.js +0 -74
- package/dist/charts/scatter/StripScatter.js +0 -107
- package/dist/charts/scatter/SunflowerScatter.js +0 -109
- package/dist/charts/signals/ConstellationChart.js +0 -153
- package/dist/charts/signals/CorrelogramChart.js +0 -171
- package/dist/charts/signals/EyeDiagramChart.js +0 -155
- package/dist/charts/signals/PoleZeroChart.js +0 -164
- package/dist/charts/signals/SpectrogramChart.js +0 -79
- package/dist/charts/timeline/CalendarSkylineChart.js +0 -128
- package/dist/charts/timeline/ScheduleBlocksChart.js +0 -119
- package/dist/charts/timeline/SpiralTimeline.js +0 -154
- package/dist/charts/timeline/StreamTimeline.js +0 -141
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { randomLcg, randomNormal, randomUniform } from "d3";
|
|
2
|
+
// src/charts/lifescience/RamachandranSamples.ts
|
|
3
|
+
var GENERAL_RESIDUES = [
|
|
4
|
+
"ALA",
|
|
5
|
+
"LEU",
|
|
6
|
+
"GLU",
|
|
7
|
+
"LYS",
|
|
8
|
+
"SER",
|
|
9
|
+
"ASP",
|
|
10
|
+
"THR",
|
|
11
|
+
"ARG",
|
|
12
|
+
"ASN",
|
|
13
|
+
"PHE"
|
|
14
|
+
];
|
|
15
|
+
/** Alpha helix, beta strand, polyproline II and left-handed helix, the populations any protein shows. */
|
|
16
|
+
var GENERAL = [
|
|
17
|
+
[
|
|
18
|
+
-63,
|
|
19
|
+
-43,
|
|
20
|
+
6,
|
|
21
|
+
.5
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
-118,
|
|
25
|
+
132,
|
|
26
|
+
13,
|
|
27
|
+
.25
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
-68,
|
|
31
|
+
146,
|
|
32
|
+
9,
|
|
33
|
+
.18
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
58,
|
|
37
|
+
42,
|
|
38
|
+
7,
|
|
39
|
+
.07
|
|
40
|
+
]
|
|
41
|
+
];
|
|
42
|
+
var GLYCINE = [
|
|
43
|
+
[
|
|
44
|
+
82,
|
|
45
|
+
8,
|
|
46
|
+
9,
|
|
47
|
+
.35
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
-82,
|
|
51
|
+
-6,
|
|
52
|
+
9,
|
|
53
|
+
.2
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
-170,
|
|
57
|
+
175,
|
|
58
|
+
9,
|
|
59
|
+
.25
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
90,
|
|
63
|
+
-172,
|
|
64
|
+
9,
|
|
65
|
+
.2
|
|
66
|
+
]
|
|
67
|
+
];
|
|
68
|
+
var TRANS_PROLINE = [[
|
|
69
|
+
-63,
|
|
70
|
+
-33,
|
|
71
|
+
6,
|
|
72
|
+
.55
|
|
73
|
+
], [
|
|
74
|
+
-66,
|
|
75
|
+
146,
|
|
76
|
+
7,
|
|
77
|
+
.45
|
|
78
|
+
]];
|
|
79
|
+
var CIS_PROLINE = [[
|
|
80
|
+
-75,
|
|
81
|
+
158,
|
|
82
|
+
6,
|
|
83
|
+
.6
|
|
84
|
+
], [
|
|
85
|
+
-85,
|
|
86
|
+
0,
|
|
87
|
+
7,
|
|
88
|
+
.4
|
|
89
|
+
]];
|
|
90
|
+
var PRE_PROLINE = [
|
|
91
|
+
[
|
|
92
|
+
-65,
|
|
93
|
+
145,
|
|
94
|
+
9,
|
|
95
|
+
.55
|
|
96
|
+
],
|
|
97
|
+
[
|
|
98
|
+
-120,
|
|
99
|
+
140,
|
|
100
|
+
10,
|
|
101
|
+
.3
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
-62,
|
|
105
|
+
-38,
|
|
106
|
+
6,
|
|
107
|
+
.15
|
|
108
|
+
]
|
|
109
|
+
];
|
|
110
|
+
var ILE_VAL = [[
|
|
111
|
+
-115,
|
|
112
|
+
128,
|
|
113
|
+
11,
|
|
114
|
+
.6
|
|
115
|
+
], [
|
|
116
|
+
-64,
|
|
117
|
+
-43,
|
|
118
|
+
5,
|
|
119
|
+
.4
|
|
120
|
+
]];
|
|
121
|
+
/** Each lands outside the map for its class, so outliers exist to draw on every panel. */
|
|
122
|
+
var PLANTED = [
|
|
123
|
+
[
|
|
124
|
+
"ALA",
|
|
125
|
+
"SER",
|
|
126
|
+
2,
|
|
127
|
+
-120,
|
|
128
|
+
179
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
"GLY",
|
|
132
|
+
"SER",
|
|
133
|
+
-30,
|
|
134
|
+
-140,
|
|
135
|
+
180
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
"PRO",
|
|
139
|
+
"SER",
|
|
140
|
+
62,
|
|
141
|
+
30,
|
|
142
|
+
178
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
"PRO",
|
|
146
|
+
"SER",
|
|
147
|
+
60,
|
|
148
|
+
-120,
|
|
149
|
+
2
|
|
150
|
+
],
|
|
151
|
+
[
|
|
152
|
+
"LEU",
|
|
153
|
+
"PRO",
|
|
154
|
+
75,
|
|
155
|
+
-85,
|
|
156
|
+
180
|
|
157
|
+
],
|
|
158
|
+
[
|
|
159
|
+
"VAL",
|
|
160
|
+
"SER",
|
|
161
|
+
60,
|
|
162
|
+
100,
|
|
163
|
+
180
|
|
164
|
+
]
|
|
165
|
+
];
|
|
166
|
+
/** Synthetic backbone torsions drawn around textbook conformations. They are not measured from any structure. */
|
|
167
|
+
var RamachandranSamples = class {
|
|
168
|
+
static protein(seed, count = 220) {
|
|
169
|
+
const source = randomLcg(seed * .6180339887 % 1);
|
|
170
|
+
const pick = randomUniform.source(source)(0, 1), normal = randomNormal.source(source)(0, 1);
|
|
171
|
+
const within = (clusters) => {
|
|
172
|
+
let draw = pick();
|
|
173
|
+
const cluster = clusters.find((item) => (draw -= item[3]) <= 0) ?? clusters[0];
|
|
174
|
+
return [cluster[0] + normal() * cluster[2], cluster[1] + normal() * cluster[2]];
|
|
175
|
+
};
|
|
176
|
+
const residue = (i) => {
|
|
177
|
+
const roll = pick();
|
|
178
|
+
if (roll < .09) return {
|
|
179
|
+
name: "GLY",
|
|
180
|
+
next: "SER",
|
|
181
|
+
spot: within(GLYCINE),
|
|
182
|
+
omega: 180
|
|
183
|
+
};
|
|
184
|
+
if (roll < .14) return {
|
|
185
|
+
name: "PRO",
|
|
186
|
+
next: "SER",
|
|
187
|
+
spot: within(TRANS_PROLINE),
|
|
188
|
+
omega: 179
|
|
189
|
+
};
|
|
190
|
+
if (roll < .17) return {
|
|
191
|
+
name: "PRO",
|
|
192
|
+
next: "SER",
|
|
193
|
+
spot: within(CIS_PROLINE),
|
|
194
|
+
omega: 3
|
|
195
|
+
};
|
|
196
|
+
if (roll < .23) return {
|
|
197
|
+
name: "ALA",
|
|
198
|
+
next: "PRO",
|
|
199
|
+
spot: within(PRE_PROLINE),
|
|
200
|
+
omega: 180
|
|
201
|
+
};
|
|
202
|
+
if (roll < .33) return {
|
|
203
|
+
name: roll < .28 ? "ILE" : "VAL",
|
|
204
|
+
next: "SER",
|
|
205
|
+
spot: within(ILE_VAL),
|
|
206
|
+
omega: 180
|
|
207
|
+
};
|
|
208
|
+
return {
|
|
209
|
+
name: GENERAL_RESIDUES[i % GENERAL_RESIDUES.length],
|
|
210
|
+
next: "SER",
|
|
211
|
+
spot: within(GENERAL),
|
|
212
|
+
omega: 180
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
return [...Array.from({ length: count }, (_, i) => {
|
|
216
|
+
const { name, next, spot, omega } = residue(i);
|
|
217
|
+
return {
|
|
218
|
+
label: `${name} ${i + 1}`,
|
|
219
|
+
residue: name,
|
|
220
|
+
nextResidue: next,
|
|
221
|
+
phi: +spot[0].toFixed(1),
|
|
222
|
+
psi: +spot[1].toFixed(1),
|
|
223
|
+
omega
|
|
224
|
+
};
|
|
225
|
+
}), ...PLANTED.map(([name, next, phi, psi, omega], i) => ({
|
|
226
|
+
label: `${name} ${count + i + 1}`,
|
|
227
|
+
residue: name,
|
|
228
|
+
nextResidue: next,
|
|
229
|
+
phi,
|
|
230
|
+
psi,
|
|
231
|
+
omega
|
|
232
|
+
}))];
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
export { RamachandranSamples };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LoessFit } from "./LoessFit.js";
|
|
2
|
+
import { MaPlotSamples } from "./MaPlotSamples.js";
|
|
3
|
+
import { MaMarks, MaNormalization, MaPlot, MaSource } from "./MaPlot.js";
|
|
4
|
+
import { OncoAlteration, OncoGlyph, OncoLayer } from "./OncoGlyph.js";
|
|
5
|
+
import { OncoPrintMatrix, OncoSort } from "./OncoPrintMatrix.js";
|
|
6
|
+
import { OncoPrintSamples } from "./OncoPrintSamples.js";
|
|
7
|
+
import { OncoBars, OncoPrint, OncoTracks, OncoUnaltered } from "./OncoPrint.js";
|
|
8
|
+
import { PedigreeCaption, PedigreeCarrierMark, PedigreeSex } from "./pedigreeEnums.js";
|
|
9
|
+
import { PedigreeLayout } from "./PedigreeLayout.js";
|
|
10
|
+
import { PedigreeRows } from "./PedigreeRows.js";
|
|
11
|
+
import { PedigreeSamples } from "./PedigreeSamples.js";
|
|
12
|
+
import { PedigreeSymbol } from "./PedigreeSymbol.js";
|
|
13
|
+
import { PedigreeChart } from "./PedigreeChart.js";
|
|
14
|
+
import { RamachandranClass, RamachandranPanel, RamachandranRegionStyle, RamachandranVerdict } from "./ramachandranEnums.js";
|
|
15
|
+
import { RamachandranRegions } from "./RamachandranRegions.js";
|
|
16
|
+
import { RamachandranSamples } from "./RamachandranSamples.js";
|
|
17
|
+
import { RamachandranPlot } from "./RamachandranPlot.js";
|
|
18
|
+
// src/charts/lifescience/index.ts
|
|
19
|
+
var lifescienceCatalog = [
|
|
20
|
+
MaPlot,
|
|
21
|
+
OncoPrint,
|
|
22
|
+
PedigreeChart,
|
|
23
|
+
RamachandranPlot
|
|
24
|
+
];
|
|
25
|
+
export { LoessFit, MaMarks, MaNormalization, MaPlot, MaPlotSamples, MaSource, OncoAlteration, OncoBars, OncoGlyph, OncoLayer, OncoPrint, OncoPrintMatrix, OncoPrintSamples, OncoSort, OncoTracks, OncoUnaltered, PedigreeCaption, PedigreeCarrierMark, PedigreeChart, PedigreeLayout, PedigreeRows, PedigreeSamples, PedigreeSex, PedigreeSymbol, RamachandranClass, RamachandranPanel, RamachandranPlot, RamachandranRegionStyle, RamachandranRegions, RamachandranSamples, RamachandranVerdict, lifescienceCatalog };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/charts/lifescience/pedigreeEnums.ts
|
|
2
|
+
var PedigreeSex = /* @__PURE__ */ function(PedigreeSex) {
|
|
3
|
+
PedigreeSex["Male"] = "male";
|
|
4
|
+
PedigreeSex["Female"] = "female";
|
|
5
|
+
PedigreeSex["Unknown"] = "unknown";
|
|
6
|
+
return PedigreeSex;
|
|
7
|
+
}({});
|
|
8
|
+
/** A heterozygote: the central dot of the NSGC standard, or the half-shaded symbol common in textbooks. */
|
|
9
|
+
var PedigreeCarrierMark = /* @__PURE__ */ function(PedigreeCarrierMark) {
|
|
10
|
+
PedigreeCarrierMark["Dot"] = "dot";
|
|
11
|
+
PedigreeCarrierMark["HalfFill"] = "half-fill";
|
|
12
|
+
return PedigreeCarrierMark;
|
|
13
|
+
}({});
|
|
14
|
+
/** What is written under each symbol. */
|
|
15
|
+
var PedigreeCaption = /* @__PURE__ */ function(PedigreeCaption) {
|
|
16
|
+
PedigreeCaption["Number"] = "number";
|
|
17
|
+
PedigreeCaption["NumberAndName"] = "number-and-name";
|
|
18
|
+
PedigreeCaption["None"] = "none";
|
|
19
|
+
return PedigreeCaption;
|
|
20
|
+
}({});
|
|
21
|
+
export { PedigreeCaption, PedigreeCarrierMark, PedigreeSex };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/charts/lifescience/ramachandranEnums.ts
|
|
2
|
+
/** MolProbity's six Top8000 reference classes. */
|
|
3
|
+
var RamachandranClass = /* @__PURE__ */ function(RamachandranClass) {
|
|
4
|
+
RamachandranClass["General"] = "general";
|
|
5
|
+
RamachandranClass["Glycine"] = "glycine";
|
|
6
|
+
RamachandranClass["TransProline"] = "trans-proline";
|
|
7
|
+
RamachandranClass["CisProline"] = "cis-proline";
|
|
8
|
+
RamachandranClass["PreProline"] = "pre-proline";
|
|
9
|
+
RamachandranClass["IleVal"] = "ile-val";
|
|
10
|
+
return RamachandranClass;
|
|
11
|
+
}({});
|
|
12
|
+
/** Which reference map a plot shows: every residue on the general map, or one class on its own. */
|
|
13
|
+
var RamachandranPanel = /* @__PURE__ */ function(RamachandranPanel) {
|
|
14
|
+
RamachandranPanel["All"] = "all";
|
|
15
|
+
RamachandranPanel["General"] = "general";
|
|
16
|
+
RamachandranPanel["Glycine"] = "glycine";
|
|
17
|
+
RamachandranPanel["TransProline"] = "trans-proline";
|
|
18
|
+
RamachandranPanel["CisProline"] = "cis-proline";
|
|
19
|
+
RamachandranPanel["PreProline"] = "pre-proline";
|
|
20
|
+
RamachandranPanel["IleVal"] = "ile-val";
|
|
21
|
+
return RamachandranPanel;
|
|
22
|
+
}({});
|
|
23
|
+
var RamachandranRegionStyle = /* @__PURE__ */ function(RamachandranRegionStyle) {
|
|
24
|
+
RamachandranRegionStyle["Filled"] = "filled";
|
|
25
|
+
RamachandranRegionStyle["Contour"] = "contour";
|
|
26
|
+
return RamachandranRegionStyle;
|
|
27
|
+
}({});
|
|
28
|
+
var RamachandranVerdict = /* @__PURE__ */ function(RamachandranVerdict) {
|
|
29
|
+
RamachandranVerdict["Favoured"] = "favoured";
|
|
30
|
+
RamachandranVerdict["Allowed"] = "allowed";
|
|
31
|
+
RamachandranVerdict["Outlier"] = "outlier";
|
|
32
|
+
return RamachandranVerdict;
|
|
33
|
+
}({});
|
|
34
|
+
export { RamachandranClass, RamachandranPanel, RamachandranRegionStyle, RamachandranVerdict };
|
|
@@ -10,7 +10,7 @@ import { axisRight, extent, range, scaleLinear } from "d3";
|
|
|
10
10
|
var RIGHT = 46;
|
|
11
11
|
/**
|
|
12
12
|
* Two measures with different units over the same x. A last resort: the visual relation depends on arbitrary axis ranges,
|
|
13
|
-
* so prefer `IndexedLine` or `
|
|
13
|
+
* so prefer `IndexedLine` or `GridPlot`. If you must use it, prefer `Gridlock`, which at least shares gridlines.
|
|
14
14
|
*/
|
|
15
15
|
var DualAxisChart = class extends TrendChart {
|
|
16
16
|
static meta = {
|
|
@@ -194,20 +194,6 @@ var RidgeFill = /* @__PURE__ */ function(RidgeFill) {
|
|
|
194
194
|
RidgeFill["Line"] = "lines-only";
|
|
195
195
|
return RidgeFill;
|
|
196
196
|
}({});
|
|
197
|
-
/** Which points of a connected scatter get a dot. */
|
|
198
|
-
var ConnectedDots = /* @__PURE__ */ function(ConnectedDots) {
|
|
199
|
-
ConnectedDots["Ends"] = "end-dots";
|
|
200
|
-
ConnectedDots["All"] = "all-dots";
|
|
201
|
-
ConnectedDots["None"] = "no-dots";
|
|
202
|
-
return ConnectedDots;
|
|
203
|
-
}({});
|
|
204
|
-
/** Which dates are written along a connected scatter. */
|
|
205
|
-
var ConnectedDates = /* @__PURE__ */ function(ConnectedDates) {
|
|
206
|
-
ConnectedDates["Ends"] = "end-dates";
|
|
207
|
-
ConnectedDates["Periodic"] = "periodic-dates";
|
|
208
|
-
ConnectedDates["None"] = "no-dates";
|
|
209
|
-
return ConnectedDates;
|
|
210
|
-
}({});
|
|
211
197
|
/** Point every series is rebased to 100 at. */
|
|
212
198
|
var IndexBase = /* @__PURE__ */ function(IndexBase) {
|
|
213
199
|
IndexBase["First"] = "base-first";
|
|
@@ -264,4 +250,4 @@ var ForecastMethod = /* @__PURE__ */ function(ForecastMethod) {
|
|
|
264
250
|
ForecastMethod["Mean"] = "mean";
|
|
265
251
|
return ForecastMethod;
|
|
266
252
|
}({});
|
|
267
|
-
export { AreaBaseline, AreaStackOrder, BumpDirection, BumpStops, BumpWidth,
|
|
253
|
+
export { AreaBaseline, AreaStackOrder, BumpDirection, BumpStops, BumpWidth, CumulativeReset, CumulativeUnit, DifferenceView, DualAlignment, DualForm, FacetScale, FanCenter, ForecastMethod, HorizonMode, HorizonScale, IndexBase, LineAggregate, LineBaseline, LineLabels, LineMarkers, LineTrend, RangeCenter, RangeForm, RidgeFill, RidgeScale, RidgeSort, SeasonAlign, SeasonPeriod, SlopeLabels, SlopeSpan, SlopeValue, SparklineBand, SparklineForm, StepLineForm, StepPlacement, ThresholdSide, ThresholdSource };
|
|
@@ -7,7 +7,7 @@ import { TrendMath } from "./TrendMath.js";
|
|
|
7
7
|
import { mean, symbol } from "d3";
|
|
8
8
|
// src/charts/linesareas/MultiLineChart.ts
|
|
9
9
|
var SYMBOLS = Object.values(SymbolKind);
|
|
10
|
-
/** Compare the shape of several series on one axis. Works up to about eight lines; past that use `
|
|
10
|
+
/** Compare the shape of several series on one axis. Works up to about eight lines; past that use `GridPlot`. */
|
|
11
11
|
var MultiLineChart = class extends TrendChart {
|
|
12
12
|
static meta = {
|
|
13
13
|
id: "multi-line",
|
|
@@ -9,6 +9,10 @@ import { area, extent, line, ticks, utcFormat } from "d3";
|
|
|
9
9
|
// src/charts/linesareas/TrendChart.ts
|
|
10
10
|
var LABEL_ROOM = 96;
|
|
11
11
|
var TICK_WIDTH = 58;
|
|
12
|
+
/** Below one decade a log axis has too few powers and multiples, so it ticks linearly. */
|
|
13
|
+
var DECADE = 10;
|
|
14
|
+
/** Height of a decade under which 1, 2 and 5 no longer clear each other; 2 sits 0.3 of a decade above 1. */
|
|
15
|
+
var ROOMY_DECADE = 46;
|
|
12
16
|
/** Lines over a shared x: parsing, scales, gaps, direct labels, markers and hover, for the whole module. */
|
|
13
17
|
var TrendChart = class TrendChart extends CartesianChart {
|
|
14
18
|
static clips = 0;
|
|
@@ -118,19 +122,25 @@ var TrendChart = class TrendChart extends CartesianChart {
|
|
|
118
122
|
}
|
|
119
123
|
const scale = Scales.continuous(this.options.scale).domain([lo, hi]).range([height, 0]);
|
|
120
124
|
if (!log) return scale.nice();
|
|
121
|
-
|
|
125
|
+
const natural = scale.ticks.bind(scale);
|
|
126
|
+
return Object.assign(scale, { ticks: (count = this.yTicks()) => {
|
|
127
|
+
const [low, high] = scale.domain();
|
|
128
|
+
return high / low < DECADE ? ticks(low, high, count) : natural(count);
|
|
129
|
+
} });
|
|
122
130
|
}
|
|
123
|
-
/** On a
|
|
131
|
+
/** On a log axis of a decade or more only 1, 2 and 5 keep a label, or just the powers of ten where those would collide. */
|
|
124
132
|
tickFormat(scale) {
|
|
125
133
|
const [lo, hi] = scale.domain?.() ?? [];
|
|
126
134
|
if (lo instanceof Date) return (value) => this.streaming && +hi - +lo < 12e4 ? utcFormat("%H:%M:%S")(value) : TrendChart.dateTick(value, +hi - +lo);
|
|
127
135
|
const format = super.tickFormat(scale);
|
|
128
|
-
if (!format || !
|
|
129
|
-
|
|
136
|
+
if (!format || !("base" in scale) || !(hi / lo >= DECADE)) return format;
|
|
137
|
+
const [top, bottom] = scale.range?.() ?? [];
|
|
138
|
+
const kept = Math.abs(bottom - top) / Math.log10(hi / lo) < ROOMY_DECADE ? [1] : [
|
|
130
139
|
1,
|
|
131
140
|
2,
|
|
132
141
|
5
|
|
133
|
-
]
|
|
142
|
+
];
|
|
143
|
+
return (value) => kept.includes(Math.round(+value / 10 ** Math.floor(Math.log10(+value) + 1e-9))) ? format(value) : "";
|
|
134
144
|
}
|
|
135
145
|
static dateTick(value, span) {
|
|
136
146
|
const day = 864e5;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AreaBaseline, AreaStackOrder, BumpDirection, BumpStops, BumpWidth,
|
|
1
|
+
import { AreaBaseline, AreaStackOrder, BumpDirection, BumpStops, BumpWidth, CumulativeReset, CumulativeUnit, DifferenceView, DualAlignment, DualForm, FacetScale, FanCenter, ForecastMethod, HorizonMode, HorizonScale, IndexBase, LineAggregate, LineBaseline, LineLabels, LineMarkers, LineTrend, RangeCenter, RangeForm, RidgeFill, RidgeScale, RidgeSort, SeasonAlign, SeasonPeriod, SlopeLabels, SlopeSpan, SlopeValue, SparklineBand, SparklineForm, StepLineForm, StepPlacement, ThresholdSide, ThresholdSource } from "./LineEnums.js";
|
|
2
2
|
import { TrendHover } from "./TrendHover.js";
|
|
3
3
|
import { TrendLabels } from "./TrendLabels.js";
|
|
4
4
|
import { TrendTable, TrendXKind } from "./TrendTable.js";
|
|
@@ -19,9 +19,7 @@ import { SparklineChart } from "./SparklineChart.js";
|
|
|
19
19
|
import { DifferenceChart } from "./DifferenceChart.js";
|
|
20
20
|
import { HorizonChart } from "./HorizonChart.js";
|
|
21
21
|
import { RangeAreaChart } from "./RangeAreaChart.js";
|
|
22
|
-
import { SmallMultipleLines } from "./SmallMultipleLines.js";
|
|
23
22
|
import { RidgeLines } from "./RidgeLines.js";
|
|
24
|
-
import { ConnectedScatterTime } from "./ConnectedScatterTime.js";
|
|
25
23
|
import { DualAxisChart } from "./DualAxisChart.js";
|
|
26
24
|
import { FanChart } from "./FanChart.js";
|
|
27
25
|
import { ThresholdAreaChart } from "./ThresholdAreaChart.js";
|
|
@@ -43,13 +41,11 @@ var linesareasCatalog = [
|
|
|
43
41
|
DifferenceChart,
|
|
44
42
|
HorizonChart,
|
|
45
43
|
RangeAreaChart,
|
|
46
|
-
SmallMultipleLines,
|
|
47
44
|
RidgeLines,
|
|
48
|
-
ConnectedScatterTime,
|
|
49
45
|
DualAxisChart,
|
|
50
46
|
FanChart,
|
|
51
47
|
ThresholdAreaChart,
|
|
52
48
|
SeasonalLines,
|
|
53
49
|
ForecastLine
|
|
54
50
|
];
|
|
55
|
-
export { AreaBaseline, AreaChart, AreaStackOrder, BumpChart, BumpDirection, BumpStops, BumpWidth,
|
|
51
|
+
export { AreaBaseline, AreaChart, AreaStackOrder, BumpChart, BumpDirection, BumpStops, BumpWidth, CumulativeLine, CumulativeReset, CumulativeUnit, DifferenceChart, DifferenceView, DualAlignment, DualAxisChart, DualForm, FacetScale, FanCenter, FanChart, ForecastLine, ForecastMethod, HorizonChart, HorizonMode, HorizonScale, IndexBase, IndexedLine, LayerOffset, LayeredChart, LineAggregate, LineBaseline, LineChart, LineLabels, LineMarkers, LineTrend, MultiLineChart, RangeAreaChart, RangeCenter, RangeForm, RidgeFill, RidgeLines, RidgeScale, RidgeSort, SeasonAlign, SeasonPeriod, SeasonalLines, SlopeChart, SlopeLabels, SlopeSpan, SlopeValue, SparklineBand, SparklineChart, SparklineForm, StackedAreaChart, StepChart, StepLineForm, StepPlacement, Streamgraph, ThresholdAreaChart, ThresholdSide, ThresholdSource, TrendChart, TrendHover, TrendLabels, TrendMath, TrendTable, TrendXKind, linesareasCatalog };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CartesianChart } from "../../core/CartesianChart.js";
|
|
2
|
-
import { ExportFormat } from "../../core/ChartExporter.js";
|
|
2
|
+
import { ChartExporter, ExportFormat } from "../../core/ChartExporter.js";
|
|
3
3
|
import { ScaleKind } from "../../core/enums.js";
|
|
4
4
|
import { Scales } from "../../core/Scales.js";
|
|
5
5
|
import { CanvasSurface } from "./CanvasSurface.js";
|
|
@@ -122,7 +122,8 @@ var MassiveChart = class extends CartesianChart {
|
|
|
122
122
|
return [
|
|
123
123
|
ExportFormat.SVG,
|
|
124
124
|
ExportFormat.PNG,
|
|
125
|
-
|
|
125
|
+
ExportFormat.PDF,
|
|
126
|
+
...ChartExporter.tabular(rows ?? 0)
|
|
126
127
|
];
|
|
127
128
|
}
|
|
128
129
|
/** A patch naming `data` may hold the same array, written to in place. */
|
|
@@ -23,6 +23,7 @@ var FourierView = /* @__PURE__ */ function(FourierView) {
|
|
|
23
23
|
var SAMPLES = 256;
|
|
24
24
|
var TAU = Math.PI * 2;
|
|
25
25
|
var MOMENT = .13;
|
|
26
|
+
var ISO_DATE = /^\d{4}-\d{2}(-\d{2})?/;
|
|
26
27
|
var WAVES = {
|
|
27
28
|
["square"]: (t) => t < .5 ? 1 : -1,
|
|
28
29
|
["sawtooth"]: (t) => 2 * t - 1,
|
|
@@ -77,11 +78,16 @@ var FourierSeriesChart = class FourierSeriesChart extends MathPlane {
|
|
|
77
78
|
left: 42
|
|
78
79
|
};
|
|
79
80
|
}
|
|
81
|
+
/** A row's place along the period, NaN when it has none. */
|
|
82
|
+
static position(cell) {
|
|
83
|
+
if (cell === null || cell === void 0 || cell === "") return NaN;
|
|
84
|
+
return typeof cell === "string" && ISO_DATE.test(cell) ? Date.parse(cell) : +cell;
|
|
85
|
+
}
|
|
80
86
|
signal() {
|
|
81
87
|
const { wave, data, x, y } = this.options;
|
|
82
88
|
const ts = Array.from({ length: SAMPLES }, (_, i) => i / SAMPLES);
|
|
83
89
|
if (wave !== "data") return ts.map(WAVES[wave]);
|
|
84
|
-
const points = data.map((row) => [
|
|
90
|
+
const points = data.map((row) => [FourierSeriesChart.position(row[x]), row[y] === null ? NaN : +row[y]]).filter((p) => Number.isFinite(p[0]) && Number.isFinite(p[1]));
|
|
85
91
|
if (!points.length) return ts.map(() => 0);
|
|
86
92
|
const a = Math.min(...points.map((p) => p[0])), b = Math.max(...points.map((p) => p[0]));
|
|
87
93
|
const fn = MathNumerics.interpolate(points);
|
|
@@ -12,14 +12,12 @@ import { LissajousChart, LissajousLayout, LissajousRatio, LissajousView } from "
|
|
|
12
12
|
import { FractalRegion, FractalSet, FractalShading, MandelbrotChart } from "./MandelbrotChart.js";
|
|
13
13
|
import { NumberLineArrangement, NumberLineChart, NumberLineMark } from "./NumberLineChart.js";
|
|
14
14
|
import { ParametricForm, ParametricPlot, ParametricTrace } from "./ParametricPlot.js";
|
|
15
|
-
import { ParametricSurface3D, SurfaceForm, SurfaceRender } from "./ParametricSurface3D.js";
|
|
16
15
|
import { FieldForm, FieldPlot } from "./FieldPlot.js";
|
|
17
16
|
import { PhaseBackdrop, PhasePortrait, PhaseSystem } from "./PhasePortrait.js";
|
|
18
17
|
import { PolarConvention, PolarCurveForm, PolarCurvePlot } from "./PolarCurvePlot.js";
|
|
19
18
|
import { RiemannMethod, RiemannSumChart } from "./RiemannSumChart.js";
|
|
20
19
|
import { SetRelationChart, SetRelationOrder, SetRelationView } from "./SetRelationChart.js";
|
|
21
20
|
import { SlopeEquation, SlopeFieldChart, SlopeGlyph } from "./SlopeFieldChart.js";
|
|
22
|
-
import { AttractorRender, AttractorSystem, StrangeAttractor3D } from "./StrangeAttractor3D.js";
|
|
23
21
|
import { StreamSeeding, StreamlineChart } from "./StreamlineChart.js";
|
|
24
22
|
import { TaylorFunction, TaylorSeriesChart, TaylorView } from "./TaylorSeriesChart.js";
|
|
25
23
|
import { VectorFieldChart, VectorGlyph, VectorLattice, VectorLength } from "./VectorFieldChart.js";
|
|
@@ -44,8 +42,6 @@ var mathematicalCatalog = [
|
|
|
44
42
|
FibonacciSpiralChart,
|
|
45
43
|
SetRelationChart,
|
|
46
44
|
CobwebPlot,
|
|
47
|
-
TaylorSeriesChart
|
|
48
|
-
StrangeAttractor3D,
|
|
49
|
-
ParametricSurface3D
|
|
45
|
+
TaylorSeriesChart
|
|
50
46
|
];
|
|
51
|
-
export { ArgandDiagram, ArgandView,
|
|
47
|
+
export { ArgandDiagram, ArgandView, BifurcationDiagram, BifurcationView, BifurcationWindow, CobwebPlot, CobwebRegime, ComplexDomainColoring, DomainChannel, DomainForm, FibonacciCurve, FibonacciLayout, FibonacciSpiralChart, FieldForm, FieldPlot, FourierSeriesChart, FourierView, FourierWave, FractalRegion, FractalSet, FractalShading, FunctionCompanion, FunctionFill, FunctionPlot, ImplicitForm, ImplicitPlot, ImplicitView, IterationMapKind, LissajousChart, LissajousLayout, LissajousRatio, LissajousView, MandelbrotChart, MathPlane, NumberLineArrangement, NumberLineChart, NumberLineMark, ParametricForm, ParametricPlot, ParametricTrace, PhaseBackdrop, PhasePortrait, PhaseSystem, PhyllotaxisAngle, PlaneFrame, PlaneTicks, PolarConvention, PolarCurveForm, PolarCurvePlot, RiemannMethod, RiemannSumChart, SetRelationChart, SetRelationOrder, SetRelationView, SlopeEquation, SlopeFieldChart, SlopeGlyph, StreamSeeding, StreamlineChart, TaylorFunction, TaylorSeriesChart, TaylorView, VectorFieldChart, VectorGlyph, VectorLattice, VectorLength, mathematicalCatalog };
|
|
@@ -68,7 +68,8 @@ var GridPlot = class extends MatrixSurface {
|
|
|
68
68
|
scale: "shared-scale",
|
|
69
69
|
columns: 3,
|
|
70
70
|
reference: false,
|
|
71
|
-
context: false
|
|
71
|
+
context: false,
|
|
72
|
+
trend: false
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
get blank() {
|
|
@@ -116,7 +117,7 @@ var GridPlot = class extends MatrixSurface {
|
|
|
116
117
|
return line().x((p) => fx(p.x)).y((p) => fy(p.y)).curve(panel === "step-panels" ? curveStepAfter : curveMonotoneX)(points) ?? "";
|
|
117
118
|
}
|
|
118
119
|
compose(ctx) {
|
|
119
|
-
const { panel, scale, reference, context, columns: wanted } = this.options;
|
|
120
|
+
const { panel, scale, reference, context, trend, columns: wanted } = this.options;
|
|
120
121
|
const { facets, times } = this.facets();
|
|
121
122
|
const columns = Math.max(1, Math.min(wanted, facets.length)), rows = Math.ceil(facets.length / columns);
|
|
122
123
|
const every = facets.flatMap((facet) => facet.points);
|
|
@@ -162,6 +163,30 @@ var GridPlot = class extends MatrixSurface {
|
|
|
162
163
|
level: d.fy(mean(d.points, (p) => p.y) ?? 0)
|
|
163
164
|
})) : [];
|
|
164
165
|
ctx.marks("means", "line", means, (d) => d.name).attr("x1", left).attr("x2", (d) => left(d) + panelW).attr("y1", (d) => top(d) + d.level).attr("y2", (d) => top(d) + d.level).attr("stroke", ctx.theme.inkMuted).attr("stroke-dasharray", "3 3");
|
|
166
|
+
const fits = trend ? panels.flatMap((d) => {
|
|
167
|
+
const meanX = mean(d.points, (p) => p.x) ?? 0, meanY = mean(d.points, (p) => p.y) ?? 0;
|
|
168
|
+
const spread = d.points.reduce((sum, p) => sum + (p.x - meanX) ** 2, 0);
|
|
169
|
+
if (d.points.length < 2 || !spread) return [];
|
|
170
|
+
const slope = d.points.reduce((sum, p) => sum + (p.x - meanX) * (p.y - meanY), 0) / spread;
|
|
171
|
+
const at = (x) => d.fy(meanY + slope * (x - meanX));
|
|
172
|
+
const [from, to] = extent(d.points, (p) => p.x);
|
|
173
|
+
const [x1, x2, y1, y2] = [
|
|
174
|
+
fx(from),
|
|
175
|
+
fx(to),
|
|
176
|
+
at(from),
|
|
177
|
+
at(to)
|
|
178
|
+
];
|
|
179
|
+
const edge = (y) => Math.max(0, Math.min(panelH, y));
|
|
180
|
+
const inset = (y, other) => edge(y) === y ? 0 : (edge(y) - y) / (other - y);
|
|
181
|
+
return [{
|
|
182
|
+
...d,
|
|
183
|
+
x1: x1 + (x2 - x1) * inset(y1, y2),
|
|
184
|
+
x2: x2 - (x2 - x1) * inset(y2, y1),
|
|
185
|
+
y1: edge(y1),
|
|
186
|
+
y2: edge(y2)
|
|
187
|
+
}];
|
|
188
|
+
}) : [];
|
|
189
|
+
ctx.marks("trends", "line", fits, (d) => d.name).attr("x1", (d) => left(d) + d.x1).attr("x2", (d) => left(d) + d.x2).attr("y1", (d) => top(d) + d.y1).attr("y2", (d) => top(d) + d.y2).attr("stroke", ctx.theme.ink).attr("stroke-width", 1.5);
|
|
165
190
|
const ticksY = panels.filter((d) => free || d.column === 0).flatMap((d) => d.fy.ticks(3).map((tick) => ({
|
|
166
191
|
key: `${d.name}/${tick}`,
|
|
167
192
|
d,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartFamily, DataShape, Dimension } from "../../core/enums.js";
|
|
2
2
|
import { Scales } from "../../core/Scales.js";
|
|
3
|
-
import {
|
|
3
|
+
import { WorldSample } from "../../data/WorldSample.js";
|
|
4
4
|
import { MatrixGlyphs } from "./MatrixGlyphs.js";
|
|
5
5
|
import { MatrixGlyph } from "./matrixEnums.js";
|
|
6
6
|
import { MatrixSurface } from "./MatrixSurface.js";
|
|
@@ -43,7 +43,7 @@ var TilegramChart = class extends MatrixSurface {
|
|
|
43
43
|
"hex map",
|
|
44
44
|
"cartogram"
|
|
45
45
|
],
|
|
46
|
-
sample: (seed) =>
|
|
46
|
+
sample: (seed) => WorldSample.countries(seed).features.map((feature) => {
|
|
47
47
|
const [lon, lat] = geoCentroid(feature);
|
|
48
48
|
const name = String(feature.properties?.name);
|
|
49
49
|
return {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { WideLabel } from "./WideLabel.js";
|
|
2
|
+
// src/charts/mlcharts/AttentionGrid.ts
|
|
3
|
+
var GAP = 14;
|
|
4
|
+
var TITLE = 16;
|
|
5
|
+
var FLAT = 16;
|
|
6
|
+
/** Height one line of 11px text needs. */
|
|
7
|
+
var BAND = 13;
|
|
8
|
+
var MAX_HEADER = 72;
|
|
9
|
+
/** Places one or more token grids in the plot, with labels only on the outer edges, since heads share tokens. */
|
|
10
|
+
var AttentionGrid = class {
|
|
11
|
+
static plan({ plot, rows, columns, panels, square, titled, right, top, bottom, minGutter }) {
|
|
12
|
+
const title = titled ? TITLE : 0, below = top > 0;
|
|
13
|
+
const gutter = Math.min(plot.width * .26, Math.max(minGutter, Math.max(...rows.map((row) => WideLabel.width(row))) + 8));
|
|
14
|
+
const longest = Math.max(...columns.map((column) => WideLabel.width(column)));
|
|
15
|
+
const solve = (header) => {
|
|
16
|
+
let best = {
|
|
17
|
+
across: 1,
|
|
18
|
+
cw: 0,
|
|
19
|
+
ch: 0,
|
|
20
|
+
score: -1
|
|
21
|
+
};
|
|
22
|
+
for (let across = 1; across <= panels; across++) {
|
|
23
|
+
const lines = Math.ceil(panels / across);
|
|
24
|
+
const width = (plot.width - gutter - right - (across - 1) * GAP) / across;
|
|
25
|
+
const height = (plot.height - header - top - bottom - lines * title - (lines - 1) * GAP) / lines;
|
|
26
|
+
let cw = Math.max(1, width / columns.length), ch = Math.max(1, height / rows.length);
|
|
27
|
+
if (square) cw = ch = Math.min(cw, ch);
|
|
28
|
+
if (Math.min(cw, ch) > best.score) best = {
|
|
29
|
+
across,
|
|
30
|
+
cw,
|
|
31
|
+
ch,
|
|
32
|
+
score: Math.min(cw, ch)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return best;
|
|
36
|
+
};
|
|
37
|
+
let header = FLAT, fit = solve(header);
|
|
38
|
+
const flatHeader = longest + 4 <= fit.cw;
|
|
39
|
+
if (!flatHeader) {
|
|
40
|
+
header = Math.min(MAX_HEADER, longest + 6, plot.height * .3);
|
|
41
|
+
fit = solve(header);
|
|
42
|
+
}
|
|
43
|
+
const { across, cw, ch } = fit;
|
|
44
|
+
const width = cw * columns.length, height = ch * rows.length, reserved = below ? top : header;
|
|
45
|
+
const frames = Array.from({ length: panels }, (_, panel) => {
|
|
46
|
+
const x = gutter + panel % across * (width + GAP);
|
|
47
|
+
const y = title + reserved + Math.floor(panel / across) * (height + GAP + title);
|
|
48
|
+
return {
|
|
49
|
+
x,
|
|
50
|
+
y,
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
cw,
|
|
54
|
+
ch,
|
|
55
|
+
radius: 0,
|
|
56
|
+
header,
|
|
57
|
+
flatHeader,
|
|
58
|
+
stagger: false,
|
|
59
|
+
hex: false,
|
|
60
|
+
columnLabels: below ? "bottom" : "top",
|
|
61
|
+
rowLabels: true,
|
|
62
|
+
cx: (c) => x + cw * (c + .5),
|
|
63
|
+
cy: (r) => y + ch * (r + .5)
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
frames,
|
|
68
|
+
across,
|
|
69
|
+
gutter,
|
|
70
|
+
header,
|
|
71
|
+
flatHeader,
|
|
72
|
+
below,
|
|
73
|
+
bottom: Math.max(...frames.map((frame) => frame.y + frame.height)) + (below ? header : 0),
|
|
74
|
+
rowStep: Math.ceil(BAND / ch),
|
|
75
|
+
columnStep: flatHeader ? 1 : Math.ceil(BAND / cw)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export { AttentionGrid };
|