@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,40 @@
|
|
|
1
|
+
import { SampleData } from "../../data/SampleData.js";
|
|
2
|
+
// src/charts/earthscience/HovmollerSample.ts
|
|
3
|
+
var DAYS = 61;
|
|
4
|
+
var STEP = 2;
|
|
5
|
+
var DAY = 864e5;
|
|
6
|
+
var START = Date.UTC(2026, 0, 1);
|
|
7
|
+
/** Near 5 m/s at the equator, the textbook Madden-Julian speed. */
|
|
8
|
+
var EASTWARD = 3.9;
|
|
9
|
+
/** Near −5 m/s, a textbook equatorial Rossby speed. */
|
|
10
|
+
var WESTWARD = -3.9;
|
|
11
|
+
/** Near 1.3 m/s, a textbook poleward speed for boreal-summer intraseasonal bands. */
|
|
12
|
+
var NORTHWARD = 1.2;
|
|
13
|
+
var gauss = (distance, width) => Math.exp(-((distance / width) ** 2));
|
|
14
|
+
var radians = (degrees) => degrees * Math.PI / 180;
|
|
15
|
+
var arc = (a, b) => Math.abs((a - b + 540) % 360 - 180);
|
|
16
|
+
/** Synthetic tropical data for Hovmöller diagrams. It is a sum of invented waves, not a measurement of any kind. */
|
|
17
|
+
var HovmollerSample = class {
|
|
18
|
+
/**
|
|
19
|
+
* Long-form rows `{ time, longitude, latitude, value }`, shaped like outgoing longwave radiation in W/m²:
|
|
20
|
+
* a warm-pool minimum, then an eastward packet, westward waves and a northward band.
|
|
21
|
+
*/
|
|
22
|
+
static tropics(seed) {
|
|
23
|
+
const [one, two, three] = SampleData.points(seed, 3, 1).map((row) => radians(+row.y * 7));
|
|
24
|
+
const rows = [];
|
|
25
|
+
for (let day = 0; day < DAYS; day += STEP) for (let longitude = 0; longitude < 360; longitude += 10) for (let latitude = -30; latitude <= 30; latitude += 5) {
|
|
26
|
+
const mean = 248 - 34 * gauss(arc(longitude, 130), 60) * gauss(latitude, 18);
|
|
27
|
+
const packet = -24 * gauss(latitude, 14) * gauss(arc(longitude - EASTWARD * day, 40), 110) * Math.cos(radians(2 * (longitude - EASTWARD * day)) + one);
|
|
28
|
+
const rossby = 10 * gauss(Math.abs(latitude) - 10, 9) * Math.cos(radians(6 * (longitude - WESTWARD * day)) + two);
|
|
29
|
+
const band = 11 * Math.cos(radians(6 * (latitude - NORTHWARD * day)) + three);
|
|
30
|
+
rows.push({
|
|
31
|
+
time: new Date(START + day * DAY),
|
|
32
|
+
longitude,
|
|
33
|
+
latitude,
|
|
34
|
+
value: +(mean + packet + rossby + band).toFixed(1)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return rows;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export { HovmollerSample };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { HovmollerReference } from "./HovmollerEnums.js";
|
|
2
|
+
// src/charts/earthscience/HovmollerSpeed.ts
|
|
3
|
+
var SECONDS = 86400;
|
|
4
|
+
/** Metres in one degree of a great circle on a sphere of radius 6371 km. */
|
|
5
|
+
var METRES = 2 * Math.PI * 6371e3 / 360;
|
|
6
|
+
var SEARCH = Array.from({ length: 59 }, (_, i) => 1 + i * .5);
|
|
7
|
+
var MEANINGFUL = .05;
|
|
8
|
+
/** Converts wave speeds to slopes, and estimates speeds from a section. */
|
|
9
|
+
var HovmollerSpeed = class HovmollerSpeed {
|
|
10
|
+
/** Degrees per day at `speed` m/s along a line of latitude. Pass 0 for motion along a meridian. */
|
|
11
|
+
static degreesPerDay(speed, latitude = 0) {
|
|
12
|
+
return speed * SECONDS / (METRES * Math.cos(Math.min(85, Math.abs(latitude)) * Math.PI / 180));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Radon-style speed estimate, as used on altimeter and SST sections by Hill et al. (2000) and Cipollini et al. (2001).
|
|
16
|
+
* Rows are sheared by each trial speed and collapsed along the shear: the speed whose projection keeps the
|
|
17
|
+
* most variance wins. Variance is reported as adjusted R² of a one-way layout, so shears that happen to make
|
|
18
|
+
* more bins earn no credit. Stationary signal is removed first, and a best speed at the edge of the search is no peak, so it returns null.
|
|
19
|
+
*/
|
|
20
|
+
static fit(field, direction, latitude = 0) {
|
|
21
|
+
if (field.columns < 4 || field.rows < 4) return null;
|
|
22
|
+
const flat = field.anomaly(HovmollerReference.TimeMean).anomaly(HovmollerReference.SpaceMean);
|
|
23
|
+
const scores = SEARCH.map((speed) => HovmollerSpeed.score(flat, direction * this.degreesPerDay(speed, latitude)));
|
|
24
|
+
const best = scores.reduce((top, score, i) => score.share > scores[top].share ? i : top, 0);
|
|
25
|
+
if (best === 0 || best === SEARCH.length - 1 || scores[best].share < MEANINGFUL) return null;
|
|
26
|
+
return {
|
|
27
|
+
speed: direction * SEARCH[best],
|
|
28
|
+
rate: direction * this.degreesPerDay(SEARCH[best], latitude),
|
|
29
|
+
...scores[best]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static score(field, rate) {
|
|
33
|
+
const { columns, rows, positions, values, cyclic, spacing } = field;
|
|
34
|
+
const days = field.days, first = positions[0], turn = 360;
|
|
35
|
+
const shifts = days.map((day) => rate * day);
|
|
36
|
+
const lowest = first - Math.max(0, ...shifts);
|
|
37
|
+
const span = positions.at(-1) - first + Math.max(0, ...shifts) - Math.min(0, ...shifts);
|
|
38
|
+
const bins = Math.ceil((cyclic ? turn : span) / spacing) + 1;
|
|
39
|
+
const sum = new Float64Array(bins), count = new Float64Array(bins);
|
|
40
|
+
const place = (sheared) => cyclic ? ((sheared - first) % turn + turn) % turn : sheared - lowest;
|
|
41
|
+
let total = 0, square = 0, seen = 0;
|
|
42
|
+
for (let j = 0; j < rows; j++) for (let i = 0; i < columns; i++) {
|
|
43
|
+
const value = values[i + j * columns];
|
|
44
|
+
if (Number.isNaN(value)) continue;
|
|
45
|
+
const bin = Math.floor(place(positions[i] - shifts[j]) / spacing);
|
|
46
|
+
sum[bin] += value;
|
|
47
|
+
count[bin]++;
|
|
48
|
+
total += value;
|
|
49
|
+
square += value * value;
|
|
50
|
+
seen++;
|
|
51
|
+
}
|
|
52
|
+
const grand = total * total / (seen || 1), whole = square - grand;
|
|
53
|
+
let between = -grand, used = 0, peak = 0, origin = first;
|
|
54
|
+
sum.forEach((part, bin) => {
|
|
55
|
+
if (!count[bin]) return;
|
|
56
|
+
between += part * part / count[bin];
|
|
57
|
+
used++;
|
|
58
|
+
const mean = Math.abs(part / count[bin]);
|
|
59
|
+
if (count[bin] >= rows / 2 && mean > peak) {
|
|
60
|
+
peak = mean;
|
|
61
|
+
origin = (cyclic ? first : lowest) + (bin + .5) * spacing;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const free = seen - used;
|
|
65
|
+
return {
|
|
66
|
+
share: whole > 0 && free > 0 ? Math.max(0, 1 - (whole - between) / free / (whole / (seen - 1))) : 0,
|
|
67
|
+
origin
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
export { HovmollerSpeed };
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { HovmollerGuides, HovmollerLongitudes, HovmollerReference, HovmollerSection, HovmollerStyle, HovmollerTimeFlow } from "./HovmollerEnums.js";
|
|
2
|
+
import { HovmollerField } from "./HovmollerField.js";
|
|
3
|
+
import { HovmollerSpeed } from "./HovmollerSpeed.js";
|
|
4
|
+
import { HovmollerDiagram } from "./HovmollerDiagram.js";
|
|
1
5
|
import { BaseflowMethod, BaseflowSeparation } from "./BaseflowSeparation.js";
|
|
2
6
|
import { Hydrograph } from "./Hydrograph.js";
|
|
3
7
|
import { TernaryContour, TernaryContourStyle, TernaryLevelRule, TernarySurface } from "./TernaryContour.js";
|
|
4
8
|
// src/charts/earthscience/index.ts
|
|
5
|
-
var earthscienceCatalog = [
|
|
6
|
-
|
|
9
|
+
var earthscienceCatalog = [
|
|
10
|
+
HovmollerDiagram,
|
|
11
|
+
Hydrograph,
|
|
12
|
+
TernaryContour
|
|
13
|
+
];
|
|
14
|
+
export { BaseflowMethod, BaseflowSeparation, HovmollerDiagram, HovmollerField, HovmollerGuides, HovmollerLongitudes, HovmollerReference, HovmollerSection, HovmollerSpeed, HovmollerStyle, HovmollerTimeFlow, Hydrograph, TernaryContour, TernaryContourStyle, TernaryLevelRule, TernarySurface, earthscienceCatalog };
|
|
@@ -14,6 +14,7 @@ var ConstellationModulation = /* @__PURE__ */ function(ConstellationModulation)
|
|
|
14
14
|
var ConstellationRender = /* @__PURE__ */ function(ConstellationRender) {
|
|
15
15
|
ConstellationRender["Points"] = "points";
|
|
16
16
|
ConstellationRender["Density"] = "density";
|
|
17
|
+
ConstellationRender["Path"] = "symbol-path";
|
|
17
18
|
return ConstellationRender;
|
|
18
19
|
}({});
|
|
19
20
|
var ConstellationReference = /* @__PURE__ */ function(ConstellationReference) {
|
|
@@ -78,7 +79,11 @@ var ConstellationDiagram = class extends EngineeringChart {
|
|
|
78
79
|
],
|
|
79
80
|
sample: sampleSymbols,
|
|
80
81
|
variants: {
|
|
81
|
-
render: [
|
|
82
|
+
render: [
|
|
83
|
+
"points",
|
|
84
|
+
"density",
|
|
85
|
+
"symbol-path"
|
|
86
|
+
],
|
|
82
87
|
reference: [
|
|
83
88
|
"lattice",
|
|
84
89
|
"unreferenced",
|
|
@@ -90,10 +95,12 @@ var ConstellationDiagram = class extends EngineeringChart {
|
|
|
90
95
|
"by-error"
|
|
91
96
|
],
|
|
92
97
|
view: ["i-q", "phase-amplitude"],
|
|
93
|
-
boundaries: [true, false]
|
|
98
|
+
boundaries: [true, false],
|
|
99
|
+
ring: [false, true]
|
|
94
100
|
},
|
|
95
101
|
valid: (v) => {
|
|
96
|
-
if (v.view === "phase-amplitude" && v.boundaries) return false;
|
|
102
|
+
if (v.view === "phase-amplitude" && (v.boundaries || v.ring)) return false;
|
|
103
|
+
if (v.render === "symbol-path" && v.view === "phase-amplitude") return false;
|
|
97
104
|
return v.render === "points" || v.encoding === "single" && v.reference !== "error-vectors";
|
|
98
105
|
}
|
|
99
106
|
};
|
|
@@ -106,7 +113,8 @@ var ConstellationDiagram = class extends EngineeringChart {
|
|
|
106
113
|
reference: "lattice",
|
|
107
114
|
encoding: "single",
|
|
108
115
|
view: "i-q",
|
|
109
|
-
boundaries: true
|
|
116
|
+
boundaries: true,
|
|
117
|
+
ring: false
|
|
110
118
|
};
|
|
111
119
|
}
|
|
112
120
|
symbols(ideal) {
|
|
@@ -123,7 +131,7 @@ var ConstellationDiagram = class extends EngineeringChart {
|
|
|
123
131
|
});
|
|
124
132
|
}
|
|
125
133
|
draw(ctx) {
|
|
126
|
-
const { modulation, render, reference, encoding, view, boundaries, xLabel, yLabel } = this.options;
|
|
134
|
+
const { modulation, render, reference, encoding, view, boundaries, ring, xLabel, yLabel } = this.options;
|
|
127
135
|
const { width, height } = ctx.plot;
|
|
128
136
|
const ideal = lattice(modulation);
|
|
129
137
|
const symbols = this.symbols(ideal);
|
|
@@ -168,6 +176,11 @@ var ConstellationDiagram = class extends EngineeringChart {
|
|
|
168
176
|
points: cells.cellPolygon(i) ?? []
|
|
169
177
|
})));
|
|
170
178
|
}
|
|
179
|
+
if (ring && !polar) this.guides(ctx, "power-ring", [{
|
|
180
|
+
key: "ring",
|
|
181
|
+
dash: "4 3",
|
|
182
|
+
points: Array.from({ length: 121 }, (_, k) => at([Math.cos(k * Math.PI / 60), Math.sin(k * Math.PI / 60)]))
|
|
183
|
+
}]);
|
|
171
184
|
const worst = max(symbols, (s) => s.error) || 1e-9;
|
|
172
185
|
const seat = (s) => at([s.i, s.q]);
|
|
173
186
|
if (render === "density") {
|
|
@@ -195,6 +208,13 @@ var ConstellationDiagram = class extends EngineeringChart {
|
|
|
195
208
|
points: vectors
|
|
196
209
|
}]);
|
|
197
210
|
}
|
|
211
|
+
const shown = render === "symbol-path" ? symbols.slice(0, 64) : symbols;
|
|
212
|
+
if (render === "symbol-path") this.traces(ctx, "symbol-path", [{
|
|
213
|
+
key: "path",
|
|
214
|
+
color: ctx.palette.color("Symbols"),
|
|
215
|
+
width: 1,
|
|
216
|
+
points: shown.map(seat)
|
|
217
|
+
}]);
|
|
198
218
|
const quadrants = encoding === "by-quadrant";
|
|
199
219
|
if (quadrants) [
|
|
200
220
|
"Q1",
|
|
@@ -204,7 +224,7 @@ var ConstellationDiagram = class extends EngineeringChart {
|
|
|
204
224
|
].forEach(ctx.palette.color);
|
|
205
225
|
const quadrant = (s) => s.i >= 0 ? s.q >= 0 ? 0 : 3 : s.q >= 0 ? 1 : 2;
|
|
206
226
|
const byError = encoding === "by-error";
|
|
207
|
-
const marks = ctx.marks("symbols", "path",
|
|
227
|
+
const marks = ctx.marks("symbols", "path", shown).attr("fill-opacity", .75).attr("fill", (s) => {
|
|
208
228
|
if (byError) return ctx.palette.sequential(.2 + .8 * s.error / worst);
|
|
209
229
|
return ctx.palette.color(quadrants ? `Q${quadrant(s) + 1}` : "Symbols");
|
|
210
230
|
});
|
|
@@ -225,9 +225,10 @@ var EyeDiagram = class extends EngineeringChart {
|
|
|
225
225
|
height: eyeHeight
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
|
+
const left = max(cross, (c) => c.at < center ? c.at : void 0) ?? 0, right = min(cross, (c) => c.at >= center ? c.at : void 0) ?? span;
|
|
228
229
|
this.annotate(eye, "eye-note", opening > 0 ? [{
|
|
229
230
|
key: "h",
|
|
230
|
-
text: `Opening ${opening.toPrecision(2)}`,
|
|
231
|
+
text: `Opening ${opening.toPrecision(2)}, width ${(right - left).toFixed(2)} UI`,
|
|
231
232
|
x: x(center),
|
|
232
233
|
y: y(threshold) + (mask ? 30 : 4),
|
|
233
234
|
anchor: "middle",
|
|
@@ -35,12 +35,15 @@ var PoleZeroPlot = class extends SPlaneChart {
|
|
|
35
35
|
plane: [
|
|
36
36
|
"s-plane",
|
|
37
37
|
"z-matched",
|
|
38
|
-
"z-bilinear"
|
|
38
|
+
"z-bilinear",
|
|
39
|
+
"z-plane"
|
|
39
40
|
],
|
|
40
41
|
guides: [true, false],
|
|
41
42
|
stability: [true, false],
|
|
42
|
-
upperHalf: [false, true]
|
|
43
|
-
|
|
43
|
+
upperHalf: [false, true],
|
|
44
|
+
pairs: [false, true]
|
|
45
|
+
},
|
|
46
|
+
valid: ({ upperHalf, pairs }) => !(upperHalf && pairs)
|
|
44
47
|
};
|
|
45
48
|
defaults() {
|
|
46
49
|
return {
|
|
@@ -48,19 +51,23 @@ var PoleZeroPlot = class extends SPlaneChart {
|
|
|
48
51
|
plane: "s-plane",
|
|
49
52
|
guides: true,
|
|
50
53
|
stability: true,
|
|
51
|
-
upperHalf: false
|
|
54
|
+
upperHalf: false,
|
|
55
|
+
pairs: false
|
|
52
56
|
};
|
|
53
57
|
}
|
|
58
|
+
matched(period) {
|
|
59
|
+
return ([re, im]) => ComplexMath.polar(Math.exp(re * period), im * period);
|
|
60
|
+
}
|
|
54
61
|
mapper(roots) {
|
|
55
62
|
const { plane, samplePeriod } = this.options;
|
|
56
63
|
const fastest = Math.max(1e-6, ...roots.map((root) => Math.hypot(root.real, root.imaginary)));
|
|
57
64
|
const period = samplePeriod ?? 1 / fastest;
|
|
58
|
-
if (plane === "z-matched") return
|
|
65
|
+
if (plane === "z-matched") return this.matched(period);
|
|
59
66
|
if (plane === "z-bilinear") return ([re, im]) => ComplexMath.div([1 + re * period / 2, im * period / 2], [1 - re * period / 2, -im * period / 2]);
|
|
60
67
|
return (s) => s;
|
|
61
68
|
}
|
|
62
69
|
draw(ctx) {
|
|
63
|
-
const { plane, guides, stability, upperHalf, xLabel, yLabel } = this.options;
|
|
70
|
+
const { plane, guides, stability, upperHalf, pairs, xLabel, yLabel } = this.options;
|
|
64
71
|
const { width, height } = ctx.plot;
|
|
65
72
|
const roots = this.roots();
|
|
66
73
|
const discrete = plane !== "s-plane";
|
|
@@ -98,11 +105,13 @@ var PoleZeroPlot = class extends SPlaneChart {
|
|
|
98
105
|
points: this.within(ring(1), width, height)
|
|
99
106
|
}]);
|
|
100
107
|
if (guides) {
|
|
101
|
-
const
|
|
108
|
+
const onZ = plane === "z-plane";
|
|
109
|
+
const period = onZ ? 1 : Math.max(...roots.map((root) => Math.hypot(root.real, root.imaginary)), 1);
|
|
110
|
+
const trace = onZ ? this.matched(1) : map;
|
|
102
111
|
const traced = this.dampingGrid(discrete ? period * 3 : Math.max(-left, y.domain()[1]) * 1.3).map((guide) => ({
|
|
103
112
|
...guide,
|
|
104
113
|
dash: "2 3",
|
|
105
|
-
points: this.within(guide.points.map((p) => at(
|
|
114
|
+
points: this.within(guide.points.map((p) => at(trace(p))), width, height)
|
|
106
115
|
}));
|
|
107
116
|
this.guides(ctx, "damping", traced);
|
|
108
117
|
this.annotate(ctx, "damping-notes", traced.filter((g) => g.label).flatMap((g) => {
|
|
@@ -118,6 +127,21 @@ var PoleZeroPlot = class extends SPlaneChart {
|
|
|
118
127
|
}));
|
|
119
128
|
}
|
|
120
129
|
const seat = new Map(roots.map((root, i) => [root, at(placed[i])]));
|
|
130
|
+
if (pairs) {
|
|
131
|
+
const links = roots.flatMap((root) => {
|
|
132
|
+
const twin = root.imaginary > 1e-6 ? roots.find((other) => other.kind === root.kind && other.system === root.system && Math.abs(other.real - root.real) < 1e-6 && Math.abs(other.imaginary + root.imaginary) < 1e-6) : void 0;
|
|
133
|
+
return twin ? [
|
|
134
|
+
seat.get(root),
|
|
135
|
+
seat.get(twin),
|
|
136
|
+
[NaN, NaN]
|
|
137
|
+
] : [];
|
|
138
|
+
});
|
|
139
|
+
this.guides(ctx, "conjugate-pairs", [{
|
|
140
|
+
key: "pairs",
|
|
141
|
+
dash: "3 3",
|
|
142
|
+
points: links
|
|
143
|
+
}]);
|
|
144
|
+
}
|
|
121
145
|
this.rootMarks(ctx, "roots", upperHalf ? roots.filter((_, i) => placed[i][1] >= -1e-9) : roots, (root) => seat.get(root));
|
|
122
146
|
}
|
|
123
147
|
};
|