matterviz 0.3.0 → 0.3.2
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/dist/FilePicker.svelte +37 -20
- package/dist/Icon.svelte +2 -2
- package/dist/MillerIndexInput.svelte +60 -0
- package/dist/MillerIndexInput.svelte.d.ts +7 -0
- package/dist/app.css +38 -2
- package/dist/brillouin/BrillouinZone.svelte +20 -62
- package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneExportPane.svelte +12 -20
- package/dist/brillouin/BrillouinZoneScene.svelte +2 -2
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram.svelte +192 -0
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +13 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +677 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +2688 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotScene3D.svelte +8 -0
- package/dist/chempot-diagram/ChemPotScene3D.svelte.d.ts +7 -0
- package/dist/chempot-diagram/color.d.ts +10 -0
- package/dist/chempot-diagram/color.js +33 -0
- package/dist/chempot-diagram/compute.d.ts +38 -0
- package/dist/chempot-diagram/compute.js +650 -0
- package/dist/chempot-diagram/index.d.ts +5 -0
- package/dist/chempot-diagram/index.js +5 -0
- package/dist/chempot-diagram/pointer.d.ts +16 -0
- package/dist/chempot-diagram/pointer.js +40 -0
- package/dist/chempot-diagram/temperature.d.ts +15 -0
- package/dist/chempot-diagram/temperature.js +37 -0
- package/dist/chempot-diagram/types.d.ts +83 -0
- package/dist/chempot-diagram/types.js +27 -0
- package/dist/colors/index.d.ts +3 -1
- package/dist/colors/index.js +4 -0
- package/dist/composition/BarChart.svelte +13 -22
- package/dist/composition/BubbleChart.svelte +5 -3
- package/dist/composition/FormulaFilter.svelte +770 -90
- package/dist/composition/FormulaFilter.svelte.d.ts +37 -1
- package/dist/composition/PieChart.svelte +43 -18
- package/dist/composition/PieChart.svelte.d.ts +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -0
- package/dist/convex-hull/ConvexHull.svelte +14 -1
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull2D.svelte +14 -45
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +396 -134
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +93 -42
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullControls.svelte +94 -31
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +4 -2
- package/dist/convex-hull/ConvexHullStats.svelte +697 -128
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +6 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +1 -0
- package/dist/convex-hull/GasPressureControls.svelte +72 -38
- package/dist/convex-hull/GasPressureControls.svelte.d.ts +2 -1
- package/dist/convex-hull/TemperatureSlider.svelte +46 -19
- package/dist/convex-hull/TemperatureSlider.svelte.d.ts +2 -1
- package/dist/convex-hull/demo-temperature.d.ts +6 -0
- package/dist/convex-hull/demo-temperature.js +36 -0
- package/dist/convex-hull/gas-thermodynamics.js +16 -5
- package/dist/convex-hull/helpers.d.ts +7 -1
- package/dist/convex-hull/helpers.js +45 -15
- package/dist/convex-hull/index.d.ts +15 -1
- package/dist/convex-hull/index.js +1 -0
- package/dist/convex-hull/thermodynamics.d.ts +8 -21
- package/dist/convex-hull/thermodynamics.js +106 -17
- package/dist/convex-hull/types.d.ts +7 -0
- package/dist/convex-hull/types.js +11 -0
- package/dist/coordination/CoordinationBarPlot.svelte +29 -46
- package/dist/element/BohrAtom.svelte +1 -1
- package/dist/element/data.js +2 -14
- package/dist/element/data.json.gz +0 -0
- package/dist/element/index.d.ts +1 -1
- package/dist/element/index.js +1 -0
- package/dist/element/types.d.ts +1 -0
- package/dist/fermi-surface/FermiSurface.svelte +21 -65
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/compute.js +1 -21
- package/dist/fermi-surface/marching-cubes.d.ts +2 -13
- package/dist/fermi-surface/marching-cubes.js +2 -519
- package/dist/fermi-surface/parse.js +17 -23
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +1273 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +110 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +171 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +31 -0
- package/dist/heatmap-matrix/index.d.ts +53 -0
- package/dist/heatmap-matrix/index.js +100 -0
- package/dist/heatmap-matrix/shared.d.ts +2 -0
- package/dist/heatmap-matrix/shared.js +4 -0
- package/dist/icons.d.ts +119 -0
- package/dist/icons.js +119 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/io/export.js +15 -3
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +43 -0
- package/dist/io/index.d.ts +2 -2
- package/dist/io/index.js +2 -112
- package/dist/io/types.d.ts +1 -0
- package/dist/io/url-drop.d.ts +2 -0
- package/dist/io/url-drop.js +118 -0
- package/dist/isosurface/Isosurface.svelte +231 -0
- package/dist/isosurface/Isosurface.svelte.d.ts +8 -0
- package/dist/isosurface/IsosurfaceControls.svelte +273 -0
- package/dist/isosurface/IsosurfaceControls.svelte.d.ts +9 -0
- package/dist/isosurface/index.d.ts +5 -0
- package/dist/isosurface/index.js +6 -0
- package/dist/isosurface/parse.d.ts +6 -0
- package/dist/isosurface/parse.js +548 -0
- package/dist/isosurface/slice.d.ts +11 -0
- package/dist/isosurface/slice.js +145 -0
- package/dist/isosurface/types.d.ts +55 -0
- package/dist/isosurface/types.js +178 -0
- package/dist/labels.d.ts +2 -1
- package/dist/labels.js +1 -0
- package/dist/layout/InfoTag.svelte +62 -62
- package/dist/layout/SubpageGrid.svelte +74 -0
- package/dist/layout/SubpageGrid.svelte.d.ts +14 -0
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/json-tree/JsonNode.svelte +226 -53
- package/dist/layout/json-tree/JsonTree.svelte +425 -51
- package/dist/layout/json-tree/JsonTree.svelte.d.ts +1 -1
- package/dist/layout/json-tree/JsonValue.svelte +218 -97
- package/dist/layout/json-tree/types.d.ts +27 -2
- package/dist/layout/json-tree/utils.d.ts +14 -1
- package/dist/layout/json-tree/utils.js +254 -0
- package/dist/marching-cubes.d.ts +14 -0
- package/dist/marching-cubes.js +519 -0
- package/dist/math.d.ts +8 -0
- package/dist/math.js +374 -7
- package/dist/overlays/ContextMenu.svelte +3 -2
- package/dist/overlays/DraggablePane.svelte +163 -58
- package/dist/overlays/DraggablePane.svelte.d.ts +2 -0
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +232 -77
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -2
- package/dist/phase-diagram/PhaseDiagramControls.svelte +32 -11
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +3 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +103 -0
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +15 -0
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +102 -95
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +7 -0
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +100 -26
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte.d.ts +6 -3
- package/dist/phase-diagram/index.d.ts +2 -0
- package/dist/phase-diagram/index.js +2 -0
- package/dist/phase-diagram/svg-to-diagram.d.ts +2 -0
- package/dist/phase-diagram/svg-to-diagram.js +865 -0
- package/dist/phase-diagram/types.d.ts +10 -0
- package/dist/phase-diagram/utils.d.ts +7 -4
- package/dist/phase-diagram/utils.js +149 -59
- package/dist/plot/AxisLabel.svelte +26 -0
- package/dist/plot/AxisLabel.svelte.d.ts +16 -0
- package/dist/plot/BarPlot.svelte +473 -228
- package/dist/plot/BarPlot.svelte.d.ts +3 -3
- package/dist/plot/BarPlotControls.svelte +3 -2
- package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
- package/dist/plot/ColorBar.svelte +54 -54
- package/dist/plot/ColorBar.svelte.d.ts +1 -1
- package/dist/plot/ElementScatter.svelte +4 -3
- package/dist/plot/FillArea.svelte +4 -1
- package/dist/plot/Histogram.svelte +320 -230
- package/dist/plot/Histogram.svelte.d.ts +2 -2
- package/dist/plot/HistogramControls.svelte +29 -10
- package/dist/plot/HistogramControls.svelte.d.ts +6 -2
- package/dist/plot/InteractiveAxisLabel.svelte.d.ts +2 -2
- package/dist/plot/PlotControls.svelte +109 -27
- package/dist/plot/PlotControls.svelte.d.ts +1 -1
- package/dist/plot/PlotLegend.svelte +1 -1
- package/dist/plot/PortalSelect.svelte +2 -1
- package/dist/plot/ReferenceLine.svelte +2 -1
- package/dist/plot/ReferenceLine.svelte.d.ts +1 -0
- package/dist/plot/ReferencePlane.svelte +1 -3
- package/dist/plot/ScatterPlot.svelte +343 -209
- package/dist/plot/ScatterPlot.svelte.d.ts +3 -3
- package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlot3DControls.svelte +203 -250
- package/dist/plot/ScatterPlot3DScene.svelte +4 -7
- package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlotControls.svelte +95 -55
- package/dist/plot/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/ZeroLines.svelte +44 -0
- package/dist/plot/ZeroLines.svelte.d.ts +32 -0
- package/dist/plot/ZoomRect.svelte +21 -0
- package/dist/plot/ZoomRect.svelte.d.ts +8 -0
- package/dist/plot/axis-utils.d.ts +1 -1
- package/dist/plot/data-cleaning.js +1 -5
- package/dist/plot/index.d.ts +6 -2
- package/dist/plot/index.js +6 -2
- package/dist/plot/interactions.d.ts +8 -10
- package/dist/plot/interactions.js +10 -19
- package/dist/plot/layout.d.ts +7 -1
- package/dist/plot/layout.js +12 -4
- package/dist/plot/reference-line.d.ts +4 -21
- package/dist/plot/reference-line.js +7 -81
- package/dist/plot/types.d.ts +42 -17
- package/dist/plot/types.js +10 -0
- package/dist/plot/utils/label-placement.js +14 -11
- package/dist/plot/utils.d.ts +1 -0
- package/dist/plot/utils.js +14 -0
- package/dist/rdf/RdfPlot.svelte +55 -66
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/index.d.ts +1 -1
- package/dist/rdf/index.js +1 -1
- package/dist/settings.d.ts +5 -0
- package/dist/settings.js +37 -3
- package/dist/spectral/Bands.svelte +515 -143
- package/dist/spectral/Bands.svelte.d.ts +22 -2
- package/dist/spectral/helpers.d.ts +23 -1
- package/dist/spectral/helpers.js +65 -9
- package/dist/spectral/types.d.ts +2 -0
- package/dist/structure/AtomLegend.svelte +31 -10
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/CellSelect.svelte +92 -22
- package/dist/structure/Lattice.svelte +2 -0
- package/dist/structure/Structure.svelte +716 -173
- package/dist/structure/Structure.svelte.d.ts +7 -2
- package/dist/structure/StructureControls.svelte +26 -14
- package/dist/structure/StructureControls.svelte.d.ts +5 -1
- package/dist/structure/StructureInfoPane.svelte +7 -1
- package/dist/structure/StructureScene.svelte +386 -95
- package/dist/structure/StructureScene.svelte.d.ts +15 -4
- package/dist/structure/atom-properties.d.ts +6 -2
- package/dist/structure/atom-properties.js +38 -25
- package/dist/structure/export.js +10 -7
- package/dist/structure/ferrox-wasm-types.d.ts +3 -2
- package/dist/structure/ferrox-wasm-types.js +0 -3
- package/dist/structure/ferrox-wasm.d.ts +3 -2
- package/dist/structure/ferrox-wasm.js +1 -2
- package/dist/structure/index.d.ts +7 -0
- package/dist/structure/index.js +22 -0
- package/dist/structure/parse.js +19 -16
- package/dist/structure/partial-occupancy.d.ts +25 -0
- package/dist/structure/partial-occupancy.js +102 -0
- package/dist/structure/validation.js +6 -3
- package/dist/symmetry/SymmetryStats.svelte +18 -4
- package/dist/symmetry/WyckoffTable.svelte +18 -10
- package/dist/symmetry/index.d.ts +7 -4
- package/dist/symmetry/index.js +83 -18
- package/dist/table/HeatmapTable.svelte +468 -69
- package/dist/table/HeatmapTable.svelte.d.ts +13 -1
- package/dist/table/ToggleMenu.svelte +291 -44
- package/dist/table/ToggleMenu.svelte.d.ts +4 -1
- package/dist/table/index.d.ts +3 -0
- package/dist/tooltip/index.d.ts +1 -1
- package/dist/tooltip/index.js +1 -0
- package/dist/trajectory/Trajectory.svelte +147 -145
- package/dist/trajectory/TrajectoryExportPane.svelte +13 -9
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +1 -1
- package/dist/trajectory/constants.d.ts +6 -0
- package/dist/trajectory/constants.js +7 -0
- package/dist/trajectory/extract.js +3 -5
- package/dist/trajectory/format-detect.d.ts +9 -0
- package/dist/trajectory/format-detect.js +76 -0
- package/dist/trajectory/frame-reader.d.ts +17 -0
- package/dist/trajectory/frame-reader.js +339 -0
- package/dist/trajectory/helpers.d.ts +15 -0
- package/dist/trajectory/helpers.js +187 -0
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +11 -4
- package/dist/trajectory/parse/ase.d.ts +2 -0
- package/dist/trajectory/parse/ase.js +76 -0
- package/dist/trajectory/parse/hdf5.d.ts +2 -0
- package/dist/trajectory/parse/hdf5.js +121 -0
- package/dist/trajectory/parse/index.d.ts +12 -0
- package/dist/trajectory/parse/index.js +304 -0
- package/dist/trajectory/parse/lammps.d.ts +5 -0
- package/dist/trajectory/parse/lammps.js +169 -0
- package/dist/trajectory/parse/vasp.d.ts +2 -0
- package/dist/trajectory/parse/vasp.js +65 -0
- package/dist/trajectory/parse/xyz.d.ts +2 -0
- package/dist/trajectory/parse/xyz.js +109 -0
- package/dist/trajectory/types.d.ts +11 -0
- package/dist/trajectory/types.js +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +4 -0
- package/dist/xrd/XrdPlot.svelte +6 -4
- package/dist/xrd/calc-xrd.js +0 -1
- package/package.json +33 -23
- package/readme.md +4 -4
- package/dist/trajectory/parse.d.ts +0 -42
- package/dist/trajectory/parse.js +0 -1267
- /package/dist/element/{data.json.d.ts → data.json.gz.d.ts} +0 -0
|
@@ -48,77 +48,7 @@ export function normalize_value(value) {
|
|
|
48
48
|
return 0;
|
|
49
49
|
}
|
|
50
50
|
// Normalize a point tuple
|
|
51
|
-
export
|
|
52
|
-
return [normalize_value(point[0]), normalize_value(point[1])];
|
|
53
|
-
}
|
|
54
|
-
// Create a horizontal reference line at y = value
|
|
55
|
-
export function horizontal_line(y_value, opts) {
|
|
56
|
-
return { type: `horizontal`, y: y_value, ...opts };
|
|
57
|
-
}
|
|
58
|
-
// Create a vertical reference line at x = value
|
|
59
|
-
export function vertical_line(x_value, opts) {
|
|
60
|
-
return { type: `vertical`, x: x_value, ...opts };
|
|
61
|
-
}
|
|
62
|
-
// Create a diagonal reference line with y = slope * x + intercept
|
|
63
|
-
export function diagonal_line(slope, intercept, opts) {
|
|
64
|
-
return { type: `diagonal`, slope, intercept, ...opts };
|
|
65
|
-
}
|
|
66
|
-
// Create a line segment between two points
|
|
67
|
-
export function line_segment(p1, p2, opts) {
|
|
68
|
-
return { type: `segment`, p1, p2, ...opts };
|
|
69
|
-
}
|
|
70
|
-
// Create a line through two points, extended to plot edges
|
|
71
|
-
export function line_through(p1, p2, opts) {
|
|
72
|
-
return { type: `line`, p1, p2, ...opts };
|
|
73
|
-
}
|
|
74
|
-
// Batch helper: create multiple horizontal lines
|
|
75
|
-
export function horizontal_lines(values, opts) {
|
|
76
|
-
return values.map((y_value) => horizontal_line(y_value, opts));
|
|
77
|
-
}
|
|
78
|
-
// Batch helper: create multiple vertical lines
|
|
79
|
-
export function vertical_lines(values, opts) {
|
|
80
|
-
return values.map((x_value) => vertical_line(x_value, opts));
|
|
81
|
-
}
|
|
82
|
-
// Create an XY plane at z = value (horizontal plane)
|
|
83
|
-
export function plane_xy(z_value, opts) {
|
|
84
|
-
return { type: `xy`, z: z_value, ...opts };
|
|
85
|
-
}
|
|
86
|
-
// Create an XZ plane at y = value
|
|
87
|
-
export function plane_xz(y_value, opts) {
|
|
88
|
-
return { type: `xz`, y: y_value, ...opts };
|
|
89
|
-
}
|
|
90
|
-
// Create a YZ plane at x = value
|
|
91
|
-
export function plane_yz(x_value, opts) {
|
|
92
|
-
return { type: `yz`, x: x_value, ...opts };
|
|
93
|
-
}
|
|
94
|
-
// Create a plane defined by normal vector and a point on the plane
|
|
95
|
-
export function plane_normal(normal, point, opts) {
|
|
96
|
-
return { type: `normal`, normal, point, ...opts };
|
|
97
|
-
}
|
|
98
|
-
// Create a plane through three points
|
|
99
|
-
export function plane_through_points(p1, p2, p3, opts) {
|
|
100
|
-
return { type: `points`, p1, p2, p3, ...opts };
|
|
101
|
-
}
|
|
102
|
-
// Create a 3D line parallel to x-axis at given y, z
|
|
103
|
-
export function line_x_axis(y_value, z_value, opts) {
|
|
104
|
-
return { type: `x-axis`, y: y_value, z: z_value, ...opts };
|
|
105
|
-
}
|
|
106
|
-
// Create a 3D line parallel to y-axis at given x, z
|
|
107
|
-
export function line_y_axis(x_value, z_value, opts) {
|
|
108
|
-
return { type: `y-axis`, x: x_value, z: z_value, ...opts };
|
|
109
|
-
}
|
|
110
|
-
// Create a 3D line parallel to z-axis at given x, y
|
|
111
|
-
export function line_z_axis(x_value, y_value, opts) {
|
|
112
|
-
return { type: `z-axis`, x: x_value, y: y_value, ...opts };
|
|
113
|
-
}
|
|
114
|
-
// Create a 3D line segment between two points
|
|
115
|
-
export function line_segment_3d(p1, p2, opts) {
|
|
116
|
-
return { type: `segment`, p1, p2, ...opts };
|
|
117
|
-
}
|
|
118
|
-
// Create a 3D line through two points, extended to bounds
|
|
119
|
-
export function line_through_3d(p1, p2, opts) {
|
|
120
|
-
return { type: `line`, p1, p2, ...opts };
|
|
121
|
-
}
|
|
51
|
+
export const normalize_point = (point) => [normalize_value(point[0]), normalize_value(point[1])];
|
|
122
52
|
// Clip a line segment to a rectangle using Liang-Barsky algorithm
|
|
123
53
|
// Returns clipped [x1, y1, x2, y2] or null if segment is entirely outside
|
|
124
54
|
function clip_segment_to_rect(p1x, p1y, p2x, p2y, x_min, x_max, y_min, y_max) {
|
|
@@ -147,17 +77,13 @@ function clip_segment_to_rect(p1x, p1y, p2x, p2y, x_min, x_max, y_min, y_max) {
|
|
|
147
77
|
}
|
|
148
78
|
if (t_enter > t_leave)
|
|
149
79
|
return null; // Segment entirely outside
|
|
150
|
-
return [
|
|
151
|
-
p1x + t_enter * dx,
|
|
152
|
-
p1y + t_enter * dy,
|
|
153
|
-
p1x + t_leave * dx,
|
|
154
|
-
p1y + t_leave * dy,
|
|
155
|
-
];
|
|
80
|
+
return [p1x + t_enter * dx, p1y + t_enter * dy, p1x + t_leave * dx, p1y + t_leave * dy];
|
|
156
81
|
}
|
|
157
82
|
// Compute the screen coordinates for a reference line
|
|
158
83
|
// Returns [x1, y1, x2, y2] in pixel coordinates, or null if line is not visible
|
|
159
|
-
export function resolve_line_endpoints(ref_line, { x_min, x_max, y_min, y_max }, { x_scale, y_scale, y2_scale }) {
|
|
160
|
-
// Determine which
|
|
84
|
+
export function resolve_line_endpoints(ref_line, { x_min, x_max, y_min, y_max }, { x_scale, x2_scale, y_scale, y2_scale }) {
|
|
85
|
+
// Determine which scales to use based on axis assignment
|
|
86
|
+
const active_x_scale = ref_line.x_axis === `x2` && x2_scale ? x2_scale : x_scale;
|
|
161
87
|
const active_y_scale = ref_line.y_axis === `y2` && y2_scale ? y2_scale : y_scale;
|
|
162
88
|
// Check if value is within plot bounds (for visibility)
|
|
163
89
|
const is_x_visible = (x_val) => x_val >= x_min && x_val <= x_max;
|
|
@@ -273,9 +199,9 @@ export function resolve_line_endpoints(ref_line, { x_min, x_max, y_min, y_max },
|
|
|
273
199
|
return null;
|
|
274
200
|
}
|
|
275
201
|
// Convert data coordinates to screen pixels
|
|
276
|
-
const x1_px =
|
|
202
|
+
const x1_px = active_x_scale(x1_data);
|
|
277
203
|
const y1_px = active_y_scale(y1_data);
|
|
278
|
-
const x2_px =
|
|
204
|
+
const x2_px = active_x_scale(x2_data);
|
|
279
205
|
const y2_px = active_y_scale(y2_data);
|
|
280
206
|
// Validate that pixels are finite
|
|
281
207
|
if (!isFinite(x1_px) || !isFinite(y1_px) || !isFinite(x2_px) || !isFinite(y2_px)) {
|
package/dist/plot/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { D3SymbolName } from '../labels';
|
|
2
|
-
import type { Vec3 } from '../math';
|
|
2
|
+
import type { Vec2, Vec3 } from '../math';
|
|
3
3
|
import type DraggablePane from '../overlays/DraggablePane.svelte';
|
|
4
4
|
import type { SimulationNodeDatum } from 'd3-force';
|
|
5
5
|
import type { ComponentProps, Snippet } from 'svelte';
|
|
@@ -27,6 +27,12 @@ export type Sides = {
|
|
|
27
27
|
l?: number;
|
|
28
28
|
r?: number;
|
|
29
29
|
};
|
|
30
|
+
export type InitialRanges = {
|
|
31
|
+
initial_x_range: Vec2;
|
|
32
|
+
initial_x2_range: Vec2;
|
|
33
|
+
initial_y_range: Vec2;
|
|
34
|
+
initial_y2_range: Vec2;
|
|
35
|
+
};
|
|
30
36
|
export type Point<Metadata = Record<string, unknown>> = {
|
|
31
37
|
x: number;
|
|
32
38
|
y: number;
|
|
@@ -93,6 +99,7 @@ export interface DataSeries<Metadata = Record<string, unknown>> {
|
|
|
93
99
|
x: readonly number[];
|
|
94
100
|
y: readonly number[];
|
|
95
101
|
markers?: Markers;
|
|
102
|
+
x_axis?: `x1` | `x2`;
|
|
96
103
|
y_axis?: `y1` | `y2`;
|
|
97
104
|
color_values?: (number | null)[] | null;
|
|
98
105
|
size_values?: readonly (number | null)[] | null;
|
|
@@ -138,6 +145,7 @@ export interface HandlerProps<Metadata = Record<string, unknown>> {
|
|
|
138
145
|
label?: string | null;
|
|
139
146
|
series_idx: number;
|
|
140
147
|
x_axis: AxisConfig;
|
|
148
|
+
x2_axis?: AxisConfig;
|
|
141
149
|
y_axis: AxisConfig;
|
|
142
150
|
y2_axis?: AxisConfig;
|
|
143
151
|
fullscreen?: boolean;
|
|
@@ -164,13 +172,16 @@ export interface BarHandlerProps<Metadata = Record<string, unknown>> extends Han
|
|
|
164
172
|
orient_x: number;
|
|
165
173
|
orient_y: number;
|
|
166
174
|
active_y_axis: `y1` | `y2`;
|
|
175
|
+
active_x_axis: `x1` | `x2`;
|
|
167
176
|
color: string;
|
|
177
|
+
category_label?: string;
|
|
168
178
|
}
|
|
169
179
|
export interface HistogramHandlerProps<Metadata = Record<string, unknown>> extends HandlerProps<Metadata> {
|
|
170
180
|
value: number;
|
|
171
181
|
count: number;
|
|
172
182
|
property: string;
|
|
173
183
|
active_y_axis: `y1` | `y2`;
|
|
184
|
+
active_x_axis: `x1` | `x2`;
|
|
174
185
|
}
|
|
175
186
|
export type TimeInterval = `day` | `month` | `year`;
|
|
176
187
|
export type ScaleTypeName = `linear` | `log` | `arcsinh` | `time`;
|
|
@@ -179,6 +190,7 @@ export interface ArcsinhScaleConfig {
|
|
|
179
190
|
threshold?: number;
|
|
180
191
|
}
|
|
181
192
|
export type ScaleType = `linear` | `log` | `arcsinh` | `time` | ArcsinhScaleConfig;
|
|
193
|
+
export declare function is_scale_type_name(val: string): val is ScaleTypeName;
|
|
182
194
|
export declare function get_scale_type_name(scale_type: ScaleType | undefined): ScaleTypeName;
|
|
183
195
|
export declare function get_arcsinh_threshold(scale_type: ScaleType | undefined): number;
|
|
184
196
|
export declare function is_time_scale(scale_type: ScaleType | undefined, format: string | undefined): boolean;
|
|
@@ -246,19 +258,21 @@ export type UserContentProps = {
|
|
|
246
258
|
height: number;
|
|
247
259
|
width: number;
|
|
248
260
|
x_scale_fn: (x: number) => number;
|
|
261
|
+
x2_scale_fn?: (x: number) => number;
|
|
249
262
|
y_scale_fn: (y: number) => number;
|
|
250
263
|
y2_scale_fn?: (y: number) => number;
|
|
251
264
|
pad: Required<Sides>;
|
|
252
|
-
x_range:
|
|
253
|
-
|
|
254
|
-
|
|
265
|
+
x_range: Vec2;
|
|
266
|
+
x2_range?: Vec2;
|
|
267
|
+
y_range: Vec2;
|
|
268
|
+
y2_range?: Vec2;
|
|
255
269
|
fullscreen: boolean;
|
|
256
270
|
};
|
|
257
271
|
export type Orientation = `vertical` | `horizontal`;
|
|
258
272
|
export type BarMode = `overlay` | `stacked` | `grouped`;
|
|
259
273
|
export interface BarSeries<Metadata = Record<string, unknown>> {
|
|
260
274
|
id?: string | number;
|
|
261
|
-
x: readonly number[];
|
|
275
|
+
x: readonly (number | string)[];
|
|
262
276
|
y: readonly number[];
|
|
263
277
|
label?: string;
|
|
264
278
|
legend_group?: string;
|
|
@@ -268,6 +282,7 @@ export interface BarSeries<Metadata = Record<string, unknown>> {
|
|
|
268
282
|
metadata?: Metadata[] | Metadata;
|
|
269
283
|
labels?: readonly (string | null | undefined)[];
|
|
270
284
|
render_mode?: `bar` | `line`;
|
|
285
|
+
x_axis?: `x1` | `x2`;
|
|
271
286
|
y_axis?: `y1` | `y2`;
|
|
272
287
|
line_style?: {
|
|
273
288
|
stroke_width?: number;
|
|
@@ -295,6 +310,7 @@ export interface AxisOption {
|
|
|
295
310
|
unit?: string;
|
|
296
311
|
}
|
|
297
312
|
export type Y2SyncMode = `none` | `synced` | `align`;
|
|
313
|
+
export declare function is_y2_sync_mode(val: string): val is Y2SyncMode;
|
|
298
314
|
export interface Y2SyncConfig {
|
|
299
315
|
mode: Y2SyncMode;
|
|
300
316
|
align_value?: number;
|
|
@@ -313,6 +329,7 @@ export interface AxisConfig {
|
|
|
313
329
|
options?: AxisOption[];
|
|
314
330
|
selected_key?: string;
|
|
315
331
|
sync?: Y2SyncConfig | Y2SyncMode;
|
|
332
|
+
categories?: readonly string[];
|
|
316
333
|
}
|
|
317
334
|
export interface DataLoaderResult<Metadata = Record<string, unknown>, SeriesType = DataSeries<Metadata>> {
|
|
318
335
|
series: SeriesType[];
|
|
@@ -331,15 +348,18 @@ export interface ColorScaleOption {
|
|
|
331
348
|
scale: string | ((t: number) => string);
|
|
332
349
|
}
|
|
333
350
|
export type ColorBarDataLoaderFn = (property_key: string) => Promise<{
|
|
334
|
-
range:
|
|
351
|
+
range: Vec2;
|
|
335
352
|
title?: string;
|
|
336
353
|
}>;
|
|
337
354
|
export interface DisplayConfig {
|
|
338
355
|
x_grid?: boolean;
|
|
356
|
+
x2_grid?: boolean;
|
|
339
357
|
y_grid?: boolean;
|
|
340
358
|
y2_grid?: boolean;
|
|
341
359
|
x_zero_line?: boolean;
|
|
360
|
+
x2_zero_line?: boolean;
|
|
342
361
|
y_zero_line?: boolean;
|
|
362
|
+
y2_zero_line?: boolean;
|
|
343
363
|
}
|
|
344
364
|
export interface StyleOverrides {
|
|
345
365
|
point?: {
|
|
@@ -359,9 +379,10 @@ export interface StyleOverrides {
|
|
|
359
379
|
show_points?: boolean;
|
|
360
380
|
show_lines?: boolean;
|
|
361
381
|
}
|
|
362
|
-
export type AxisKey = `x` | `y` | `y2`;
|
|
382
|
+
export type AxisKey = `x` | `x2` | `y` | `y2`;
|
|
363
383
|
export interface PlotConfig {
|
|
364
384
|
x_axis?: AxisConfig;
|
|
385
|
+
x2_axis?: AxisConfig;
|
|
365
386
|
y_axis?: AxisConfig;
|
|
366
387
|
y2_axis?: AxisConfig;
|
|
367
388
|
display?: DisplayConfig;
|
|
@@ -388,9 +409,11 @@ export interface PlotControlsProps extends PlotConfig {
|
|
|
388
409
|
controls_open?: boolean;
|
|
389
410
|
children?: Snippet<[ControlsState]>;
|
|
390
411
|
post_children?: Snippet<[ControlsState]>;
|
|
391
|
-
auto_x_range?:
|
|
392
|
-
|
|
393
|
-
|
|
412
|
+
auto_x_range?: Vec2;
|
|
413
|
+
auto_x2_range?: Vec2;
|
|
414
|
+
auto_y_range?: Vec2;
|
|
415
|
+
auto_y2_range?: Vec2;
|
|
416
|
+
has_x2_points?: boolean;
|
|
394
417
|
has_y2_points?: boolean;
|
|
395
418
|
show_ticks?: boolean;
|
|
396
419
|
controls_title?: string;
|
|
@@ -400,6 +423,7 @@ export interface PlotControlsProps extends PlotConfig {
|
|
|
400
423
|
}
|
|
401
424
|
export interface BasePlotProps {
|
|
402
425
|
x_range?: [number | null, number | null];
|
|
426
|
+
x2_range?: [number | null, number | null];
|
|
403
427
|
y_range?: [number | null, number | null];
|
|
404
428
|
y2_range?: [number | null, number | null];
|
|
405
429
|
range_padding?: number;
|
|
@@ -457,12 +481,12 @@ export type SurfaceType = `grid` | `parametric` | `triangulated`;
|
|
|
457
481
|
export interface Surface3DConfig {
|
|
458
482
|
id?: string | number;
|
|
459
483
|
type: SurfaceType;
|
|
460
|
-
x_range?:
|
|
461
|
-
y_range?:
|
|
462
|
-
resolution?: number |
|
|
484
|
+
x_range?: Vec2;
|
|
485
|
+
y_range?: Vec2;
|
|
486
|
+
resolution?: number | Vec2;
|
|
463
487
|
z_fn?: (x: number, y: number) => number;
|
|
464
|
-
u_range?:
|
|
465
|
-
v_range?:
|
|
488
|
+
u_range?: Vec2;
|
|
489
|
+
v_range?: Vec2;
|
|
466
490
|
parametric_fn?: (u: number, v: number) => XyzObj;
|
|
467
491
|
points?: XyzObj[];
|
|
468
492
|
triangles?: Vec3[];
|
|
@@ -541,7 +565,7 @@ export type FillBoundary = {
|
|
|
541
565
|
value: number;
|
|
542
566
|
} | {
|
|
543
567
|
type: `axis`;
|
|
544
|
-
axis: `x` | `y` | `y2`;
|
|
568
|
+
axis: `x` | `x2` | `y` | `y2`;
|
|
545
569
|
value?: number;
|
|
546
570
|
} | {
|
|
547
571
|
type: `function`;
|
|
@@ -664,6 +688,7 @@ export interface RefLineBase {
|
|
|
664
688
|
x_span?: [number | null, number | null];
|
|
665
689
|
y_span?: [number | null, number | null];
|
|
666
690
|
coord_mode?: `data` | `relative`;
|
|
691
|
+
x_axis?: `x1` | `x2`;
|
|
667
692
|
y_axis?: `y1` | `y2`;
|
|
668
693
|
style?: RefLineStyle;
|
|
669
694
|
annotation?: RefLineAnnotation;
|
|
@@ -830,7 +855,7 @@ export interface CleaningQuality {
|
|
|
830
855
|
oscillation_score?: number;
|
|
831
856
|
bounds_violations: number;
|
|
832
857
|
outliers_removed?: number;
|
|
833
|
-
stable_range?:
|
|
858
|
+
stable_range?: Vec2;
|
|
834
859
|
truncated_at_x?: number;
|
|
835
860
|
}
|
|
836
861
|
export interface CleaningResult<T = DataSeries> {
|
package/dist/plot/types.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// Type guard for select value narrowing (avoids unsafe casts)
|
|
2
|
+
const SCALE_TYPE_NAMES = [`linear`, `log`, `arcsinh`, `time`];
|
|
3
|
+
export function is_scale_type_name(val) {
|
|
4
|
+
return SCALE_TYPE_NAMES.includes(val);
|
|
5
|
+
}
|
|
1
6
|
// Helper to normalize ScaleType to base type name
|
|
2
7
|
export function get_scale_type_name(scale_type) {
|
|
3
8
|
if (!scale_type)
|
|
@@ -27,6 +32,11 @@ export function is_time_scale(scale_type, format) {
|
|
|
27
32
|
// Fallback: d3 time format strings start with '%'
|
|
28
33
|
return format?.startsWith(`%`) ?? false;
|
|
29
34
|
}
|
|
35
|
+
// Type guard for select value narrowing (avoids unsafe casts)
|
|
36
|
+
const Y2_SYNC_MODES = [`none`, `synced`, `align`];
|
|
37
|
+
export function is_y2_sync_mode(val) {
|
|
38
|
+
return Y2_SYNC_MODES.includes(val);
|
|
39
|
+
}
|
|
30
40
|
export const LINE_TYPES = [`solid`, `dashed`, `dotted`];
|
|
31
41
|
// Define grid cell identifiers
|
|
32
42
|
export const CELLS_3X3 = [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { is_time_scale } from '../types';
|
|
2
2
|
import { forceCollide, forceLink, forceManyBody, forceSimulation } from 'd3-force';
|
|
3
|
+
const is_label_node = (node) => `label_width` in node;
|
|
3
4
|
function parse_font_size(size_str) {
|
|
4
5
|
if (!size_str)
|
|
5
6
|
return 12;
|
|
@@ -48,18 +49,20 @@ export function compute_label_positions(filtered_series, config, scales, bounds)
|
|
|
48
49
|
return Object.fromEntries(label_nodes.map((n) => [n.id, { x: n.x ?? 0, y: n.y ?? 0 }]));
|
|
49
50
|
}
|
|
50
51
|
const sim = forceSimulation([...label_nodes, ...anchor_nodes])
|
|
51
|
-
.force(`link`, forceLink(links)
|
|
52
|
+
.force(`link`, forceLink(links)
|
|
53
|
+
.id((node) => node.id)
|
|
54
|
+
.distance(config.link_distance)
|
|
52
55
|
.strength(config.link_strength))
|
|
53
|
-
.force(`collide`, forceCollide().radius((
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
: (a.point_radius ?? 0) + 2;
|
|
56
|
+
.force(`collide`, forceCollide().radius((node) => {
|
|
57
|
+
if (is_label_node(node)) {
|
|
58
|
+
return Math.sqrt(node.label_width ** 2 + node.label_height ** 2) / 2 + 2;
|
|
59
|
+
}
|
|
60
|
+
return node.point_radius + 2;
|
|
59
61
|
}).strength(config.collision_strength))
|
|
60
|
-
.force(`charge`, forceManyBody().strength((
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
.force(`charge`, forceManyBody().strength((node) => {
|
|
63
|
+
if (is_label_node(node))
|
|
64
|
+
return 0;
|
|
65
|
+
return node.point_radius !== undefined && node.fx !== undefined
|
|
63
66
|
? -(config.charge_strength ?? 50)
|
|
64
67
|
: 0;
|
|
65
68
|
}).distanceMax(config.charge_distance_max ?? 30));
|
|
@@ -74,7 +77,7 @@ export function compute_label_positions(filtered_series, config, scales, bounds)
|
|
|
74
77
|
if (min_dist || max_dist) {
|
|
75
78
|
const dx = x - node.anchor_x;
|
|
76
79
|
const dy = y - node.anchor_y;
|
|
77
|
-
const dist = Math.
|
|
80
|
+
const dist = Math.hypot(dx, dy);
|
|
78
81
|
if (max_dist && dist > max_dist) {
|
|
79
82
|
const s = max_dist / dist;
|
|
80
83
|
x = node.anchor_x + dx * s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function calc_auto_range(values: number[]): [number, number];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function calc_auto_range(values) {
|
|
2
|
+
const finite_values = values.filter(Number.isFinite);
|
|
3
|
+
if (finite_values.length === 0)
|
|
4
|
+
return [0, 1];
|
|
5
|
+
let [min_value, max_value] = [finite_values[0], finite_values[0]];
|
|
6
|
+
for (const value of finite_values) {
|
|
7
|
+
if (value < min_value)
|
|
8
|
+
min_value = value;
|
|
9
|
+
else if (value > max_value)
|
|
10
|
+
max_value = value;
|
|
11
|
+
}
|
|
12
|
+
const padding = (max_value - min_value) * 0.05 || 0.5;
|
|
13
|
+
return [min_value - padding, max_value + padding];
|
|
14
|
+
}
|
package/dist/rdf/RdfPlot.svelte
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">import { PLOT_COLORS } from '../colors';
|
|
2
2
|
import { get_electro_neg_formula } from '../composition';
|
|
3
3
|
import { StatusMessage } from '../feedback';
|
|
4
|
-
import {
|
|
4
|
+
import { create_file_drop_handler } from '../io';
|
|
5
5
|
import { ScatterPlot } from '../plot';
|
|
6
6
|
import { parse_any_structure } from '../structure/parse';
|
|
7
7
|
import { is_crystal } from '../structure/validation';
|
|
@@ -11,47 +11,40 @@ function format_structure_label(struct, label_base) {
|
|
|
11
11
|
const formula = get_electro_neg_formula(struct);
|
|
12
12
|
return formula && label_base ? `${formula}: ${label_base}` : formula || label_base;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
dragging = false;
|
|
17
|
-
if (!enable_drop)
|
|
18
|
-
return;
|
|
19
|
-
loading = true;
|
|
20
|
-
error_msg = undefined;
|
|
21
|
-
const compute_and_add = (content, filename) => {
|
|
22
|
-
try {
|
|
23
|
-
const text = content instanceof ArrayBuffer
|
|
24
|
-
? new TextDecoder().decode(content)
|
|
25
|
-
: content;
|
|
26
|
-
const parsed_struct = parse_any_structure(text, filename);
|
|
27
|
-
if (is_crystal(parsed_struct)) {
|
|
28
|
-
drag_dropped = [...drag_dropped, parsed_struct];
|
|
29
|
-
}
|
|
30
|
-
else
|
|
31
|
-
error_msg = `Crystal has no lattice or sites; cannot compute RDF`;
|
|
32
|
-
}
|
|
33
|
-
catch (exc) {
|
|
34
|
-
error_msg = `Failed to process structure: ${exc instanceof Error ? exc.message : String(exc)}`;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
14
|
+
const compute_and_add = (content, filename) => {
|
|
37
15
|
try {
|
|
38
|
-
const
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
16
|
+
const text = content instanceof ArrayBuffer
|
|
17
|
+
? new TextDecoder().decode(content)
|
|
18
|
+
: content;
|
|
19
|
+
const parsed_struct = parse_any_structure(text, filename);
|
|
20
|
+
if (is_crystal(parsed_struct)) {
|
|
21
|
+
drag_dropped = [...drag_dropped, parsed_struct];
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
error_msg = `Crystal has no lattice or sites; cannot compute RDF`;
|
|
47
25
|
}
|
|
48
26
|
}
|
|
49
27
|
catch (exc) {
|
|
50
|
-
error_msg = `Failed to
|
|
51
|
-
}
|
|
52
|
-
finally {
|
|
53
|
-
loading = false;
|
|
28
|
+
error_msg = `Failed to process structure: ${exc instanceof Error ? exc.message : String(exc)}`;
|
|
54
29
|
}
|
|
30
|
+
};
|
|
31
|
+
const handle_drop = create_file_drop_handler({
|
|
32
|
+
allow: () => enable_drop,
|
|
33
|
+
on_drop: (content, filename) => (on_file_drop || compute_and_add)(content, filename),
|
|
34
|
+
on_error: (msg) => {
|
|
35
|
+
error_msg = msg;
|
|
36
|
+
},
|
|
37
|
+
set_loading: (val) => {
|
|
38
|
+
loading = val;
|
|
39
|
+
if (val)
|
|
40
|
+
[error_msg, dragging] = [undefined, false];
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
function handle_dragover(ev) {
|
|
44
|
+
ev.preventDefault();
|
|
45
|
+
if (ev.dataTransfer)
|
|
46
|
+
ev.dataTransfer.dropEffect = `copy`;
|
|
47
|
+
dragging = true;
|
|
55
48
|
}
|
|
56
49
|
const entries = $derived.by(() => {
|
|
57
50
|
const result = [];
|
|
@@ -127,11 +120,20 @@ const series = $derived(entries.map((ent, idx) => ({
|
|
|
127
120
|
{/if}
|
|
128
121
|
|
|
129
122
|
{#if series.length === 0}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
124
|
+
<div
|
|
125
|
+
class="empty-drop {dragging ? `dragging` : ``}"
|
|
126
|
+
ondragover={enable_drop ? handle_dragover : undefined}
|
|
127
|
+
ondragleave={enable_drop ? () => (dragging = false) : undefined}
|
|
128
|
+
ondrop={enable_drop ? handle_drop : undefined}
|
|
129
|
+
>
|
|
130
|
+
<StatusMessage
|
|
131
|
+
message={enable_drop
|
|
132
|
+
? `Drag and drop structure files here to visualize RDFs`
|
|
133
|
+
: `No RDF data to display`}
|
|
134
|
+
style="border: none"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
135
137
|
{:else}
|
|
136
138
|
<ScatterPlot
|
|
137
139
|
{...rest}
|
|
@@ -139,15 +141,9 @@ const series = $derived(entries.map((ent, idx) => ({
|
|
|
139
141
|
x_axis={{ label: `r (Å)`, range: [0, max_r], ...x_axis }}
|
|
140
142
|
y_axis={{ label: `g(r)`, range: [0, max_g * 1.05], ...y_axis }}
|
|
141
143
|
styles={{ show_lines: true, show_points: false }}
|
|
142
|
-
class={
|
|
144
|
+
class="{rest.class ?? ``} {dragging ? `dragging` : ``}"
|
|
143
145
|
style={rest.style ?? `height: 400px;`}
|
|
144
|
-
ondragover={enable_drop
|
|
145
|
-
? (ev) => {
|
|
146
|
-
ev.preventDefault()
|
|
147
|
-
if (ev.dataTransfer) ev.dataTransfer.dropEffect = `copy`
|
|
148
|
-
dragging = true
|
|
149
|
-
}
|
|
150
|
-
: undefined}
|
|
146
|
+
ondragover={enable_drop ? handle_dragover : undefined}
|
|
151
147
|
ondragleave={enable_drop ? () => (dragging = false) : undefined}
|
|
152
148
|
ondrop={enable_drop ? handle_drop : undefined}
|
|
153
149
|
>
|
|
@@ -155,22 +151,10 @@ const series = $derived(entries.map((ent, idx) => ({
|
|
|
155
151
|
{#if show_reference_line}
|
|
156
152
|
{@const y1 = y_scale_fn(1)}
|
|
157
153
|
{#if isFinite(y1)}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
y2={y1}
|
|
163
|
-
stroke="gray"
|
|
164
|
-
stroke-dasharray="4"
|
|
165
|
-
opacity="0.5"
|
|
166
|
-
/>
|
|
167
|
-
<text
|
|
168
|
-
x={width - pad.r - 5}
|
|
169
|
-
y={y1 - 5}
|
|
170
|
-
text-anchor="end"
|
|
171
|
-
fill="gray"
|
|
172
|
-
font-size="0.8em"
|
|
173
|
-
>
|
|
154
|
+
{@const [x1, x2] = [pad.l, width - pad.r]}
|
|
155
|
+
{@const [x, y] = [width - pad.r - 5, y1 - 5]}
|
|
156
|
+
<line {x1} {x2} {y1} y2={y1} stroke="gray" stroke-dasharray="4" opacity="0.5" />
|
|
157
|
+
<text {x} {y} text-anchor="end" fill="gray" font-size="0.8em">
|
|
174
158
|
g(r) = 1
|
|
175
159
|
</text>
|
|
176
160
|
{/if}
|
|
@@ -186,6 +170,11 @@ const series = $derived(entries.map((ent, idx) => ({
|
|
|
186
170
|
outline: 2px dashed #4e79a7;
|
|
187
171
|
outline-offset: 4px;
|
|
188
172
|
}
|
|
173
|
+
.empty-drop {
|
|
174
|
+
outline: 2px dashed #ccc;
|
|
175
|
+
border-radius: var(--border-radius, 3pt);
|
|
176
|
+
text-align: center;
|
|
177
|
+
}
|
|
189
178
|
.dropped-info {
|
|
190
179
|
padding: 0.5em;
|
|
191
180
|
margin-bottom: 0.5em;
|
|
@@ -22,6 +22,6 @@ type $$ComponentProps = {
|
|
|
22
22
|
drag_dropped?: Crystal[];
|
|
23
23
|
dragging?: boolean;
|
|
24
24
|
} & ComponentProps<typeof ScatterPlot>;
|
|
25
|
-
declare const RdfPlot: import("svelte").Component<$$ComponentProps, {}, "loading" | "error_msg" | "
|
|
25
|
+
declare const RdfPlot: import("svelte").Component<$$ComponentProps, {}, "loading" | "error_msg" | "dragging" | "drag_dropped">;
|
|
26
26
|
type RdfPlot = ReturnType<typeof RdfPlot>;
|
|
27
27
|
export default RdfPlot;
|
package/dist/rdf/index.d.ts
CHANGED
package/dist/rdf/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './calc-rdf';
|
|
2
2
|
export { default as RdfPlot } from './RdfPlot.svelte';
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ColorScaleType, D3InterpolateName } from './colors';
|
|
2
|
+
import type { HullFaceColorMode } from './convex-hull/types';
|
|
2
3
|
import type { D3SymbolName } from './labels';
|
|
3
4
|
import type { Vec3 } from './math';
|
|
4
5
|
import type { Orientation } from './plot';
|
|
@@ -49,6 +50,7 @@ type LineStyleType = {
|
|
|
49
50
|
type SimpleBarStyleType = {
|
|
50
51
|
color: SettingType<string>;
|
|
51
52
|
opacity: SettingType<number>;
|
|
53
|
+
border_radius: SettingType<number>;
|
|
52
54
|
};
|
|
53
55
|
type SimpleLineStyleType = {
|
|
54
56
|
width: SettingType<number>;
|
|
@@ -74,6 +76,7 @@ type ConvexHullWith3DType = ConvexHullCommonType & {
|
|
|
74
76
|
show_hull_faces: SettingType<boolean>;
|
|
75
77
|
hull_face_color: SettingType<string>;
|
|
76
78
|
hull_face_opacity: SettingType<number>;
|
|
79
|
+
hull_face_color_mode: SettingType<HullFaceColorMode>;
|
|
77
80
|
};
|
|
78
81
|
export interface SettingsConfig {
|
|
79
82
|
color_scheme: SettingType<string>;
|
|
@@ -176,9 +179,11 @@ export interface SettingsConfig {
|
|
|
176
179
|
show_x_zero_line: SettingType<boolean>;
|
|
177
180
|
show_y_zero_line: SettingType<boolean>;
|
|
178
181
|
show_x_grid: SettingType<boolean>;
|
|
182
|
+
show_x2_grid: SettingType<boolean>;
|
|
179
183
|
show_y_grid: SettingType<boolean>;
|
|
180
184
|
show_y2_grid: SettingType<boolean>;
|
|
181
185
|
x_format: SettingType<string>;
|
|
186
|
+
x2_format: SettingType<string>;
|
|
182
187
|
y_format: SettingType<string>;
|
|
183
188
|
y2_format: SettingType<string>;
|
|
184
189
|
x_scale_type: SettingType<string>;
|