matterviz 0.3.7 → 0.4.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/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +1 -1
- package/dist/api/optimade.js +32 -26
- package/dist/app.css +0 -3
- package/dist/brillouin/BrillouinZone.svelte +8 -3
- package/dist/brillouin/BrillouinZone.svelte.d.ts +2 -1
- package/dist/brillouin/BrillouinZoneScene.svelte +52 -6
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -0
- package/dist/brillouin/BrillouinZoneTooltip.svelte +16 -25
- package/dist/brillouin/compute.js +10 -14
- package/dist/chempot-diagram/ChemPotDiagram.svelte +14 -13
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +12 -15
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +8 -10
- package/dist/chempot-diagram/async-compute.svelte.js +3 -1
- package/dist/chempot-diagram/chempot-worker.js +2 -1
- package/dist/chempot-diagram/compute.d.ts +1 -1
- package/dist/chempot-diagram/compute.js +17 -19
- package/dist/colors/index.js +6 -5
- package/dist/composition/FormulaFilter.svelte +12 -6
- package/dist/composition/PieChart.svelte +6 -5
- package/dist/composition/chem-sys.d.ts +8 -0
- package/dist/composition/chem-sys.js +85 -0
- package/dist/composition/format.js +4 -2
- package/dist/composition/index.d.ts +1 -0
- package/dist/composition/index.js +1 -0
- package/dist/composition/parse.js +25 -13
- package/dist/convex-hull/ConvexHull2D.svelte +12 -10
- package/dist/convex-hull/ConvexHull3D.svelte +5 -5
- package/dist/convex-hull/ConvexHull4D.svelte +5 -9
- package/dist/convex-hull/ConvexHullStats.svelte +12 -12
- package/dist/convex-hull/GasPressureControls.svelte +4 -4
- package/dist/convex-hull/TemperatureSlider.svelte +2 -2
- package/dist/convex-hull/demo-temperature.d.ts +1 -1
- package/dist/convex-hull/demo-temperature.js +20 -22
- package/dist/convex-hull/gas-thermodynamics.d.ts +2 -2
- package/dist/convex-hull/gas-thermodynamics.js +22 -30
- package/dist/convex-hull/helpers.d.ts +3 -0
- package/dist/convex-hull/helpers.js +17 -9
- package/dist/convex-hull/index.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +83 -78
- package/dist/convex-hull/types.d.ts +1 -1
- package/dist/coordination/CoordinationBarPlot.svelte +23 -23
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/element/ElementTile.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSlice.svelte +13 -5
- package/dist/fermi-surface/FermiSurface.svelte +11 -5
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +3 -0
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +8 -34
- package/dist/fermi-surface/compute.js +59 -59
- package/dist/fermi-surface/export.js +3 -2
- package/dist/fermi-surface/parse.js +7 -4
- package/dist/fermi-surface/types.d.ts +1 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +23 -21
- package/dist/heatmap-matrix/index.js +1 -1
- package/dist/io/decompress.js +4 -2
- package/dist/io/export.d.ts +4 -4
- package/dist/io/export.js +47 -25
- package/dist/io/fetch.js +5 -1
- package/dist/io/file-drop.d.ts +1 -1
- package/dist/io/file-drop.js +35 -36
- package/dist/io/url-drop.js +64 -33
- package/dist/isosurface/parse.js +6 -7
- package/dist/isosurface/slice.js +5 -4
- package/dist/isosurface/types.js +1 -1
- package/dist/keyboard.d.ts +3 -0
- package/dist/keyboard.js +23 -0
- package/dist/labels.d.ts +1 -1
- package/dist/labels.js +8 -7
- package/dist/layout/PropertyFilter.svelte +3 -2
- package/dist/layout/SettingsSection.svelte +1 -1
- package/dist/layout/json-tree/JsonNode.svelte +1 -1
- package/dist/layout/json-tree/JsonTree.svelte +2 -2
- package/dist/layout/json-tree/utils.js +5 -4
- package/dist/marching-cubes.js +8 -13
- package/dist/math.d.ts +5 -1
- package/dist/math.js +24 -9
- package/dist/overlays/DraggablePane.svelte +4 -4
- package/dist/periodic-table/PeriodicTable.svelte +20 -9
- package/dist/periodic-table/PropertySelect.svelte +1 -0
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +9 -3
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +1 -1
- package/dist/phase-diagram/build-diagram.js +2 -2
- package/dist/phase-diagram/parse.js +6 -5
- package/dist/phase-diagram/types.d.ts +1 -1
- package/dist/phase-diagram/utils.d.ts +3 -3
- package/dist/phase-diagram/utils.js +8 -12
- package/dist/plot/{BarPlot.svelte → bar/BarPlot.svelte} +229 -587
- package/dist/plot/{BarPlot.svelte.d.ts → bar/BarPlot.svelte.d.ts} +5 -5
- package/dist/plot/{BarPlotControls.svelte → bar/BarPlotControls.svelte} +6 -5
- package/dist/plot/{BarPlotControls.svelte.d.ts → bar/BarPlotControls.svelte.d.ts} +3 -3
- package/dist/plot/{SpacegroupBarPlot.svelte → bar/SpacegroupBarPlot.svelte} +6 -6
- package/dist/plot/{SpacegroupBarPlot.svelte.d.ts → bar/SpacegroupBarPlot.svelte.d.ts} +1 -1
- package/dist/plot/bar/data.d.ts +40 -0
- package/dist/plot/bar/data.js +154 -0
- package/dist/plot/bar/geometry.d.ts +39 -0
- package/dist/plot/bar/geometry.js +60 -0
- package/dist/plot/bar/index.d.ts +3 -0
- package/dist/plot/bar/index.js +3 -0
- package/dist/plot/box/BoxPlot.svelte +1462 -0
- package/dist/plot/box/BoxPlot.svelte.d.ts +94 -0
- package/dist/plot/box/BoxPlotControls.svelte +109 -0
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +19 -0
- package/dist/plot/box/Violin.svelte +14 -0
- package/dist/plot/box/Violin.svelte.d.ts +70 -0
- package/dist/plot/box/box-plot.d.ts +55 -0
- package/dist/plot/box/box-plot.js +126 -0
- package/dist/plot/box/index.d.ts +5 -0
- package/dist/plot/box/index.js +5 -0
- package/dist/plot/box/kde.d.ts +16 -0
- package/dist/plot/box/kde.js +160 -0
- package/dist/plot/box/quantile.d.ts +3 -0
- package/dist/plot/box/quantile.js +53 -0
- package/dist/plot/{auto-place.js → core/auto-place.js} +2 -2
- package/dist/plot/core/axis-utils.d.ts +46 -0
- package/dist/plot/core/axis-utils.js +110 -0
- package/dist/plot/{AxisLabel.svelte → core/components/AxisLabel.svelte} +2 -2
- package/dist/plot/{AxisLabel.svelte.d.ts → core/components/AxisLabel.svelte.d.ts} +1 -1
- package/dist/plot/{ColorBar.svelte → core/components/ColorBar.svelte} +36 -33
- package/dist/plot/{ColorBar.svelte.d.ts → core/components/ColorBar.svelte.d.ts} +2 -2
- package/dist/plot/{ColorScaleSelect.svelte → core/components/ColorScaleSelect.svelte} +4 -3
- package/dist/plot/{ColorScaleSelect.svelte.d.ts → core/components/ColorScaleSelect.svelte.d.ts} +2 -2
- package/dist/plot/core/components/ControlPane.svelte +46 -0
- package/dist/plot/core/components/ControlPane.svelte.d.ts +13 -0
- package/dist/plot/{FillArea.svelte → core/components/FillArea.svelte} +17 -6
- package/dist/plot/{FillArea.svelte.d.ts → core/components/FillArea.svelte.d.ts} +1 -1
- package/dist/plot/{InteractiveAxisLabel.svelte → core/components/InteractiveAxisLabel.svelte} +3 -3
- package/dist/plot/{InteractiveAxisLabel.svelte.d.ts → core/components/InteractiveAxisLabel.svelte.d.ts} +2 -2
- package/dist/plot/{Line.svelte → core/components/Line.svelte} +30 -13
- package/dist/plot/{PlotAxis.svelte → core/components/PlotAxis.svelte} +7 -5
- package/dist/plot/{PlotAxis.svelte.d.ts → core/components/PlotAxis.svelte.d.ts} +3 -2
- package/dist/plot/{PlotControls.svelte → core/components/PlotControls.svelte} +17 -29
- package/dist/plot/core/components/PlotControls.svelte.d.ts +4 -0
- package/dist/plot/{PlotLegend.svelte → core/components/PlotLegend.svelte} +21 -10
- package/dist/plot/{PlotLegend.svelte.d.ts → core/components/PlotLegend.svelte.d.ts} +3 -2
- package/dist/plot/{PlotTooltip.svelte → core/components/PlotTooltip.svelte} +17 -1
- package/dist/plot/{PlotTooltip.svelte.d.ts → core/components/PlotTooltip.svelte.d.ts} +8 -0
- package/dist/plot/{PortalSelect.svelte → core/components/PortalSelect.svelte} +11 -7
- package/dist/plot/{ReferenceLine.svelte → core/components/ReferenceLine.svelte} +3 -3
- package/dist/plot/{ReferenceLine.svelte.d.ts → core/components/ReferenceLine.svelte.d.ts} +1 -1
- package/dist/plot/{ReferenceLine3D.svelte → core/components/ReferenceLine3D.svelte} +4 -4
- package/dist/plot/{ReferenceLine3D.svelte.d.ts → core/components/ReferenceLine3D.svelte.d.ts} +2 -2
- package/dist/plot/{ReferencePlane.svelte → core/components/ReferencePlane.svelte} +7 -7
- package/dist/plot/{ReferencePlane.svelte.d.ts → core/components/ReferencePlane.svelte.d.ts} +2 -2
- package/dist/plot/{ZeroLines.svelte → core/components/ZeroLines.svelte} +3 -3
- package/dist/plot/{ZeroLines.svelte.d.ts → core/components/ZeroLines.svelte.d.ts} +3 -3
- package/dist/plot/{ZoomRect.svelte → core/components/ZoomRect.svelte} +1 -1
- package/dist/plot/{ZoomRect.svelte.d.ts → core/components/ZoomRect.svelte.d.ts} +1 -1
- package/dist/plot/core/components/index.d.ts +17 -0
- package/dist/plot/core/components/index.js +17 -0
- package/dist/plot/{data-cleaning.d.ts → core/data-cleaning.d.ts} +71 -1
- package/dist/plot/{data-cleaning.js → core/data-cleaning.js} +3 -5
- package/dist/plot/{data-transform.d.ts → core/data-transform.d.ts} +2 -2
- package/dist/plot/{data-transform.js → core/data-transform.js} +3 -3
- package/dist/plot/core/fill-utils.d.ts +33 -0
- package/dist/plot/core/fill-utils.js +388 -0
- package/dist/plot/{hover-lock.svelte.js → core/hover-lock.svelte.js} +5 -6
- package/dist/plot/core/index.d.ts +10 -0
- package/dist/plot/core/index.js +11 -0
- package/dist/plot/core/interactions.d.ts +35 -0
- package/dist/plot/core/interactions.js +195 -0
- package/dist/plot/{layout.d.ts → core/layout.d.ts} +1 -0
- package/dist/plot/{layout.js → core/layout.js} +16 -8
- package/dist/plot/{reference-line.d.ts → core/reference-line.d.ts} +1 -1
- package/dist/plot/{reference-line.js → core/reference-line.js} +23 -36
- package/dist/plot/{scales.d.ts → core/scales.d.ts} +2 -2
- package/dist/plot/{scales.js → core/scales.js} +84 -85
- package/dist/plot/core/svg.d.ts +2 -0
- package/dist/plot/core/svg.js +41 -0
- package/dist/plot/{types.d.ts → core/types.d.ts} +19 -79
- package/dist/plot/{types.js → core/types.js} +1 -1
- package/dist/plot/{utils → core/utils}/label-placement.d.ts +2 -2
- package/dist/plot/core/utils/series-visibility.d.ts +26 -0
- package/dist/plot/{utils → core/utils}/series-visibility.js +29 -2
- package/dist/plot/core/utils.d.ts +11 -0
- package/dist/plot/core/utils.js +27 -0
- package/dist/plot/{Histogram.svelte → histogram/Histogram.svelte} +154 -294
- package/dist/plot/{Histogram.svelte.d.ts → histogram/Histogram.svelte.d.ts} +2 -2
- package/dist/plot/{HistogramControls.svelte → histogram/HistogramControls.svelte} +6 -6
- package/dist/plot/{HistogramControls.svelte.d.ts → histogram/HistogramControls.svelte.d.ts} +4 -4
- package/dist/plot/histogram/index.d.ts +2 -0
- package/dist/plot/histogram/index.js +2 -0
- package/dist/plot/index.d.ts +8 -41
- package/dist/plot/index.js +10 -39
- package/dist/plot/sankey/Sankey.svelte +700 -0
- package/dist/plot/sankey/Sankey.svelte.d.ts +74 -0
- package/dist/plot/sankey/SankeyControls.svelte +98 -0
- package/dist/plot/sankey/SankeyControls.svelte.d.ts +19 -0
- package/dist/plot/sankey/index.d.ts +4 -0
- package/dist/plot/sankey/index.js +3 -0
- package/dist/plot/sankey/sankey-types.d.ts +42 -0
- package/dist/plot/sankey/sankey-types.js +4 -0
- package/dist/plot/sankey/sankey.d.ts +52 -0
- package/dist/plot/sankey/sankey.js +187 -0
- package/dist/plot/{BinnedScatterPlot.svelte → scatter/BinnedScatterPlot.svelte} +61 -59
- package/dist/plot/{BinnedScatterPlot.svelte.d.ts → scatter/BinnedScatterPlot.svelte.d.ts} +4 -4
- package/dist/plot/{ElementScatter.svelte → scatter/ElementScatter.svelte} +6 -6
- package/dist/plot/{ElementScatter.svelte.d.ts → scatter/ElementScatter.svelte.d.ts} +2 -2
- package/dist/plot/{ScatterPlot.svelte → scatter/ScatterPlot.svelte} +221 -642
- package/dist/plot/{ScatterPlot.svelte.d.ts → scatter/ScatterPlot.svelte.d.ts} +7 -7
- package/dist/plot/{ScatterPlotControls.svelte → scatter/ScatterPlotControls.svelte} +6 -5
- package/dist/plot/{ScatterPlotControls.svelte.d.ts → scatter/ScatterPlotControls.svelte.d.ts} +1 -1
- package/dist/plot/{ScatterPoint.svelte → scatter/ScatterPoint.svelte} +7 -7
- package/dist/plot/{ScatterPoint.svelte.d.ts → scatter/ScatterPoint.svelte.d.ts} +3 -3
- package/dist/plot/{adaptive-density.d.ts → scatter/adaptive-density.d.ts} +14 -4
- package/dist/plot/{adaptive-density.js → scatter/adaptive-density.js} +46 -20
- package/dist/plot/{binned-scatter-types.d.ts → scatter/binned-scatter-types.d.ts} +3 -3
- package/dist/plot/scatter/index.d.ts +7 -0
- package/dist/plot/scatter/index.js +5 -0
- package/dist/plot/scatter/scatter-data.d.ts +19 -0
- package/dist/plot/scatter/scatter-data.js +212 -0
- package/dist/plot/{ScatterPlot3D.svelte → scatter-3d/ScatterPlot3D.svelte} +12 -10
- package/dist/plot/{ScatterPlot3D.svelte.d.ts → scatter-3d/ScatterPlot3D.svelte.d.ts} +7 -7
- package/dist/plot/{ScatterPlot3DControls.svelte → scatter-3d/ScatterPlot3DControls.svelte} +5 -4
- package/dist/plot/{ScatterPlot3DControls.svelte.d.ts → scatter-3d/ScatterPlot3DControls.svelte.d.ts} +2 -2
- package/dist/plot/{ScatterPlot3DScene.svelte → scatter-3d/ScatterPlot3DScene.svelte} +11 -11
- package/dist/plot/{ScatterPlot3DScene.svelte.d.ts → scatter-3d/ScatterPlot3DScene.svelte.d.ts} +3 -3
- package/dist/plot/{Surface3D.svelte → scatter-3d/Surface3D.svelte} +1 -1
- package/dist/plot/{Surface3D.svelte.d.ts → scatter-3d/Surface3D.svelte.d.ts} +1 -1
- package/dist/plot/scatter-3d/index.d.ts +4 -0
- package/dist/plot/scatter-3d/index.js +4 -0
- package/dist/plot/sunburst/Sunburst.svelte +1045 -0
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +96 -0
- package/dist/plot/sunburst/SunburstControls.svelte +200 -0
- package/dist/plot/sunburst/SunburstControls.svelte.d.ts +26 -0
- package/dist/plot/sunburst/index.d.ts +4 -0
- package/dist/plot/sunburst/index.js +4 -0
- package/dist/plot/sunburst/render.d.ts +34 -0
- package/dist/plot/sunburst/render.js +122 -0
- package/dist/plot/sunburst/sunburst.d.ts +62 -0
- package/dist/plot/sunburst/sunburst.js +266 -0
- package/dist/rdf/RdfPlot.svelte +2 -1
- package/dist/rdf/calc-rdf.js +11 -24
- package/dist/sanitize.js +1 -1
- package/dist/settings.d.ts +65 -1
- package/dist/settings.js +262 -0
- package/dist/spectral/Bands.svelte +39 -29
- package/dist/spectral/Bands.svelte.d.ts +3 -4
- package/dist/spectral/BandsAndDos.svelte +1 -1
- package/dist/spectral/BrillouinBandsDos.svelte +39 -27
- package/dist/spectral/Dos.svelte +10 -19
- package/dist/spectral/Dos.svelte.d.ts +2 -2
- package/dist/spectral/helpers.d.ts +3 -1
- package/dist/spectral/helpers.js +95 -29
- package/dist/structure/AtomLegend.svelte +8 -9
- package/dist/structure/CellSelect.svelte +1 -2
- package/dist/structure/Cylinder.svelte +12 -8
- package/dist/structure/Cylinder.svelte.d.ts +4 -1
- package/dist/structure/Structure.svelte +78 -72
- package/dist/structure/Structure.svelte.d.ts +1 -1
- package/dist/structure/StructureInfoPane.svelte +5 -6
- package/dist/structure/StructureScene.svelte +11 -10
- package/dist/structure/atom-properties.js +6 -6
- package/dist/structure/bond-order-perception.js +1 -1
- package/dist/structure/bonding.d.ts +1 -0
- package/dist/structure/bonding.js +43 -15
- package/dist/structure/export.js +27 -23
- package/dist/structure/index.d.ts +2 -4
- package/dist/structure/index.js +1 -3
- package/dist/structure/label-placement.js +4 -4
- package/dist/structure/measure.d.ts +3 -2
- package/dist/structure/measure.js +6 -5
- package/dist/structure/parse.js +121 -103
- package/dist/structure/pbc.js +4 -0
- package/dist/symmetry/SymmetryStats.svelte +2 -2
- package/dist/symmetry/index.d.ts +1 -1
- package/dist/symmetry/index.js +22 -24
- package/dist/symmetry/spacegroups.d.ts +7 -0
- package/dist/symmetry/spacegroups.js +48 -13
- package/dist/table/HeatmapTable.svelte +63 -11
- package/dist/table/HeatmapTable.svelte.d.ts +1 -1
- package/dist/table/index.d.ts +1 -3
- package/dist/table/index.js +1 -1
- package/dist/theme/index.js +8 -8
- package/dist/tooltip/KCoords.svelte +45 -0
- package/dist/tooltip/KCoords.svelte.d.ts +8 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/trajectory/Trajectory.svelte +66 -40
- package/dist/trajectory/Trajectory.svelte.d.ts +2 -1
- package/dist/trajectory/TrajectoryExportPane.svelte +2 -1
- package/dist/trajectory/TrajectoryInfoPane.svelte +2 -1
- package/dist/trajectory/format-detect.d.ts +1 -0
- package/dist/trajectory/format-detect.js +25 -11
- package/dist/trajectory/frame-reader.js +17 -50
- package/dist/trajectory/helpers.js +1 -1
- package/dist/trajectory/index.js +1 -1
- package/dist/trajectory/parse/hdf5.js +1 -1
- package/dist/trajectory/parse/index.js +14 -6
- package/dist/trajectory/parse/vasp.js +36 -17
- package/dist/trajectory/parse/xyz.d.ts +24 -0
- package/dist/trajectory/parse/xyz.js +102 -89
- package/dist/trajectory/plotting.d.ts +1 -1
- package/dist/trajectory/plotting.js +15 -15
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +6 -4
- package/dist/xrd/XrdPlot.svelte +2 -1
- package/dist/xrd/calc-xrd.js +15 -12
- package/dist/xrd/parse.js +2 -2
- package/package.json +22 -18
- package/dist/plot/PlotControls.svelte.d.ts +0 -4
- package/dist/plot/axis-utils.d.ts +0 -19
- package/dist/plot/axis-utils.js +0 -78
- package/dist/plot/defaults.d.ts +0 -19
- package/dist/plot/defaults.js +0 -9
- package/dist/plot/fill-utils.d.ts +0 -46
- package/dist/plot/fill-utils.js +0 -322
- package/dist/plot/interactions.d.ts +0 -12
- package/dist/plot/interactions.js +0 -101
- package/dist/plot/svg.d.ts +0 -1
- package/dist/plot/svg.js +0 -11
- package/dist/plot/utils/series-visibility.d.ts +0 -15
- package/dist/plot/utils.d.ts +0 -1
- package/dist/plot/utils.js +0 -14
- /package/dist/plot/{auto-place.d.ts → core/auto-place.d.ts} +0 -0
- /package/dist/plot/{Line.svelte.d.ts → core/components/Line.svelte.d.ts} +0 -0
- /package/dist/plot/{PortalSelect.svelte.d.ts → core/components/PortalSelect.svelte.d.ts} +0 -0
- /package/dist/plot/{hover-lock.svelte.d.ts → core/hover-lock.svelte.d.ts} +0 -0
- /package/dist/plot/{utils → core/utils}/label-placement.js +0 -0
- /package/dist/plot/{binned-scatter-types.js → scatter/binned-scatter-types.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { DEFAULTS } from '
|
|
2
|
+
import { DEFAULTS } from '../../../settings'
|
|
3
3
|
import { extent, min } from 'd3-array'
|
|
4
4
|
import { interpolatePath } from 'd3-interpolate-path'
|
|
5
5
|
import { curveMonotoneX, line } from 'd3-shape'
|
|
@@ -34,12 +34,20 @@
|
|
|
34
34
|
.y((point) => point[1])
|
|
35
35
|
.curve(curveMonotoneX)
|
|
36
36
|
|
|
37
|
+
// Only compute/render/tween the area fill when it is actually visible. Most line
|
|
38
|
+
// plots (e.g. every ScatterPlot line) pass a transparent area, so skipping it
|
|
39
|
+
// avoids a second expensive interpolatePath tween per line.
|
|
40
|
+
let show_area = $derived(
|
|
41
|
+
(Boolean(area_color) && area_color !== `transparent` && area_color !== `none`) ||
|
|
42
|
+
Boolean(area_stroke),
|
|
43
|
+
)
|
|
44
|
+
|
|
37
45
|
let [x_min, x_max] = $derived(extent(points.map((point) => point[0])))
|
|
38
46
|
let line_path = $derived(lineGenerator(points) ?? ``)
|
|
39
47
|
let ymin = $derived(origin[1] ?? min(points.map((point) => point[1])))
|
|
40
48
|
// Guard against NaN/Infinity in area_path coords (can happen during scale transitions)
|
|
41
49
|
let area_path = $derived(
|
|
42
|
-
line_path && isFinite(x_min ?? NaN) && isFinite(x_max ?? NaN) &&
|
|
50
|
+
show_area && line_path && isFinite(x_min ?? NaN) && isFinite(x_max ?? NaN) &&
|
|
43
51
|
isFinite(ymin ?? NaN)
|
|
44
52
|
? `${line_path}L${x_max},${ymin}L${x_min},${ymin}Z`
|
|
45
53
|
: ``,
|
|
@@ -50,32 +58,41 @@
|
|
|
50
58
|
easing: linear,
|
|
51
59
|
interpolate: interpolatePath,
|
|
52
60
|
}
|
|
61
|
+
// Path morphing via interpolatePath is costly (parse + resample + re-serialize
|
|
62
|
+
// every frame, per line). When the tween is disabled (duration <= 0) bind the
|
|
63
|
+
// path directly and skip the Tween entirely for zero per-frame cost.
|
|
64
|
+
let tween_disabled = $derived.by(() => {
|
|
65
|
+
const duration = line_tween.duration ?? default_tween.duration
|
|
66
|
+
return typeof duration === `number` && duration <= 0
|
|
67
|
+
})
|
|
68
|
+
|
|
53
69
|
// Tween objects are stateful - create once, update target via effect
|
|
54
70
|
// untrack() explicitly captures initial tween config (intentional - config set once at mount)
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
)
|
|
59
|
-
const tweened_area = new Tween(
|
|
60
|
-
``,
|
|
61
|
-
untrack(() => ({ ...default_tween, ...line_tween })),
|
|
62
|
-
)
|
|
71
|
+
const tween_opts = untrack(() => ({ ...default_tween, ...line_tween }))
|
|
72
|
+
const tweened_line = new Tween(``, tween_opts)
|
|
73
|
+
const tweened_area = new Tween(``, tween_opts)
|
|
63
74
|
|
|
64
75
|
$effect.pre(() => {
|
|
76
|
+
if (tween_disabled) return // paths bind line_path/area_path directly below
|
|
65
77
|
tweened_line.target = line_path
|
|
66
|
-
tweened_area.target = area_path
|
|
78
|
+
if (show_area) tweened_area.target = area_path
|
|
67
79
|
})
|
|
80
|
+
|
|
81
|
+
let line_d = $derived(tween_disabled ? line_path : tweened_line.current)
|
|
82
|
+
let area_d = $derived(
|
|
83
|
+
show_area ? (tween_disabled ? area_path : tweened_area.current) : ``,
|
|
84
|
+
)
|
|
68
85
|
</script>
|
|
69
86
|
|
|
70
87
|
<path
|
|
71
|
-
d={
|
|
88
|
+
d={line_d}
|
|
72
89
|
stroke={line_color}
|
|
73
90
|
stroke-width={line_width}
|
|
74
91
|
stroke-dasharray={line_dash && line_dash !== `solid` ? line_dash : null}
|
|
75
92
|
fill="none"
|
|
76
93
|
{...rest}
|
|
77
94
|
/>
|
|
78
|
-
<path d={
|
|
95
|
+
<path d={area_d} fill={area_color} stroke={area_stroke} {...rest} />
|
|
79
96
|
|
|
80
97
|
<style>
|
|
81
98
|
path {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { format_value } from '
|
|
2
|
+
import { format_value } from '../../../labels'
|
|
3
3
|
import AxisLabel from './AxisLabel.svelte'
|
|
4
|
-
import type { Sides } from '
|
|
5
|
-
import type { AxisConfig } from '
|
|
6
|
-
import { DEFAULT_GRID_STYLE } from '
|
|
4
|
+
import type { Sides } from '../layout'
|
|
5
|
+
import type { AxisConfig } from '../types'
|
|
6
|
+
import { DEFAULT_GRID_STYLE } from '../types'
|
|
7
7
|
|
|
8
8
|
type Side = `x` | `x2` | `y` | `y2`
|
|
9
9
|
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
show_grid = false,
|
|
22
22
|
show_baseline = true,
|
|
23
23
|
tick_label,
|
|
24
|
+
tick_color,
|
|
24
25
|
domain,
|
|
25
26
|
unit_on_first_tick = false,
|
|
26
27
|
label_x,
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
show_grid?: boolean
|
|
39
40
|
show_baseline?: boolean // axis spine line (ScatterPlot omits it)
|
|
40
41
|
tick_label?: (tick: number) => string | null | undefined // custom/categorical label
|
|
42
|
+
tick_color?: (tick: number) => string | undefined // per-tick label color (else axis.color)
|
|
41
43
|
domain?: [number, number] // when set, cull off-plot ticks and hide out-of-domain labels
|
|
42
44
|
unit_on_first_tick?: boolean // append axis.unit after the first tick label (ScatterPlot)
|
|
43
45
|
label_x?: number
|
|
@@ -136,7 +138,7 @@
|
|
|
136
138
|
y={text_y}
|
|
137
139
|
text-anchor={text_anchor}
|
|
138
140
|
dominant-baseline={text_baseline}
|
|
139
|
-
fill={text_fill}
|
|
141
|
+
fill={tick_color?.(tick) ?? text_fill}
|
|
140
142
|
transform={text_transform}
|
|
141
143
|
>
|
|
142
144
|
{tick_text(tick)}{#if unit_on_first_tick && idx === 0 && axis.unit}‌ {axis
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Sides } from '
|
|
2
|
-
import type { AxisConfig } from '
|
|
1
|
+
import type { Sides } from '../layout';
|
|
2
|
+
import type { AxisConfig } from '../types';
|
|
3
3
|
type Side = `x` | `x2` | `y` | `y2`;
|
|
4
4
|
type $$ComponentProps = {
|
|
5
5
|
side: Side;
|
|
@@ -12,6 +12,7 @@ type $$ComponentProps = {
|
|
|
12
12
|
show_grid?: boolean;
|
|
13
13
|
show_baseline?: boolean;
|
|
14
14
|
tick_label?: (tick: number) => string | null | undefined;
|
|
15
|
+
tick_color?: (tick: number) => string | undefined;
|
|
15
16
|
domain?: [number, number];
|
|
16
17
|
unit_on_first_tick?: boolean;
|
|
17
18
|
label_x?: number;
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// NOTE: Axis config objects (x_axis, x2_axis, y_axis, y2_axis) must be reassigned (not mutated)
|
|
3
3
|
// to trigger $bindable reactivity propagation to parent components.
|
|
4
4
|
// Pattern: `x_axis = { ...x_axis, prop: value }` instead of `x_axis.prop = value`
|
|
5
|
-
import SettingsSection from '
|
|
6
|
-
import
|
|
7
|
-
import { DEFAULTS } from '
|
|
5
|
+
import SettingsSection from '../../../layout/SettingsSection.svelte'
|
|
6
|
+
import ControlPane from './ControlPane.svelte'
|
|
7
|
+
import { DEFAULTS } from '../../../settings'
|
|
8
8
|
import { format } from 'd3-format'
|
|
9
9
|
import { timeFormat } from 'd3-time-format'
|
|
10
10
|
import { tooltip } from 'svelte-multiselect/attachments'
|
|
11
|
-
import type { Vec2 } from '
|
|
12
|
-
import type { AxisKey, PlotControlsProps } from '
|
|
13
|
-
import { normalize_y2_sync } from '
|
|
14
|
-
import { get_scale_type_name, is_scale_type_name, is_y2_sync_mode } from '
|
|
11
|
+
import type { Vec2 } from '../../../math'
|
|
12
|
+
import type { AxisKey, PlotControlsProps } from '../types'
|
|
13
|
+
import { normalize_y2_sync } from '../interactions'
|
|
14
|
+
import { get_scale_type_name, is_scale_type_name, is_y2_sync_mode } from '../types'
|
|
15
15
|
|
|
16
16
|
let {
|
|
17
17
|
show_controls = $bindable(false),
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
has_y2_points = false,
|
|
32
32
|
show_ticks = false,
|
|
33
33
|
controls_title = `plot`,
|
|
34
|
-
controls_class =
|
|
34
|
+
controls_class = `plot`,
|
|
35
35
|
toggle_props = {},
|
|
36
36
|
pane_props = {},
|
|
37
37
|
}: PlotControlsProps = $props()
|
|
@@ -80,10 +80,9 @@
|
|
|
80
80
|
if (format_string.startsWith(`%`)) {
|
|
81
81
|
timeFormat(format_string)(new Date())
|
|
82
82
|
return true
|
|
83
|
-
} else {
|
|
84
|
-
format(format_string)(123.456)
|
|
85
|
-
return true
|
|
86
83
|
}
|
|
84
|
+
format(format_string)(123.456)
|
|
85
|
+
return true
|
|
87
86
|
} catch {
|
|
88
87
|
return false
|
|
89
88
|
}
|
|
@@ -148,23 +147,12 @@
|
|
|
148
147
|
</script>
|
|
149
148
|
|
|
150
149
|
{#if show_controls}
|
|
151
|
-
<
|
|
152
|
-
bind:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
toggle_props
|
|
156
|
-
|
|
157
|
-
...toggle_props,
|
|
158
|
-
class: `${controls_class}-controls-toggle ${toggle_props?.class ?? ``}`,
|
|
159
|
-
style:
|
|
160
|
-
`position: absolute; top: var(--ctrl-btn-top, 5pt); right: var(--ctrl-btn-right, 1ex);` +
|
|
161
|
-
(toggle_props?.style ?? ``),
|
|
162
|
-
}}
|
|
163
|
-
pane_props={{
|
|
164
|
-
...pane_props,
|
|
165
|
-
class: `${controls_class}-controls-pane ${pane_props?.class ?? ``}`,
|
|
166
|
-
style: `--pane-padding: 12px; --pane-gap: 4px; ${pane_props?.style ?? ``}`,
|
|
167
|
-
}}
|
|
150
|
+
<ControlPane
|
|
151
|
+
bind:controls_open
|
|
152
|
+
controls_class={controls_class}
|
|
153
|
+
title={controls_title}
|
|
154
|
+
{toggle_props}
|
|
155
|
+
{pane_props}
|
|
168
156
|
>
|
|
169
157
|
{@render children?.(ctrl_state)}
|
|
170
158
|
|
|
@@ -533,5 +521,5 @@
|
|
|
533
521
|
|
|
534
522
|
<!-- Custom controls after base controls -->
|
|
535
523
|
{@render post_children?.(ctrl_state)}
|
|
536
|
-
</
|
|
524
|
+
</ControlPane>
|
|
537
525
|
{/if}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PlotControlsProps } from '../types';
|
|
2
|
+
declare const PlotControls: import("svelte").Component<PlotControlsProps, {}, "display" | "show_controls" | "controls_open" | "x_axis" | "y_axis" | "x2_axis" | "y2_axis">;
|
|
3
|
+
type PlotControls = ReturnType<typeof PlotControls>;
|
|
4
|
+
export default PlotControls;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { add_alpha } from '../../../colors'
|
|
3
|
+
import type { LegendItem, Orientation } from '../..'
|
|
4
|
+
import { unique_id } from '../utils'
|
|
5
|
+
import { sanitize_html } from '../../../sanitize'
|
|
6
|
+
import { strip_html } from '../../../table'
|
|
5
7
|
import { onDestroy } from 'svelte'
|
|
6
8
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
7
9
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity'
|
|
8
10
|
|
|
9
11
|
// Unique instance ID to prevent gradient ID collisions when multiple legends render on the same page
|
|
10
|
-
const instance_id =
|
|
12
|
+
const instance_id = unique_id()
|
|
11
13
|
|
|
12
14
|
let {
|
|
13
15
|
series_data = [],
|
|
@@ -28,6 +30,7 @@
|
|
|
28
30
|
on_hover_change,
|
|
29
31
|
on_item_hover,
|
|
30
32
|
active_series_idx = null,
|
|
33
|
+
active_fill_idx = null,
|
|
31
34
|
filterable = true,
|
|
32
35
|
filter_threshold = 12,
|
|
33
36
|
draggable = true,
|
|
@@ -58,8 +61,9 @@
|
|
|
58
61
|
on_drag_end?: (event: MouseEvent) => void
|
|
59
62
|
// Callback when hover state changes (for placement stability)
|
|
60
63
|
on_hover_change?: (is_hovered: boolean) => void
|
|
61
|
-
on_item_hover?: (
|
|
64
|
+
on_item_hover?: (item: LegendItem | null) => void
|
|
62
65
|
active_series_idx?: number | null
|
|
66
|
+
active_fill_idx?: number | null // highlight the fill legend item with this fill_idx
|
|
63
67
|
filterable?: boolean
|
|
64
68
|
filter_threshold?: number
|
|
65
69
|
draggable?: boolean
|
|
@@ -214,10 +218,13 @@
|
|
|
214
218
|
|
|
215
219
|
{#snippet legend_item(series: LegendItem, indent: boolean = false)}
|
|
216
220
|
{@const is_fill_item = series.item_type === `fill`}
|
|
221
|
+
{@const is_active = is_fill_item
|
|
222
|
+
? active_fill_idx === series.fill_idx
|
|
223
|
+
: active_series_idx === series.series_idx}
|
|
217
224
|
<div
|
|
218
225
|
class="legend-item"
|
|
219
226
|
class:hidden={!series.visible}
|
|
220
|
-
class:active={
|
|
227
|
+
class:active={is_active}
|
|
221
228
|
class:indented={indent}
|
|
222
229
|
class:fill-item={is_fill_item}
|
|
223
230
|
style={item_style}
|
|
@@ -237,9 +244,9 @@
|
|
|
237
244
|
toggle_item(series)
|
|
238
245
|
}
|
|
239
246
|
}}
|
|
240
|
-
onmouseenter={() => on_item_hover?.(series
|
|
247
|
+
onmouseenter={() => on_item_hover?.(series)}
|
|
241
248
|
onmouseleave={() => on_item_hover?.(null)}
|
|
242
|
-
onfocus={() => on_item_hover?.(series
|
|
249
|
+
onfocus={() => on_item_hover?.(series)}
|
|
243
250
|
onblur={() => on_item_hover?.(null)}
|
|
244
251
|
role="button"
|
|
245
252
|
tabindex="0"
|
|
@@ -286,8 +293,8 @@
|
|
|
286
293
|
rx="2"
|
|
287
294
|
fill={gradient
|
|
288
295
|
? `url(#${gradient_id})`
|
|
289
|
-
: (series.display_style.fill_color ?? `steelblue
|
|
290
|
-
fill-opacity=
|
|
296
|
+
: add_alpha(series.display_style.fill_color ?? `steelblue`, 1)}
|
|
297
|
+
fill-opacity="0.7"
|
|
291
298
|
stroke={series.display_style.edge_color ?? `none`}
|
|
292
299
|
stroke-width="1"
|
|
293
300
|
/>
|
|
@@ -454,6 +461,10 @@
|
|
|
454
461
|
font-size: var(--plot-legend-font-size, 0.8em);
|
|
455
462
|
max-width: var(--plot-legend-max-width);
|
|
456
463
|
width: fit-content;
|
|
464
|
+
/* cap height so legends with many series don't overflow the plot; scroll the rest.
|
|
465
|
+
% resolves against the (position: relative) plot wrapper's height. */
|
|
466
|
+
max-height: var(--plot-legend-max-height, 80%);
|
|
467
|
+
overflow-y: auto;
|
|
457
468
|
z-index: var(--plot-legend-z-index, 2);
|
|
458
469
|
box-sizing: border-box;
|
|
459
470
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LegendItem, Orientation } from '
|
|
1
|
+
import type { LegendItem, Orientation } from '../..';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, `style`> & {
|
|
4
4
|
series_data: LegendItem[];
|
|
@@ -17,8 +17,9 @@ type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, `style`> & {
|
|
|
17
17
|
on_drag?: (event: MouseEvent) => void;
|
|
18
18
|
on_drag_end?: (event: MouseEvent) => void;
|
|
19
19
|
on_hover_change?: (is_hovered: boolean) => void;
|
|
20
|
-
on_item_hover?: (
|
|
20
|
+
on_item_hover?: (item: LegendItem | null) => void;
|
|
21
21
|
active_series_idx?: number | null;
|
|
22
|
+
active_fill_idx?: number | null;
|
|
22
23
|
filterable?: boolean;
|
|
23
24
|
filter_threshold?: number;
|
|
24
25
|
draggable?: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { luminance } from '
|
|
2
|
+
import { luminance } from '../../../colors'
|
|
3
|
+
import { constrain_tooltip_position } from '../layout'
|
|
3
4
|
import type { Snippet } from 'svelte'
|
|
4
5
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
5
6
|
|
|
@@ -9,6 +10,8 @@
|
|
|
9
10
|
bg_color,
|
|
10
11
|
offset = { x: 6, y: 0 },
|
|
11
12
|
fixed = false,
|
|
13
|
+
constrain_to,
|
|
14
|
+
fallback_size,
|
|
12
15
|
wrapper = $bindable(),
|
|
13
16
|
children,
|
|
14
17
|
...rest
|
|
@@ -18,6 +21,8 @@
|
|
|
18
21
|
bg_color?: string | null
|
|
19
22
|
offset?: { x: number; y: number }
|
|
20
23
|
fixed?: boolean // Use position: fixed (for viewport coords) vs absolute
|
|
24
|
+
constrain_to?: { width: number; height: number } // flip/clamp within these bounds (offset consumed by constraining)
|
|
25
|
+
fallback_size?: { width: number; height: number } // size estimate before first measure
|
|
21
26
|
wrapper?: HTMLDivElement // Bindable reference for measuring tooltip size
|
|
22
27
|
children: Snippet
|
|
23
28
|
} = $props()
|
|
@@ -29,6 +34,17 @@
|
|
|
29
34
|
|
|
30
35
|
// For fixed positioning (viewport coords), flip to opposite side when near viewport edges
|
|
31
36
|
const pos = $derived.by(() => {
|
|
37
|
+
if (constrain_to) {
|
|
38
|
+
return constrain_tooltip_position(
|
|
39
|
+
x,
|
|
40
|
+
y,
|
|
41
|
+
wrapper?.offsetWidth ?? fallback_size?.width ?? 0,
|
|
42
|
+
wrapper?.offsetHeight ?? fallback_size?.height ?? 0,
|
|
43
|
+
constrain_to.width,
|
|
44
|
+
constrain_to.height,
|
|
45
|
+
{ offset_x: offset.x, offset_y: offset.y },
|
|
46
|
+
)
|
|
47
|
+
}
|
|
32
48
|
const raw_x = x + offset.x
|
|
33
49
|
const raw_y = y + offset.y
|
|
34
50
|
if (!fixed) return { x: raw_x, y: raw_y }
|
|
@@ -9,6 +9,14 @@ type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
9
9
|
y: number;
|
|
10
10
|
};
|
|
11
11
|
fixed?: boolean;
|
|
12
|
+
constrain_to?: {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
fallback_size?: {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
12
20
|
wrapper?: HTMLDivElement;
|
|
13
21
|
children: Snippet;
|
|
14
22
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<script lang="ts">
|
|
7
|
-
import { sanitize_html } from '
|
|
7
|
+
import { sanitize_html } from '../../../sanitize'
|
|
8
8
|
import type { HTMLButtonAttributes } from 'svelte/elements'
|
|
9
9
|
|
|
10
10
|
type Option = { key: string; label: string; unit?: string }
|
|
@@ -115,12 +115,12 @@
|
|
|
115
115
|
btn.setAttribute(`aria-selected`, `true`)
|
|
116
116
|
selected_btn = btn
|
|
117
117
|
}
|
|
118
|
-
li.
|
|
119
|
-
ul.
|
|
118
|
+
li.append(btn)
|
|
119
|
+
ul.append(li)
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
portal_el.
|
|
123
|
-
document.body.
|
|
122
|
+
portal_el.append(ul)
|
|
123
|
+
document.body.append(portal_el)
|
|
124
124
|
update_position()
|
|
125
125
|
dropdown_open = true
|
|
126
126
|
active_close_fn = close_dropdown
|
|
@@ -181,8 +181,8 @@
|
|
|
181
181
|
buttons[(idx + 1) % len]?.focus()
|
|
182
182
|
} else if (evt.key === `ArrowUp`) {
|
|
183
183
|
evt.preventDefault()
|
|
184
|
-
buttons[idx
|
|
185
|
-
} else if (evt.key === `Enter` && idx
|
|
184
|
+
buttons[idx === -1 ? len - 1 : (idx - 1 + len) % len]?.focus()
|
|
185
|
+
} else if (evt.key === `Enter` && idx !== -1) {
|
|
186
186
|
evt.preventDefault()
|
|
187
187
|
buttons[idx].click()
|
|
188
188
|
}
|
|
@@ -223,6 +223,8 @@
|
|
|
223
223
|
border-radius: 3px;
|
|
224
224
|
padding: 2px 4px;
|
|
225
225
|
font: inherit;
|
|
226
|
+
/* hug the text: `font: inherit` pulls in the page's loose line-height, inflating the hover bg */
|
|
227
|
+
line-height: 1.2;
|
|
226
228
|
color: inherit;
|
|
227
229
|
cursor: pointer;
|
|
228
230
|
}
|
|
@@ -235,6 +237,8 @@
|
|
|
235
237
|
}
|
|
236
238
|
.arrow {
|
|
237
239
|
font-size: 1.4em;
|
|
240
|
+
/* keep the larger glyph from inflating the trigger height (and thus the hover bg) */
|
|
241
|
+
line-height: 1;
|
|
238
242
|
opacity: 0.8;
|
|
239
243
|
}
|
|
240
244
|
.portal-select-trigger :global(:is(sub, sup)) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import {
|
|
4
4
|
calculate_annotation_position,
|
|
5
5
|
resolve_line_endpoints,
|
|
6
|
-
} from '
|
|
7
|
-
import type { RefLine, RefLineEvent, RefLineStyle } from '
|
|
8
|
-
import { REF_LINE_STYLE_DEFAULTS } from '
|
|
6
|
+
} from '../reference-line'
|
|
7
|
+
import type { RefLine, RefLineEvent, RefLineStyle } from '../types'
|
|
8
|
+
import { REF_LINE_STYLE_DEFAULTS } from '../types'
|
|
9
9
|
|
|
10
10
|
let {
|
|
11
11
|
ref_line,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
// ReferenceLine3D: 3D reference lines for axis-parallel, segments, and extended lines
|
|
3
3
|
// Uses Line2 for proper variable-width lines (WebGL ignores linewidth on basic lines)
|
|
4
|
-
import type { Point3D, Vec3 } from '
|
|
4
|
+
import type { Point3D, Vec3 } from '../../../math'
|
|
5
5
|
import { T, useThrelte } from '@threlte/core'
|
|
6
6
|
import * as THREE from 'three'
|
|
7
7
|
import { Line2 } from 'three/examples/jsm/lines/Line2.js'
|
|
8
8
|
import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry.js'
|
|
9
9
|
import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial.js'
|
|
10
|
-
import { create_to_threejs, span_or } from '
|
|
11
|
-
import type { RefLine3D } from '
|
|
10
|
+
import { create_to_threejs, span_or } from '../reference-line'
|
|
11
|
+
import type { RefLine3D } from '../types'
|
|
12
12
|
|
|
13
13
|
let { ref_line, scene_size = [10, 10, 5], ranges }: {
|
|
14
14
|
ref_line: RefLine3D
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
color: ref_line.style?.color ?? `white`,
|
|
103
103
|
opacity: ref_line.style?.opacity ?? 1,
|
|
104
104
|
width: ref_line.style?.width ?? 2,
|
|
105
|
-
dashed:
|
|
105
|
+
dashed: Boolean(ref_line.style?.dash),
|
|
106
106
|
})
|
|
107
107
|
|
|
108
108
|
// Create Line2 with LineGeometry and LineMaterial for proper variable-width lines
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
// ReferencePlane: 3D reference planes (axis-aligned, normal-defined, or point-defined)
|
|
3
|
-
import type { Vec3 } from '
|
|
4
|
-
import { cross_3d,
|
|
3
|
+
import type { Vec3 } from '../../../math'
|
|
4
|
+
import { cross_3d, normalize_vec } from '../../../math'
|
|
5
5
|
import { T } from '@threlte/core'
|
|
6
6
|
import * as THREE from 'three'
|
|
7
|
-
import { create_to_threejs, span_or } from '
|
|
8
|
-
import type { RefPlane } from '
|
|
7
|
+
import { create_to_threejs, span_or } from '../reference-line'
|
|
8
|
+
import type { RefPlane } from '../types'
|
|
9
9
|
|
|
10
10
|
let { ref_plane, scene_size = [10, 10, 5], ranges }: {
|
|
11
11
|
ref_plane: RefPlane
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
const v2: Vec3 = [p3[0] - p1[0], p3[1] - p1[1], p3[2] - p1[2]]
|
|
83
83
|
const cross = cross_3d(v1, v2)
|
|
84
84
|
if (Math.hypot(...cross) < 1e-9) return null // collinear points
|
|
85
|
-
return create_plane_from_normal(
|
|
85
|
+
return create_plane_from_normal(normalize_vec(cross), p1)
|
|
86
86
|
}
|
|
87
87
|
return null
|
|
88
88
|
}
|
|
@@ -111,9 +111,9 @@
|
|
|
111
111
|
|
|
112
112
|
// Create plane from normal and point, scaled to cover bounding box
|
|
113
113
|
function create_plane_from_normal(normal: Vec3, point: Vec3): THREE.BufferGeometry {
|
|
114
|
-
const normalized =
|
|
114
|
+
const normalized = normalize_vec(normal)
|
|
115
115
|
// Pick u perpendicular to normal (use axis least aligned with normal)
|
|
116
|
-
const u_dir =
|
|
116
|
+
const u_dir = normalize_vec(
|
|
117
117
|
cross_3d(normalized, Math.abs(normalized[0]) < 0.9 ? [1, 0, 0] : [0, 1, 0]),
|
|
118
118
|
)
|
|
119
119
|
const v_dir = cross_3d(normalized, u_dir)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { Vec2 } from '
|
|
3
|
-
import type { Sides } from '
|
|
4
|
-
import { get_scale_type_name, type ScaleType } from '
|
|
2
|
+
import type { Vec2 } from '../../../math'
|
|
3
|
+
import type { Sides } from '../layout'
|
|
4
|
+
import { get_scale_type_name, type ScaleType } from '../..'
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
display,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Vec2 } from '
|
|
2
|
-
import type { Sides } from '
|
|
3
|
-
import { type ScaleType } from '
|
|
1
|
+
import type { Vec2 } from '../../../math';
|
|
2
|
+
import type { Sides } from '../layout';
|
|
3
|
+
import { type ScaleType } from '../..';
|
|
4
4
|
type $$ComponentProps = {
|
|
5
5
|
display: {
|
|
6
6
|
x_zero_line?: boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { default as AxisLabel } from './AxisLabel.svelte';
|
|
2
|
+
export { default as ColorBar } from './ColorBar.svelte';
|
|
3
|
+
export { default as ColorScaleSelect } from './ColorScaleSelect.svelte';
|
|
4
|
+
export { default as ControlPane } from './ControlPane.svelte';
|
|
5
|
+
export { default as FillArea } from './FillArea.svelte';
|
|
6
|
+
export { default as InteractiveAxisLabel } from './InteractiveAxisLabel.svelte';
|
|
7
|
+
export { default as Line } from './Line.svelte';
|
|
8
|
+
export { default as PlotAxis } from './PlotAxis.svelte';
|
|
9
|
+
export { default as PlotControls } from './PlotControls.svelte';
|
|
10
|
+
export { default as PlotLegend } from './PlotLegend.svelte';
|
|
11
|
+
export { default as PlotTooltip } from './PlotTooltip.svelte';
|
|
12
|
+
export { default as PortalSelect } from './PortalSelect.svelte';
|
|
13
|
+
export { default as ReferenceLine } from './ReferenceLine.svelte';
|
|
14
|
+
export { default as ReferenceLine3D } from './ReferenceLine3D.svelte';
|
|
15
|
+
export { default as ReferencePlane } from './ReferencePlane.svelte';
|
|
16
|
+
export { default as ZeroLines } from './ZeroLines.svelte';
|
|
17
|
+
export { default as ZoomRect } from './ZoomRect.svelte';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { default as AxisLabel } from './AxisLabel.svelte';
|
|
2
|
+
export { default as ColorBar } from './ColorBar.svelte';
|
|
3
|
+
export { default as ColorScaleSelect } from './ColorScaleSelect.svelte';
|
|
4
|
+
export { default as ControlPane } from './ControlPane.svelte';
|
|
5
|
+
export { default as FillArea } from './FillArea.svelte';
|
|
6
|
+
export { default as InteractiveAxisLabel } from './InteractiveAxisLabel.svelte';
|
|
7
|
+
export { default as Line } from './Line.svelte';
|
|
8
|
+
export { default as PlotAxis } from './PlotAxis.svelte';
|
|
9
|
+
export { default as PlotControls } from './PlotControls.svelte';
|
|
10
|
+
export { default as PlotLegend } from './PlotLegend.svelte';
|
|
11
|
+
export { default as PlotTooltip } from './PlotTooltip.svelte';
|
|
12
|
+
export { default as PortalSelect } from './PortalSelect.svelte';
|
|
13
|
+
export { default as ReferenceLine } from './ReferenceLine.svelte';
|
|
14
|
+
export { default as ReferenceLine3D } from './ReferenceLine3D.svelte';
|
|
15
|
+
export { default as ReferencePlane } from './ReferencePlane.svelte';
|
|
16
|
+
export { default as ZeroLines } from './ZeroLines.svelte';
|
|
17
|
+
export { default as ZoomRect } from './ZoomRect.svelte';
|