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,6 +1,6 @@
|
|
|
1
|
-
import type { D3ColorSchemeName, D3InterpolateName } from '
|
|
2
|
-
import type { Point2D } from '
|
|
3
|
-
import type { AxisLoadError, BarHandlerProps, BarMode, BarSeries, BarStyle, BasePlotProps, DataLoaderFn, InternalPoint, LegendConfig, LineStyle, Orientation, PanConfig, PlotConfig, RefLine, RefLineEvent, ScaleType, UserContentProps } from '
|
|
1
|
+
import type { D3ColorSchemeName, D3InterpolateName } from '../../colors';
|
|
2
|
+
import type { Point2D } from '../../math';
|
|
3
|
+
import type { AxisLoadError, BarHandlerProps, BarMode, BarSeries, BarStyle, BasePlotProps, DataLoaderFn, InternalPoint, LegendConfig, LineStyle, Orientation, PanConfig, PlotConfig, RefLine, RefLineEvent, ScaleType, UserContentProps } from '..';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
6
|
import { type TweenOptions } from 'svelte/motion';
|
|
@@ -61,7 +61,7 @@ declare function $$render<Metadata extends Record<string, unknown> = Record<stri
|
|
|
61
61
|
pan?: PanConfig;
|
|
62
62
|
};
|
|
63
63
|
exports: {};
|
|
64
|
-
bindings: "orientation" | "display" | "mode" | "show_controls" | "
|
|
64
|
+
bindings: "orientation" | "display" | "mode" | "show_controls" | "fullscreen" | "series" | "hovered" | "ref_lines" | "controls_open" | "x_axis" | "y_axis" | "x2_axis" | "y2_axis";
|
|
65
65
|
slots: {};
|
|
66
66
|
events: {};
|
|
67
67
|
};
|
|
@@ -69,7 +69,7 @@ declare class __sveltets_Render<Metadata extends Record<string, unknown> = Recor
|
|
|
69
69
|
props(): ReturnType<typeof $$render<Metadata>>['props'];
|
|
70
70
|
events(): ReturnType<typeof $$render<Metadata>>['events'];
|
|
71
71
|
slots(): ReturnType<typeof $$render<Metadata>>['slots'];
|
|
72
|
-
bindings(): "orientation" | "display" | "mode" | "show_controls" | "
|
|
72
|
+
bindings(): "orientation" | "display" | "mode" | "show_controls" | "fullscreen" | "series" | "hovered" | "ref_lines" | "controls_open" | "x_axis" | "y_axis" | "x2_axis" | "y2_axis";
|
|
73
73
|
exports(): {};
|
|
74
74
|
}
|
|
75
75
|
interface $$IsomorphicComponent {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { SettingsSection } from '
|
|
3
|
-
import type { BarMode, PlotConfig } from '
|
|
4
|
-
import { PlotControls } from '
|
|
5
|
-
import type { Orientation, PlotControlsProps } from '
|
|
2
|
+
import { SettingsSection } from '../../layout'
|
|
3
|
+
import type { BarMode, PlotConfig } from '..'
|
|
4
|
+
import { PlotControls } from '..'
|
|
5
|
+
import type { Orientation, PlotControlsProps } from '../core/types'
|
|
6
|
+
import { unique_id } from '../core/utils'
|
|
6
7
|
import type { Snippet } from 'svelte'
|
|
7
8
|
|
|
8
9
|
// Unique ID prefix to avoid conflicts when multiple instances on same page
|
|
9
|
-
const uid =
|
|
10
|
+
const uid = unique_id(`bar-ctrl`)
|
|
10
11
|
|
|
11
12
|
let {
|
|
12
13
|
orientation = $bindable(`vertical`),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BarMode, PlotConfig } from '
|
|
2
|
-
import type { Orientation, PlotControlsProps } from '
|
|
1
|
+
import type { BarMode, PlotConfig } from '..';
|
|
2
|
+
import type { Orientation, PlotControlsProps } from '../core/types';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
type $$ComponentProps = Omit<PlotControlsProps, `children` | `post_children`> & {
|
|
5
5
|
orientation?: Orientation;
|
|
@@ -13,6 +13,6 @@ type $$ComponentProps = Omit<PlotControlsProps, `children` | `post_children`> &
|
|
|
13
13
|
} & Required<PlotConfig>
|
|
14
14
|
]>;
|
|
15
15
|
};
|
|
16
|
-
declare const BarPlotControls: import("svelte").Component<$$ComponentProps, {}, "orientation" | "display" | "mode" | "show_controls" | "
|
|
16
|
+
declare const BarPlotControls: import("svelte").Component<$$ComponentProps, {}, "orientation" | "display" | "mode" | "show_controls" | "controls_open" | "x_axis" | "y_axis" | "x2_axis" | "y2_axis">;
|
|
17
17
|
type BarPlotControls = ReturnType<typeof BarPlotControls>;
|
|
18
18
|
export default BarPlotControls;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { format_num, format_value } from '
|
|
3
|
-
import type { BarHandlerProps, BarSeries, TickConfig } from '
|
|
4
|
-
import { BarPlot } from '
|
|
5
|
-
import type { CrystalSystem } from '
|
|
6
|
-
import * as symmetry from '
|
|
7
|
-
import * as spg from '
|
|
2
|
+
import { format_num, format_value } from '../../labels'
|
|
3
|
+
import type { BarHandlerProps, BarSeries, TickConfig } from '..'
|
|
4
|
+
import { BarPlot } from '..'
|
|
5
|
+
import type { CrystalSystem } from '../../symmetry'
|
|
6
|
+
import * as symmetry from '../../symmetry'
|
|
7
|
+
import * as spg from '../../symmetry/spacegroups'
|
|
8
8
|
import type { ComponentProps } from 'svelte'
|
|
9
9
|
import { SvelteMap } from 'svelte/reactivity'
|
|
10
10
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BarMode, BarSeries, Orientation, ScaleType } from '../core/types';
|
|
2
|
+
export type NumericBarSeries<Metadata = Record<string, unknown>> = Omit<BarSeries<Metadata>, `x`> & {
|
|
3
|
+
x: readonly number[];
|
|
4
|
+
};
|
|
5
|
+
export declare function normalize_categorical<Metadata = Record<string, unknown>>(series: readonly BarSeries<Metadata>[], explicit_categories?: readonly string[]): {
|
|
6
|
+
category_list: string[];
|
|
7
|
+
internal_series: NumericBarSeries<Metadata>[];
|
|
8
|
+
};
|
|
9
|
+
export interface BarAutoRangeOpts<Metadata = Record<string, unknown>> {
|
|
10
|
+
visible_series: readonly NumericBarSeries<Metadata>[];
|
|
11
|
+
y1_series: readonly NumericBarSeries<Metadata>[];
|
|
12
|
+
y2_series: readonly NumericBarSeries<Metadata>[];
|
|
13
|
+
x2_series: readonly NumericBarSeries<Metadata>[];
|
|
14
|
+
mode: BarMode;
|
|
15
|
+
orientation: Orientation;
|
|
16
|
+
range_padding: number;
|
|
17
|
+
category_count: number;
|
|
18
|
+
x_range: [number | null, number | null];
|
|
19
|
+
x_scale_type: ScaleType;
|
|
20
|
+
x_is_time: boolean;
|
|
21
|
+
x2_range: [number | null, number | null];
|
|
22
|
+
x2_scale_type: ScaleType;
|
|
23
|
+
x2_is_time: boolean;
|
|
24
|
+
y_range: [number | null, number | null];
|
|
25
|
+
y_scale_type: ScaleType;
|
|
26
|
+
y2_range: [number | null, number | null];
|
|
27
|
+
y2_scale_type: ScaleType;
|
|
28
|
+
}
|
|
29
|
+
export declare function compute_bar_auto_ranges<Metadata = Record<string, unknown>>(opts: BarAutoRangeOpts<Metadata>): {
|
|
30
|
+
x: number[];
|
|
31
|
+
x2: number[];
|
|
32
|
+
y: number[];
|
|
33
|
+
y2: number[];
|
|
34
|
+
};
|
|
35
|
+
export declare function compute_stacked_offsets<Metadata = Record<string, unknown>>(internal_series: readonly NumericBarSeries<Metadata>[], mode: BarMode): number[][];
|
|
36
|
+
export interface GroupInfo {
|
|
37
|
+
bar_series_count: number;
|
|
38
|
+
bar_series_indices: number[];
|
|
39
|
+
}
|
|
40
|
+
export declare function compute_group_info<Metadata = Record<string, unknown>>(internal_series: readonly NumericBarSeries<Metadata>[], mode: BarMode): GroupInfo;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// Pure data-shaping logic for BarPlot: categorical x-value normalization,
|
|
2
|
+
// auto-range computation (incl. stacked totals + zero-clamping), stacked-bar
|
|
3
|
+
// offsets and grouped-bar layout info. Extracted from BarPlot.svelte so the
|
|
4
|
+
// math is unit-testable without mounting the component.
|
|
5
|
+
import { get_nice_data_range } from '../core/scales';
|
|
6
|
+
import { get_scale_type_name } from '../core/types';
|
|
7
|
+
// Map string x values (categories) to integer indices shared across all series.
|
|
8
|
+
// Numeric-only input is passed through unchanged (same array identity).
|
|
9
|
+
export function normalize_categorical(series, explicit_categories) {
|
|
10
|
+
const is_categorical = series.some((srs) => srs.x.some((val) => typeof val === `string`));
|
|
11
|
+
const category_list = !is_categorical
|
|
12
|
+
? []
|
|
13
|
+
: explicit_categories?.length
|
|
14
|
+
? [...explicit_categories]
|
|
15
|
+
: [...new Set(series.flatMap((srs) => srs.x.map(String)))];
|
|
16
|
+
if (category_list.length === 0) {
|
|
17
|
+
// safe: when no categories were found, all x values are numeric
|
|
18
|
+
const internal_series = series;
|
|
19
|
+
return { category_list, internal_series };
|
|
20
|
+
}
|
|
21
|
+
const category_indices = category_list.map((_, idx) => idx);
|
|
22
|
+
const internal_series = series.map((srs) => {
|
|
23
|
+
const orig_map = new Map(srs.x.map((val, idx) => [String(val), idx]));
|
|
24
|
+
if (orig_map.size < srs.x.length) {
|
|
25
|
+
console.warn(`BarPlot: series "${srs.label ?? `?`}" has duplicate x values — last occurrence wins`);
|
|
26
|
+
}
|
|
27
|
+
// Resolve original index for each category (undefined if series lacks it)
|
|
28
|
+
const orig_indices = category_list.map((cat) => orig_map.get(cat));
|
|
29
|
+
const remap = (arr, fallback) => orig_indices.map((oi) => (oi != null ? (arr?.[oi] ?? fallback) : fallback));
|
|
30
|
+
// Reorder a per-point prop that may be a single value (broadcast, left as-is) or an
|
|
31
|
+
// array (must follow the category reordering, else point styles misalign with bars)
|
|
32
|
+
const remap_per_point = (prop) => Array.isArray(prop)
|
|
33
|
+
? orig_indices.map((oi) => (oi != null ? prop[oi] : undefined))
|
|
34
|
+
: prop;
|
|
35
|
+
const bw_arr = Array.isArray(srs.bar_width) ? srs.bar_width : null;
|
|
36
|
+
const meta_arr = Array.isArray(srs.metadata) ? srs.metadata : null;
|
|
37
|
+
return {
|
|
38
|
+
...srs,
|
|
39
|
+
x: category_indices,
|
|
40
|
+
y: remap(srs.y, srs.render_mode === `line` ? NaN : 0),
|
|
41
|
+
labels: remap(srs.labels, null),
|
|
42
|
+
metadata: orig_indices.map((oi) => oi != null ? (meta_arr ? meta_arr[oi] : srs.metadata) : undefined),
|
|
43
|
+
point_style: remap_per_point(srs.point_style),
|
|
44
|
+
point_hover: remap_per_point(srs.point_hover),
|
|
45
|
+
point_label: remap_per_point(srs.point_label),
|
|
46
|
+
point_offset: remap_per_point(srs.point_offset),
|
|
47
|
+
...(bw_arr ? { bar_width: remap(bw_arr, 0.5) } : {}),
|
|
48
|
+
...(srs.color_values ? { color_values: remap(srs.color_values, null) } : {}),
|
|
49
|
+
...(srs.size_values ? { size_values: remap(srs.size_values, null) } : {}),
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
return { category_list, internal_series };
|
|
53
|
+
}
|
|
54
|
+
// Compute data-driven axis ranges for all four axes. In stacked mode the value
|
|
55
|
+
// range covers per-x stacked totals (positive and negative stacks separately);
|
|
56
|
+
// for linear/arcsinh scales the value axis is clamped to include 0 when all
|
|
57
|
+
// values share one sign and no explicit range is set.
|
|
58
|
+
export function compute_bar_auto_ranges(opts) {
|
|
59
|
+
const { visible_series, mode, orientation, range_padding, category_count } = opts;
|
|
60
|
+
const calc_y_range = (series_list, y_limit, scale_type) => {
|
|
61
|
+
let points = series_list.flatMap((srs) => srs.x.map((x_val, idx) => ({ x: x_val, y: srs.y[idx] })));
|
|
62
|
+
// In stacked mode, calculate stacked totals for accurate range (only for bars on the same axis)
|
|
63
|
+
if (mode === `stacked`) {
|
|
64
|
+
const stacked_totals = new Map();
|
|
65
|
+
// Only include visible bar series (not lines) in stacking
|
|
66
|
+
series_list
|
|
67
|
+
.filter((srs) => srs.render_mode !== `line`)
|
|
68
|
+
.forEach((srs) => srs.x.forEach((x_val, idx) => {
|
|
69
|
+
const y_val = srs.y[idx] ?? 0;
|
|
70
|
+
const totals = stacked_totals.get(x_val) ?? { pos: 0, neg: 0 };
|
|
71
|
+
if (y_val >= 0)
|
|
72
|
+
totals.pos += y_val;
|
|
73
|
+
else
|
|
74
|
+
totals.neg += y_val;
|
|
75
|
+
stacked_totals.set(x_val, totals);
|
|
76
|
+
}));
|
|
77
|
+
// Replace points with stacked totals + line series (which don't stack)
|
|
78
|
+
points = [
|
|
79
|
+
...Array.from(stacked_totals).flatMap(([x_val, { pos, neg }]) => [
|
|
80
|
+
...(pos > 0 ? [{ x: x_val, y: pos }] : []),
|
|
81
|
+
...(neg < 0 ? [{ x: x_val, y: neg }] : []),
|
|
82
|
+
]),
|
|
83
|
+
...series_list
|
|
84
|
+
.filter((srs) => srs.render_mode === `line`)
|
|
85
|
+
.flatMap((srs) => srs.x.map((x_val, idx) => ({ x: x_val, y: srs.y[idx] }))),
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
if (points.length === 0)
|
|
89
|
+
return [0, 1];
|
|
90
|
+
let computed_y_range = get_nice_data_range(points, (pt) => pt.y, y_limit, scale_type, range_padding, false);
|
|
91
|
+
// Bar value axes include 0 when all values share one sign - unless an explicit
|
|
92
|
+
// range is set or the scale is log (where 0 is invalid)
|
|
93
|
+
const type_name = get_scale_type_name(scale_type);
|
|
94
|
+
if ((type_name === `linear` || type_name === `arcsinh`) &&
|
|
95
|
+
y_limit[0] == null &&
|
|
96
|
+
y_limit[1] == null) {
|
|
97
|
+
const has_negative = points.some((pt) => pt.y < 0);
|
|
98
|
+
const has_positive = points.some((pt) => pt.y > 0);
|
|
99
|
+
if (has_positive && !has_negative)
|
|
100
|
+
computed_y_range = [0, computed_y_range[1]];
|
|
101
|
+
else if (has_negative && !has_positive)
|
|
102
|
+
computed_y_range = [computed_y_range[0], 0];
|
|
103
|
+
}
|
|
104
|
+
return computed_y_range;
|
|
105
|
+
};
|
|
106
|
+
const calc_x_range = (series_list, limit, scale_type, is_time) => {
|
|
107
|
+
const points = series_list.flatMap((srs) => srs.x.map((x_val) => ({ x: x_val, y: 0 })));
|
|
108
|
+
if (points.length === 0)
|
|
109
|
+
return [0, 1];
|
|
110
|
+
return get_nice_data_range(points, (pt) => pt.x, limit, scale_type, range_padding, is_time);
|
|
111
|
+
};
|
|
112
|
+
// Categorical x axes use a fixed range centered on integer indices
|
|
113
|
+
const x_auto_range = category_count > 0
|
|
114
|
+
? [-0.5, category_count - 0.5]
|
|
115
|
+
: calc_x_range(visible_series.filter((srs) => (srs.x_axis ?? `x1`) === `x1`), opts.x_range, opts.x_scale_type, opts.x_is_time);
|
|
116
|
+
const x2_auto_range = calc_x_range(opts.x2_series, opts.x2_range, opts.x2_scale_type, opts.x2_is_time);
|
|
117
|
+
const y1_range = calc_y_range(opts.y1_series, opts.y_range, opts.y_scale_type);
|
|
118
|
+
const y2_auto_range = calc_y_range(opts.y2_series, opts.y2_range, opts.y2_scale_type);
|
|
119
|
+
// Map data ranges to axis ranges depending on orientation
|
|
120
|
+
return orientation === `horizontal`
|
|
121
|
+
? { x: y1_range, x2: x2_auto_range, y: x_auto_range, y2: y2_auto_range }
|
|
122
|
+
: { x: x_auto_range, x2: x2_auto_range, y: y1_range, y2: y2_auto_range };
|
|
123
|
+
}
|
|
124
|
+
// Stack offsets indexed by [original series idx][bar idx] (only bar series in
|
|
125
|
+
// stacked mode contribute; hidden and line series get all-zero rows).
|
|
126
|
+
export function compute_stacked_offsets(internal_series, mode) {
|
|
127
|
+
if (mode !== `stacked`)
|
|
128
|
+
return [];
|
|
129
|
+
const offsets = internal_series.map((srs) => Array.from(srs.x, () => 0));
|
|
130
|
+
// Cumulative totals keyed by axis/sign/x value so series with misaligned x grids
|
|
131
|
+
// stack on the correct baseline (matching stacked totals in compute_bar_auto_ranges)
|
|
132
|
+
const acc = new Map();
|
|
133
|
+
internal_series.forEach((srs, series_idx) => {
|
|
134
|
+
if (!(srs?.visible ?? true) || srs.render_mode === `line`)
|
|
135
|
+
return;
|
|
136
|
+
srs.x.forEach((x_val, bar_idx) => {
|
|
137
|
+
const y_val = srs.y[bar_idx] ?? 0;
|
|
138
|
+
const key = `${srs.y_axis === `y2` ? `y2` : `y1`}:${y_val >= 0 ? `+` : `-`}:${x_val}`;
|
|
139
|
+
offsets[series_idx][bar_idx] = acc.get(key) ?? 0;
|
|
140
|
+
acc.set(key, (acc.get(key) ?? 0) + y_val);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
return offsets;
|
|
144
|
+
}
|
|
145
|
+
// Group positions for grouped mode (side-by-side bars). Indices are original
|
|
146
|
+
// series indices so hidden/line series don't shift visible bars' slots.
|
|
147
|
+
export function compute_group_info(internal_series, mode) {
|
|
148
|
+
if (mode !== `grouped`)
|
|
149
|
+
return { bar_series_count: 0, bar_series_indices: [] };
|
|
150
|
+
const bar_series_indices = internal_series
|
|
151
|
+
.map((srs, idx) => ((srs?.visible ?? true) && srs.render_mode !== `line` ? idx : -1))
|
|
152
|
+
.filter((idx) => idx >= 0);
|
|
153
|
+
return { bar_series_count: bar_series_indices.length, bar_series_indices };
|
|
154
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { BarMode, InternalPoint, Orientation } from '../core/types';
|
|
2
|
+
import type { GroupInfo, NumericBarSeries } from './data';
|
|
3
|
+
export type LineSeriesPoint<Metadata = Record<string, unknown>> = InternalPoint<Metadata> & {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
data_x: number;
|
|
7
|
+
data_y: number;
|
|
8
|
+
idx: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function compute_line_points<Metadata = Record<string, unknown>>(opts: {
|
|
11
|
+
series: NumericBarSeries<Metadata>;
|
|
12
|
+
series_idx: number;
|
|
13
|
+
orientation: Orientation;
|
|
14
|
+
x_scale: (val: number) => number;
|
|
15
|
+
y_scale: (val: number) => number;
|
|
16
|
+
cat_y_scale: (val: number) => number;
|
|
17
|
+
}): LineSeriesPoint<Metadata>[];
|
|
18
|
+
export interface BarRect {
|
|
19
|
+
c0: number;
|
|
20
|
+
c1: number;
|
|
21
|
+
v0: number;
|
|
22
|
+
v1: number;
|
|
23
|
+
rect_x: number;
|
|
24
|
+
rect_y: number;
|
|
25
|
+
rect_w: number;
|
|
26
|
+
rect_h: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function compute_bar_rect(opts: {
|
|
29
|
+
cat_val: number;
|
|
30
|
+
val: number;
|
|
31
|
+
base: number;
|
|
32
|
+
bar_width_val: number;
|
|
33
|
+
series_idx: number;
|
|
34
|
+
mode: BarMode;
|
|
35
|
+
orientation: Orientation;
|
|
36
|
+
group_info: GroupInfo;
|
|
37
|
+
cat_scale: (val: number) => number;
|
|
38
|
+
val_scale: (val: number) => number;
|
|
39
|
+
}): BarRect;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Pure screen-space geometry for BarPlot rendering: line-series point
|
|
2
|
+
// construction and per-bar rect computation. Extracted from BarPlot.svelte's
|
|
3
|
+
// template so the coordinate math is unit-testable.
|
|
4
|
+
import { process_prop } from '../core/data-transform';
|
|
5
|
+
// Build screen-space points for a line series (lines don't stack - they show
|
|
6
|
+
// absolute values). Non-finite points (NaN/Infinity coords) are dropped.
|
|
7
|
+
export function compute_line_points(opts) {
|
|
8
|
+
const { series: srs, series_idx, orientation, x_scale, y_scale, cat_y_scale } = opts;
|
|
9
|
+
return srs.x
|
|
10
|
+
.map((x_val, idx) => {
|
|
11
|
+
const y_val = srs.y[idx];
|
|
12
|
+
const plot_x = orientation === `vertical` ? x_scale(x_val) : x_scale(y_val);
|
|
13
|
+
const plot_y = orientation === `vertical` ? y_scale(y_val) : cat_y_scale(x_val);
|
|
14
|
+
const metadata = Array.isArray(srs.metadata) ? srs.metadata[idx] : srs.metadata;
|
|
15
|
+
return {
|
|
16
|
+
x: plot_x,
|
|
17
|
+
y: plot_y,
|
|
18
|
+
data_x: x_val,
|
|
19
|
+
data_y: y_val,
|
|
20
|
+
idx,
|
|
21
|
+
color_value: srs.color_values?.[idx] ?? null,
|
|
22
|
+
size_value: srs.size_values?.[idx] ?? null,
|
|
23
|
+
point_style: process_prop(srs.point_style, idx),
|
|
24
|
+
point_hover: process_prop(srs.point_hover, idx),
|
|
25
|
+
point_label: process_prop(srs.point_label, idx),
|
|
26
|
+
point_offset: process_prop(srs.point_offset, idx),
|
|
27
|
+
metadata,
|
|
28
|
+
series_idx,
|
|
29
|
+
point_idx: idx,
|
|
30
|
+
};
|
|
31
|
+
})
|
|
32
|
+
.filter((pt) => isFinite(pt.x) && isFinite(pt.y));
|
|
33
|
+
}
|
|
34
|
+
// Screen-space rect for one bar: category extent (c0/c1) from bar width +
|
|
35
|
+
// grouped offset, value extent (v0/v1) from stacked base to base + value.
|
|
36
|
+
// Rects get min 1px width so thin bars stay visible.
|
|
37
|
+
export function compute_bar_rect(opts) {
|
|
38
|
+
const { cat_val, val, base, bar_width_val, series_idx, mode, group_info } = opts;
|
|
39
|
+
const { cat_scale, val_scale } = opts;
|
|
40
|
+
const is_vertical = opts.orientation === `vertical`;
|
|
41
|
+
const grouped = mode === `grouped` && group_info.bar_series_count > 1;
|
|
42
|
+
const half = grouped ? bar_width_val / (2 * group_info.bar_series_count) : bar_width_val / 2;
|
|
43
|
+
// Offset uses the series' slot among visible bar series (original-index lookup)
|
|
44
|
+
const group_offset = grouped
|
|
45
|
+
? (group_info.bar_series_indices.indexOf(series_idx) -
|
|
46
|
+
(group_info.bar_series_count - 1) / 2) *
|
|
47
|
+
(bar_width_val / group_info.bar_series_count)
|
|
48
|
+
: 0;
|
|
49
|
+
const c0 = cat_scale(cat_val + group_offset - half);
|
|
50
|
+
const c1 = cat_scale(cat_val + group_offset + half);
|
|
51
|
+
const v0 = val_scale(base);
|
|
52
|
+
const v1 = val_scale(base + val);
|
|
53
|
+
const [rect_x, rect_y] = is_vertical
|
|
54
|
+
? [Math.min(c0, c1), Math.min(v0, v1)]
|
|
55
|
+
: [Math.min(v0, v1), Math.min(c0, c1)];
|
|
56
|
+
const [rect_w, rect_h] = is_vertical
|
|
57
|
+
? [Math.max(1, Math.abs(c1 - c0)), Math.max(0, Math.abs(v1 - v0))]
|
|
58
|
+
: [Math.max(1, Math.abs(v1 - v0)), Math.max(0, Math.abs(c1 - c0))];
|
|
59
|
+
return { c0, c1, v0, v1, rect_x, rect_y, rect_w, rect_h };
|
|
60
|
+
}
|