@semcore/d3-chart 18.0.0-prerelease.1 → 18.0.0-prerelease.5
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/CHANGELOG.md +52 -1
- package/README.md +0 -1
- package/lib/cjs/Area.js +123 -23
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +109 -97
- package/lib/cjs/Axis.js.map +1 -1
- package/lib/cjs/Bar.js +16 -16
- package/lib/cjs/Bubble.js +14 -14
- package/lib/cjs/ChartMetaData.js +44 -0
- package/lib/cjs/ChartMetaData.js.map +1 -0
- package/lib/cjs/CompactHorizontalBar.js +17 -17
- package/lib/cjs/CompactHorizontalBar.js.map +1 -1
- package/lib/cjs/Donut.js +18 -19
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +67 -13
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/GroupBar.js +5 -2
- package/lib/cjs/GroupBar.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +16 -16
- package/lib/cjs/Hover.js +55 -52
- package/lib/cjs/Hover.js.map +1 -1
- package/lib/cjs/Line.js +82 -17
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/Pattern.js +113 -2
- package/lib/cjs/Pattern.js.map +1 -1
- package/lib/cjs/Plot.js +5 -2
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/Radar.js +19 -19
- package/lib/cjs/RadialTree.js +12 -12
- package/lib/cjs/Reference.js +55 -18
- package/lib/cjs/Reference.js.map +1 -1
- package/lib/cjs/ScatterPlot.js +9 -9
- package/lib/cjs/Tooltip.js +16 -14
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +9 -9
- package/lib/cjs/a11y/PlotA11yView.js +2 -2
- package/lib/cjs/component/Chart/AbstractChart.js +29 -23
- package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
- package/lib/cjs/component/Chart/AbstractChart.type.js +19 -0
- package/lib/cjs/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/AreaChart.js +21 -7
- package/lib/cjs/component/Chart/AreaChart.js.map +1 -1
- package/lib/cjs/component/Chart/AreaChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/BarChart.js +17 -8
- package/lib/cjs/component/Chart/BarChart.js.map +1 -1
- package/lib/cjs/component/Chart/BarChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/BubbleChart.js +4 -0
- package/lib/cjs/component/Chart/BubbleChart.js.map +1 -1
- package/lib/cjs/component/Chart/BubbleChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/CigaretteChart.js +5 -1
- package/lib/cjs/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/cjs/component/Chart/CigaretteChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/DonutChart.js +0 -1
- package/lib/cjs/component/Chart/DonutChart.js.map +1 -1
- package/lib/cjs/component/Chart/DonutChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/HistogramChart.js +6 -3
- package/lib/cjs/component/Chart/HistogramChart.js.map +1 -1
- package/lib/cjs/component/Chart/HistogramChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/LineChart.js +16 -6
- package/lib/cjs/component/Chart/LineChart.js.map +1 -1
- package/lib/cjs/component/Chart/LineChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/RadarChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/ScatterPlotChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/VennChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/index.js +43 -0
- package/lib/cjs/component/Chart/index.js.map +1 -1
- package/lib/cjs/component/ChartLegend/BaseLegend.js +0 -4
- package/lib/cjs/component/ChartLegend/BaseLegend.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/lib/cjs/component/ChartLegend/LegendFlex/legend-flex.shadow.css +2 -2
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +19 -17
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +28 -21
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendTable/legend-table.shadow.css +31 -15
- package/lib/cjs/component/Cigarette/Cigarette.js +0 -1
- package/lib/cjs/component/Cigarette/Cigarette.js.map +1 -1
- package/lib/cjs/component/Metric/Metric.js +78 -0
- package/lib/cjs/component/Metric/Metric.js.map +1 -0
- package/lib/cjs/component/Metric/Metric.type.js +2 -0
- package/lib/cjs/component/Metric/Metric.type.js.map +1 -0
- package/lib/cjs/index.js +62 -8
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/abstract-chart.shadow.css +13 -3
- package/lib/cjs/style/area.shadow.css +8 -7
- package/lib/cjs/style/axis.shadow.css +51 -60
- package/lib/cjs/style/bar.shadow.css +7 -9
- package/lib/cjs/style/bubble.shadow.css +4 -6
- package/lib/cjs/style/donut.shadow.css +3 -5
- package/lib/cjs/style/dot.shadow.css +37 -4
- package/lib/cjs/style/hover.shadow.css +30 -13
- package/lib/cjs/style/line.shadow.css +3 -5
- package/lib/cjs/style/pattern.shadow.css +10 -0
- package/lib/cjs/style/plotA11yView.shadow.css +3 -3
- package/lib/cjs/style/radar.shadow.css +7 -7
- package/lib/cjs/style/radial-tree.shadow.css +3 -5
- package/lib/cjs/style/reference.shadow.css +5 -5
- package/lib/cjs/style/scatterplot.shadow.css +2 -4
- package/lib/cjs/style/tooltip.shadow.css +12 -14
- package/lib/cjs/style/venn.shadow.css +0 -2
- package/lib/cjs/types/Axis.d.js.map +1 -1
- package/lib/cjs/types/Donut.d.js.map +1 -1
- package/lib/cjs/types/Hover.d.js.map +1 -1
- package/lib/cjs/types/index.d.js +20 -0
- package/lib/cjs/types/index.d.js.map +1 -1
- package/lib/cjs/utils.js +21 -1
- package/lib/cjs/utils.js.map +1 -1
- package/lib/es6/Area.js +125 -25
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +109 -97
- package/lib/es6/Axis.js.map +1 -1
- package/lib/es6/Bar.js +16 -16
- package/lib/es6/Bubble.js +14 -14
- package/lib/es6/ChartMetaData.js +36 -0
- package/lib/es6/ChartMetaData.js.map +1 -0
- package/lib/es6/CompactHorizontalBar.js +17 -17
- package/lib/es6/CompactHorizontalBar.js.map +1 -1
- package/lib/es6/Donut.js +18 -19
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +68 -14
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/GroupBar.js +5 -2
- package/lib/es6/GroupBar.js.map +1 -1
- package/lib/es6/HorizontalBar.js +16 -16
- package/lib/es6/Hover.js +55 -52
- package/lib/es6/Hover.js.map +1 -1
- package/lib/es6/Line.js +84 -19
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/Pattern.js +108 -2
- package/lib/es6/Pattern.js.map +1 -1
- package/lib/es6/Plot.js +5 -2
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/Radar.js +19 -19
- package/lib/es6/RadialTree.js +12 -12
- package/lib/es6/Reference.js +55 -18
- package/lib/es6/Reference.js.map +1 -1
- package/lib/es6/ScatterPlot.js +9 -9
- package/lib/es6/Tooltip.js +16 -14
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +9 -9
- package/lib/es6/a11y/PlotA11yView.js +2 -2
- package/lib/es6/component/Chart/AbstractChart.js +29 -23
- package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
- package/lib/es6/component/Chart/AbstractChart.type.js +14 -1
- package/lib/es6/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/es6/component/Chart/AreaChart.js +21 -7
- package/lib/es6/component/Chart/AreaChart.js.map +1 -1
- package/lib/es6/component/Chart/AreaChart.type.js.map +1 -1
- package/lib/es6/component/Chart/BarChart.js +17 -8
- package/lib/es6/component/Chart/BarChart.js.map +1 -1
- package/lib/es6/component/Chart/BarChart.type.js.map +1 -1
- package/lib/es6/component/Chart/BubbleChart.js +4 -0
- package/lib/es6/component/Chart/BubbleChart.js.map +1 -1
- package/lib/es6/component/Chart/BubbleChart.type.js.map +1 -1
- package/lib/es6/component/Chart/CigaretteChart.js +5 -1
- package/lib/es6/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/es6/component/Chart/CigaretteChart.type.js.map +1 -1
- package/lib/es6/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
- package/lib/es6/component/Chart/DonutChart.js +0 -1
- package/lib/es6/component/Chart/DonutChart.js.map +1 -1
- package/lib/es6/component/Chart/DonutChart.type.js.map +1 -1
- package/lib/es6/component/Chart/HistogramChart.js +6 -3
- package/lib/es6/component/Chart/HistogramChart.js.map +1 -1
- package/lib/es6/component/Chart/HistogramChart.type.js.map +1 -1
- package/lib/es6/component/Chart/LineChart.js +14 -4
- package/lib/es6/component/Chart/LineChart.js.map +1 -1
- package/lib/es6/component/Chart/LineChart.type.js.map +1 -1
- package/lib/es6/component/Chart/RadarChart.type.js.map +1 -1
- package/lib/es6/component/Chart/ScatterPlotChart.type.js.map +1 -1
- package/lib/es6/component/Chart/VennChart.type.js.map +1 -1
- package/lib/es6/component/Chart/index.js +2 -0
- package/lib/es6/component/Chart/index.js.map +1 -1
- package/lib/es6/component/ChartLegend/BaseLegend.js +0 -4
- package/lib/es6/component/ChartLegend/BaseLegend.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/lib/es6/component/ChartLegend/LegendFlex/legend-flex.shadow.css +2 -2
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +19 -17
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +28 -21
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendTable/legend-table.shadow.css +31 -15
- package/lib/es6/component/Cigarette/Cigarette.js +0 -1
- package/lib/es6/component/Cigarette/Cigarette.js.map +1 -1
- package/lib/es6/component/Metric/Metric.js +72 -0
- package/lib/es6/component/Metric/Metric.js.map +1 -0
- package/lib/es6/component/Metric/Metric.type.js +2 -0
- package/lib/es6/component/Metric/Metric.type.js.map +1 -0
- package/lib/es6/index.js +2 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/abstract-chart.shadow.css +13 -3
- package/lib/es6/style/area.shadow.css +8 -7
- package/lib/es6/style/axis.shadow.css +51 -60
- package/lib/es6/style/bar.shadow.css +7 -9
- package/lib/es6/style/bubble.shadow.css +4 -6
- package/lib/es6/style/donut.shadow.css +3 -5
- package/lib/es6/style/dot.shadow.css +37 -4
- package/lib/es6/style/hover.shadow.css +30 -13
- package/lib/es6/style/line.shadow.css +3 -5
- package/lib/es6/style/pattern.shadow.css +10 -0
- package/lib/es6/style/plotA11yView.shadow.css +3 -3
- package/lib/es6/style/radar.shadow.css +7 -7
- package/lib/es6/style/radial-tree.shadow.css +3 -5
- package/lib/es6/style/reference.shadow.css +5 -5
- package/lib/es6/style/scatterplot.shadow.css +2 -4
- package/lib/es6/style/tooltip.shadow.css +12 -14
- package/lib/es6/style/venn.shadow.css +0 -2
- package/lib/es6/types/Axis.d.js.map +1 -1
- package/lib/es6/types/Donut.d.js.map +1 -1
- package/lib/es6/types/Hover.d.js.map +1 -1
- package/lib/es6/types/index.d.js +5 -7
- package/lib/es6/types/index.d.js.map +1 -1
- package/lib/es6/utils.js +18 -0
- package/lib/es6/utils.js.map +1 -1
- package/lib/esm/Area.mjs +127 -26
- package/lib/esm/Axis.mjs +110 -98
- package/lib/esm/Bar.mjs +17 -17
- package/lib/esm/Bubble.mjs +15 -15
- package/lib/esm/ChartMetaData.mjs +38 -0
- package/lib/esm/CompactHorizontalBar.mjs +18 -18
- package/lib/esm/Donut.mjs +19 -20
- package/lib/esm/Dots.mjs +66 -15
- package/lib/esm/GroupBar.mjs +5 -2
- package/lib/esm/HorizontalBar.mjs +17 -17
- package/lib/esm/Hover.mjs +56 -53
- package/lib/esm/Line.mjs +86 -20
- package/lib/esm/Pattern.mjs +119 -0
- package/lib/esm/Plot.mjs +6 -3
- package/lib/esm/Radar.mjs +20 -20
- package/lib/esm/RadialTree.mjs +13 -13
- package/lib/esm/Reference.mjs +56 -19
- package/lib/esm/ScatterPlot.mjs +10 -10
- package/lib/esm/Tooltip.mjs +17 -15
- package/lib/esm/Venn.mjs +10 -10
- package/lib/esm/a11y/PlotA11yView.mjs +3 -3
- package/lib/esm/component/Chart/AbstractChart.mjs +28 -24
- package/lib/esm/component/Chart/AbstractChart.type.mjs +16 -0
- package/lib/esm/component/Chart/AreaChart.mjs +21 -7
- package/lib/esm/component/Chart/BarChart.mjs +17 -8
- package/lib/esm/component/Chart/BubbleChart.mjs +4 -0
- package/lib/esm/component/Chart/CigaretteChart.mjs +5 -1
- package/lib/esm/component/Chart/DonutChart.mjs +0 -1
- package/lib/esm/component/Chart/HistogramChart.mjs +6 -3
- package/lib/esm/component/Chart/LineChart.mjs +14 -4
- package/lib/esm/component/Chart/index.mjs +8 -0
- package/lib/esm/component/ChartLegend/BaseLegend.mjs +0 -4
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +5 -5
- package/lib/esm/component/ChartLegend/LegendFlex/legend-flex.shadow.css +2 -2
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +20 -18
- package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +29 -22
- package/lib/esm/component/ChartLegend/LegendTable/legend-table.shadow.css +31 -15
- package/lib/esm/component/Cigarette/Cigarette.mjs +0 -1
- package/lib/esm/component/Metric/Metric.mjs +62 -0
- package/lib/esm/index.mjs +42 -34
- package/lib/esm/style/abstract-chart.shadow.css +13 -3
- package/lib/esm/style/area.shadow.css +8 -7
- package/lib/esm/style/axis.shadow.css +51 -60
- package/lib/esm/style/bar.shadow.css +7 -9
- package/lib/esm/style/bubble.shadow.css +4 -6
- package/lib/esm/style/donut.shadow.css +3 -5
- package/lib/esm/style/dot.shadow.css +37 -4
- package/lib/esm/style/hover.shadow.css +30 -13
- package/lib/esm/style/line.shadow.css +3 -5
- package/lib/esm/style/pattern.shadow.css +10 -0
- package/lib/esm/style/plotA11yView.shadow.css +3 -3
- package/lib/esm/style/radar.shadow.css +7 -7
- package/lib/esm/style/radial-tree.shadow.css +3 -5
- package/lib/esm/style/reference.shadow.css +5 -5
- package/lib/esm/style/scatterplot.shadow.css +2 -4
- package/lib/esm/style/tooltip.shadow.css +12 -14
- package/lib/esm/style/venn.shadow.css +0 -2
- package/lib/esm/utils.mjs +20 -0
- package/lib/types/Axis.d.ts +3 -2
- package/lib/types/ChartMetaData.d.ts +17 -0
- package/lib/types/ChartMetaData.d.ts.map +1 -0
- package/lib/types/Donut.d.ts +1 -1
- package/lib/types/Hover.d.ts +2 -0
- package/lib/types/Pattern.d.ts +18 -0
- package/lib/types/Pattern.d.ts.map +1 -1
- package/lib/types/component/Chart/AbstractChart.d.ts +8 -4
- package/lib/types/component/Chart/AbstractChart.d.ts.map +1 -1
- package/lib/types/component/Chart/AbstractChart.type.d.ts +28 -8
- package/lib/types/component/Chart/AbstractChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/AreaChart.d.ts.map +1 -1
- package/lib/types/component/Chart/AreaChart.type.d.ts +8 -4
- package/lib/types/component/Chart/AreaChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/BarChart.d.ts.map +1 -1
- package/lib/types/component/Chart/BarChart.type.d.ts +3 -0
- package/lib/types/component/Chart/BarChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/BubbleChart.d.ts.map +1 -1
- package/lib/types/component/Chart/BubbleChart.type.d.ts +1 -1
- package/lib/types/component/Chart/BubbleChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/CigaretteChart.d.ts.map +1 -1
- package/lib/types/component/Chart/CigaretteChart.type.d.ts +1 -1
- package/lib/types/component/Chart/CigaretteChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts +1 -1
- package/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/DonutChart.d.ts.map +1 -1
- package/lib/types/component/Chart/DonutChart.type.d.ts +1 -2
- package/lib/types/component/Chart/DonutChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/HistogramChart.d.ts.map +1 -1
- package/lib/types/component/Chart/HistogramChart.type.d.ts +1 -0
- package/lib/types/component/Chart/HistogramChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/LineChart.d.ts.map +1 -1
- package/lib/types/component/Chart/LineChart.type.d.ts +1 -0
- package/lib/types/component/Chart/LineChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/RadarChart.type.d.ts +1 -1
- package/lib/types/component/Chart/RadarChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/ScatterPlotChart.type.d.ts +1 -1
- package/lib/types/component/Chart/ScatterPlotChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/VennChart.type.d.ts +1 -1
- package/lib/types/component/Chart/VennChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/index.d.ts +2 -0
- package/lib/types/component/Chart/index.d.ts.map +1 -1
- package/lib/types/component/ChartLegend/BaseLegend.d.ts.map +1 -1
- package/lib/types/component/ChartLegend/LegendTable/LegendTable.d.ts.map +1 -1
- package/lib/types/component/ChartLegend/LegendTable/LegendTable.type.d.ts +5 -3
- package/lib/types/component/ChartLegend/LegendTable/LegendTable.type.d.ts.map +1 -1
- package/lib/types/component/Metric/Metric.d.ts +9 -0
- package/lib/types/component/Metric/Metric.d.ts.map +1 -0
- package/lib/types/component/Metric/Metric.type.d.ts +33 -0
- package/lib/types/component/Metric/Metric.type.d.ts.map +1 -0
- package/lib/types/index.d.ts +5 -7
- package/lib/types/utils.d.ts +4 -1
- package/lib/types/utils.d.ts.map +1 -1
- package/package.json +16 -15
- package/lib/cjs/color.js +0 -132
- package/lib/cjs/color.js.map +0 -1
- package/lib/cjs/style/var.css +0 -125
- package/lib/es6/color.js +0 -127
- package/lib/es6/color.js.map +0 -1
- package/lib/es6/style/var.css +0 -125
- package/lib/esm/color.mjs +0 -127
- package/lib/esm/utils/TextMeasurer.mjs +0 -27
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
class ChartMetaData {
|
|
3
|
+
constructor() {
|
|
4
|
+
_defineProperty(this, "ticks", {
|
|
5
|
+
horizontal: {
|
|
6
|
+
size: null,
|
|
7
|
+
isVisible: null,
|
|
8
|
+
position: null
|
|
9
|
+
},
|
|
10
|
+
vertical: {
|
|
11
|
+
size: null,
|
|
12
|
+
isVisible: null,
|
|
13
|
+
position: null
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
getTicksSize(axis) {
|
|
18
|
+
return this.ticks[axis].size;
|
|
19
|
+
}
|
|
20
|
+
setTicksSize(axis, payload) {
|
|
21
|
+
this.ticks[axis].size = payload;
|
|
22
|
+
}
|
|
23
|
+
getTicksVisibility(axis) {
|
|
24
|
+
return this.ticks[axis].isVisible;
|
|
25
|
+
}
|
|
26
|
+
setTicksVisibility(axis, isVisible) {
|
|
27
|
+
this.ticks[axis].isVisible = isVisible;
|
|
28
|
+
}
|
|
29
|
+
getTicksPosition(axis) {
|
|
30
|
+
return this.ticks[axis].position;
|
|
31
|
+
}
|
|
32
|
+
setTicksPosition(axis, position) {
|
|
33
|
+
this.ticks[axis].position = position;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
ChartMetaData
|
|
38
|
+
};
|
|
@@ -16,30 +16,30 @@ const style = (
|
|
|
16
16
|
/*__reshadow_css_start__*/
|
|
17
17
|
(sstyled.insert(
|
|
18
18
|
/*__inner_css_start__*/
|
|
19
|
-
".
|
|
19
|
+
".___SBar_1d6up_gg_{fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245));transition-property:height,width,y;transition-duration:var(--duration_1d6up);transition-timing-function:ease-in-out}.___SBar_1d6up_gg_.__color_1d6up_gg_{fill:var(--color_1d6up)}.___SBar_1d6up_gg_.__pattern_1d6up_gg_.__color_1d6up_gg_{fill:var(--pattern_1d6up);stroke:var(--color_1d6up);stroke-width:1px}.___SBar_1d6up_gg_.__hide_1d6up_gg_{display:none}.___SBar_1d6up_gg_.__transparent_1d6up_gg_{opacity:.3}.___SBar_1d6up_gg_.__onClick_1d6up_gg_{cursor:pointer}.___SBackground_1d6up_gg_{fill:var(--intergalactic-chart-grid-bar-base-bg,oklch(.92 .008 233.5));opacity:.4}.___SBackground_1d6up_gg_.__onClick_1d6up_gg_{cursor:pointer}.___SBarAnnotation_1d6up_gg_{display:flex;justify-content:space-between}.___SBarLabel_1d6up_gg_{color:var(--intergalactic-text-primary,oklch(.23 .009 245));margin-right:auto}.___SBarLabel_1d6up_gg_,.___SBarPercent_1d6up_gg_{font-size:var(--intergalactic-fs-200,14px);line-height:var(--intergalactic-lh-200,1.4286)}.___SBarPercent_1d6up_gg_{color:var(--intergalactic-text-secondary,oklch(.182 .045 244.8/.593));margin-right:var(--intergalactic-spacing-2x,8px)}.___SBarValue_1d6up_gg_{min-width:52px;display:flex;justify-content:flex-end;color:var(--intergalactic-text-primary,oklch(.23 .009 245));font-size:var(--intergalactic-fs-200,14px);line-height:var(--intergalactic-lh-200,1.4286);text-align:right}.___SCompactHorizontalBarHoverRect_1d6up_gg_{fill:var(--intergalactic-chart-grid-bar-hover,oklch(.375 .09 242.7/.05))}",
|
|
20
20
|
/*__inner_css_end__*/
|
|
21
|
-
"
|
|
21
|
+
"1d6up_gg_"
|
|
22
22
|
), /*__reshadow_css_end__*/
|
|
23
23
|
{
|
|
24
|
-
"__SBar": "
|
|
25
|
-
"--duration": "--
|
|
26
|
-
"_color": "
|
|
27
|
-
"--color": "--
|
|
28
|
-
"_pattern": "
|
|
29
|
-
"--pattern": "--
|
|
30
|
-
"_hide": "
|
|
31
|
-
"_transparent": "
|
|
32
|
-
"_onClick": "
|
|
33
|
-
"__SBackground": "
|
|
34
|
-
"__SBarAnnotation": "
|
|
35
|
-
"__SBarLabel": "
|
|
36
|
-
"__SBarPercent": "
|
|
37
|
-
"__SBarValue": "
|
|
38
|
-
"__SCompactHorizontalBarHoverRect": "
|
|
24
|
+
"__SBar": "___SBar_1d6up_gg_",
|
|
25
|
+
"--duration": "--duration_1d6up",
|
|
26
|
+
"_color": "__color_1d6up_gg_",
|
|
27
|
+
"--color": "--color_1d6up",
|
|
28
|
+
"_pattern": "__pattern_1d6up_gg_",
|
|
29
|
+
"--pattern": "--pattern_1d6up",
|
|
30
|
+
"_hide": "__hide_1d6up_gg_",
|
|
31
|
+
"_transparent": "__transparent_1d6up_gg_",
|
|
32
|
+
"_onClick": "__onClick_1d6up_gg_",
|
|
33
|
+
"__SBackground": "___SBackground_1d6up_gg_",
|
|
34
|
+
"__SBarAnnotation": "___SBarAnnotation_1d6up_gg_",
|
|
35
|
+
"__SBarLabel": "___SBarLabel_1d6up_gg_",
|
|
36
|
+
"__SBarPercent": "___SBarPercent_1d6up_gg_",
|
|
37
|
+
"__SBarValue": "___SBarValue_1d6up_gg_",
|
|
38
|
+
"__SCompactHorizontalBarHoverRect": "___SCompactHorizontalBarHoverRect_1d6up_gg_"
|
|
39
39
|
})
|
|
40
40
|
);
|
|
41
41
|
const MIN_WIDTH = 4;
|
|
42
|
-
const barHeight =
|
|
42
|
+
const barHeight = 12;
|
|
43
43
|
const hoverOffset = 6;
|
|
44
44
|
class CompactHorizontalBarRoot extends Component {
|
|
45
45
|
constructor(...args) {
|
package/lib/esm/Donut.mjs
CHANGED
|
@@ -17,19 +17,19 @@ const style = (
|
|
|
17
17
|
/*__reshadow_css_start__*/
|
|
18
18
|
(sstyled.insert(
|
|
19
19
|
/*__inner_css_start__*/
|
|
20
|
-
".
|
|
20
|
+
".___SPie_1oosh_gg_{stroke:var(--intergalactic-chart-grid-border,#fff);fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245))}.___SPie_1oosh_gg_.__color_1oosh_gg_{fill:var(--color_1oosh)}.___SPie_1oosh_gg_.__pattern_1oosh_gg_.__color_1oosh_gg_{fill:var(--pattern_1oosh);stroke:var(--color_1oosh);stroke-width:1px}.___SPie_1oosh_gg_.__transparent_1oosh_gg_{opacity:.3}.___SEmptyData_1oosh_gg_{fill:var(--intergalactic-chart-palette-order-null,oklch(.9 .009 234))}.___SEmptyData_1oosh_gg_.__color_1oosh_gg_{fill:var(--color_1oosh)}.___SLabel_1oosh_gg_{text-anchor:middle;vertical-anchor:middle;font-size:var(--intergalactic-fs-200,14px);line-height:var(--intergalactic-lh-200,1.4286)}",
|
|
21
21
|
/*__inner_css_end__*/
|
|
22
|
-
"
|
|
22
|
+
"1oosh_gg_"
|
|
23
23
|
), /*__reshadow_css_end__*/
|
|
24
24
|
{
|
|
25
|
-
"__SPie": "
|
|
26
|
-
"_color": "
|
|
27
|
-
"--color": "--
|
|
28
|
-
"_pattern": "
|
|
29
|
-
"--pattern": "--
|
|
30
|
-
"_transparent": "
|
|
31
|
-
"__SEmptyData": "
|
|
32
|
-
"__SLabel": "
|
|
25
|
+
"__SPie": "___SPie_1oosh_gg_",
|
|
26
|
+
"_color": "__color_1oosh_gg_",
|
|
27
|
+
"--color": "--color_1oosh",
|
|
28
|
+
"_pattern": "__pattern_1oosh_gg_",
|
|
29
|
+
"--pattern": "--pattern_1oosh",
|
|
30
|
+
"_transparent": "__transparent_1oosh_gg_",
|
|
31
|
+
"__SEmptyData": "___SEmptyData_1oosh_gg_",
|
|
32
|
+
"__SLabel": "___SLabel_1oosh_gg_"
|
|
33
33
|
})
|
|
34
34
|
);
|
|
35
35
|
const DEFAULT_INSTANCE = /* @__PURE__ */ Symbol("DEFAULT_INSTANCE");
|
|
@@ -83,7 +83,8 @@ function transitionRadiusPie({
|
|
|
83
83
|
};
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
const increaseFactor =
|
|
86
|
+
const increaseFactor = 4;
|
|
87
|
+
const donutThickness = 16;
|
|
87
88
|
function getOuterRadius({
|
|
88
89
|
size,
|
|
89
90
|
halfsize
|
|
@@ -118,11 +119,11 @@ class DonutRoot extends Component {
|
|
|
118
119
|
}) => {
|
|
119
120
|
const {
|
|
120
121
|
duration,
|
|
121
|
-
innerRadius,
|
|
122
122
|
d3Arc,
|
|
123
123
|
paddingAngle
|
|
124
124
|
} = this.asProps;
|
|
125
125
|
const outerRadius = d3Arc.outerRadius()();
|
|
126
|
+
const innerRadius = d3Arc.innerRadius()();
|
|
126
127
|
const outerRadiusStartEnd = active ? [+element.dataset["currentRadius"] || outerRadius, outerRadius + increaseFactor] : [+element.dataset["currentRadius"] || outerRadius, outerRadius];
|
|
127
128
|
if (this.canAnimatedHover && duration > 0) {
|
|
128
129
|
transitionRadiusPie({
|
|
@@ -324,7 +325,7 @@ _defineProperty(DonutRoot, "displayName", "Donut");
|
|
|
324
325
|
_defineProperty(DonutRoot, "style", style);
|
|
325
326
|
_defineProperty(DonutRoot, "enhance", [uniqueIDEnhancement()]);
|
|
326
327
|
_defineProperty(DonutRoot, "defaultProps", ({
|
|
327
|
-
innerRadius
|
|
328
|
+
innerRadius: innerRadiusProp,
|
|
328
329
|
paddingAngle = 0,
|
|
329
330
|
outerRadius,
|
|
330
331
|
halfsize = false,
|
|
@@ -332,15 +333,13 @@ _defineProperty(DonutRoot, "defaultProps", ({
|
|
|
332
333
|
size
|
|
333
334
|
}
|
|
334
335
|
}) => {
|
|
335
|
-
const
|
|
336
|
-
size,
|
|
337
|
-
halfsize,
|
|
338
|
-
outerRadius
|
|
339
|
-
})).innerRadius(innerRadius).padAngle(paddingAngle);
|
|
340
|
-
const d3ArcOut = arc().outerRadius((outerRadius || getOuterRadius({
|
|
336
|
+
const radius = outerRadius || getOuterRadius({
|
|
341
337
|
size,
|
|
342
338
|
halfsize
|
|
343
|
-
})
|
|
339
|
+
});
|
|
340
|
+
const innerRadius = innerRadiusProp ?? Math.max(radius - donutThickness, 0);
|
|
341
|
+
const d3Arc = arc().outerRadius(radius).innerRadius(innerRadius).padAngle(paddingAngle);
|
|
342
|
+
const d3ArcOut = arc().outerRadius(radius + increaseFactor).innerRadius(innerRadius).padAngle(paddingAngle);
|
|
344
343
|
let d3Pie = pie().sort(null).value(([, value]) => value);
|
|
345
344
|
d3Pie[DEFAULT_INSTANCE] = true;
|
|
346
345
|
if (halfsize) {
|
package/lib/esm/Dots.mjs
CHANGED
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
import { sstyled } from "@semcore/core";
|
|
2
2
|
import trottle from "@semcore/core/lib/utils/rafTrottle";
|
|
3
|
+
import { useUID } from "@semcore/core/lib/utils/uniqueID";
|
|
3
4
|
import { bisector } from "d3-array";
|
|
4
5
|
import React from "react";
|
|
6
|
+
import { INSIGHTFUL, BAD, GOOD, HIGHLIGHT_DOT } from "./component/Chart/AbstractChart.type.mjs";
|
|
5
7
|
import createElement from "./createElement.mjs";
|
|
6
|
-
import { getPatternSymbolSize, PatternSymbol } from "./Pattern.mjs";
|
|
8
|
+
import { getPatternSymbolSize, PotentialGradient, PatternSymbol } from "./Pattern.mjs";
|
|
7
9
|
import { getChartDefaultColorName, interpolateValue, eventToPoint, invert } from "./utils.mjs";
|
|
8
10
|
/*!__reshadow-styles__:"./style/dot.shadow.css"*/
|
|
9
11
|
const style = (
|
|
10
12
|
/*__reshadow_css_start__*/
|
|
11
13
|
(sstyled.insert(
|
|
12
14
|
/*__inner_css_start__*/
|
|
13
|
-
".
|
|
15
|
+
".___SDots_1bl4y_gg_ .___SDot_1bl4y_gg_{transition-duration:var(--duration_1bl4y)}.___SDot_1bl4y_gg_{stroke-width:1px;stroke:var(--intergalactic-chart-grid-border,#fff);fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245));transition-property:cx,cy,x,y,filter;transition-timing-function:ease-in-out}.___SDot_1bl4y_gg_.__active_1bl4y_gg_{filter:drop-shadow(0 0 1px rgba(0,12,8,.161)) drop-shadow(0 1px 1px rgba(0,12,8,.161))}@media (color-gamut:p3){.___SDot_1bl4y_gg_.__active_1bl4y_gg_{filter:drop-shadow(0 0 1px oklch(.137 .026 175.7/.161)) drop-shadow(0 1px 1px oklch(.137 .026 175.7/.161))}}.___SDot_1bl4y_gg_.__hide_1bl4y_gg_{display:none}.___SDot_1bl4y_gg_.__color_1bl4y_gg_{fill:var(--color_1bl4y)}.___SDotHighlight_1bl4y_gg_.__color_1bl4y_gg_{opacity:.4;fill:var(--color_1bl4y)}.___SDotHighlight_1bl4y_gg_.__transparent_1bl4y_gg_{opacity:.12}.___SDotBorder_1bl4y_gg_{fill:none;stroke-width:1px;stroke:var(--intergalactic-chart-grid-dot-outer-border,#191d211a);stroke-dasharray:2}.___SDotBorder_1bl4y_gg_.__transparent_1bl4y_gg_{opacity:.03}.___SDot_1bl4y_gg_.__transparent_1bl4y_gg_{opacity:.3}.___SDotBackdrop_1bl4y_gg_{stroke-width:1px;stroke:var(--intergalactic-chart-grid-border,#fff);fill:var(--intergalactic-chart-grid-border,#fff);transition-property:cx,cy;transition-duration:var(--duration_1bl4y);transition-timing-function:ease-in-out}.___SDotBackdrop_1bl4y_gg_.__hide_1bl4y_gg_{display:none}",
|
|
14
16
|
/*__inner_css_end__*/
|
|
15
|
-
"
|
|
17
|
+
"1bl4y_gg_"
|
|
16
18
|
), /*__reshadow_css_end__*/
|
|
17
19
|
{
|
|
18
|
-
"__SDot": "
|
|
19
|
-
"_active": "
|
|
20
|
-
"_hide": "
|
|
21
|
-
"_color": "
|
|
22
|
-
"--color": "--
|
|
23
|
-
"_transparent": "
|
|
24
|
-
"__SDots": "
|
|
25
|
-
"--duration": "--
|
|
20
|
+
"__SDot": "___SDot_1bl4y_gg_",
|
|
21
|
+
"_active": "__active_1bl4y_gg_",
|
|
22
|
+
"_hide": "__hide_1bl4y_gg_",
|
|
23
|
+
"_color": "__color_1bl4y_gg_",
|
|
24
|
+
"--color": "--color_1bl4y",
|
|
25
|
+
"_transparent": "__transparent_1bl4y_gg_",
|
|
26
|
+
"__SDots": "___SDots_1bl4y_gg_",
|
|
27
|
+
"--duration": "--duration_1bl4y",
|
|
28
|
+
"__SDotHighlight": "___SDotHighlight_1bl4y_gg_",
|
|
29
|
+
"__SDotBorder": "___SDotBorder_1bl4y_gg_",
|
|
30
|
+
"__SDotBackdrop": "___SDotBackdrop_1bl4y_gg_"
|
|
26
31
|
})
|
|
27
32
|
);
|
|
28
33
|
const BASE_RADIUS = 3.5;
|
|
29
34
|
const ACTIVE_RADIUS = 4.5;
|
|
30
35
|
function Dots(props) {
|
|
31
36
|
var _ref3;
|
|
37
|
+
const SDotHighlight = "circle";
|
|
38
|
+
const SDotBorder = "circle";
|
|
39
|
+
const SDotBackdrop = "circle";
|
|
32
40
|
const {
|
|
33
41
|
Element: SDot,
|
|
34
42
|
styles,
|
|
@@ -48,6 +56,7 @@ function Dots(props) {
|
|
|
48
56
|
patterns,
|
|
49
57
|
onClick
|
|
50
58
|
} = props;
|
|
59
|
+
const uid = useUID();
|
|
51
60
|
const bisect = bisector((d) => d[x]).center;
|
|
52
61
|
const [activeIndex, setActiveIndex] = React.useState(null);
|
|
53
62
|
const patternKey = color || getChartDefaultColorName(0);
|
|
@@ -71,6 +80,21 @@ function Dots(props) {
|
|
|
71
80
|
const index = bisect(data, vX);
|
|
72
81
|
onClick(index, e);
|
|
73
82
|
}, [scale, data, onClick]);
|
|
83
|
+
const resolveHighlightColor = React.useCallback((highlight) => {
|
|
84
|
+
switch (highlight) {
|
|
85
|
+
case GOOD: {
|
|
86
|
+
return resolveColor("--intergalactic-chart-data-success");
|
|
87
|
+
}
|
|
88
|
+
case BAD: {
|
|
89
|
+
return resolveColor("--intergalactic-chart-data-critical");
|
|
90
|
+
}
|
|
91
|
+
case INSIGHTFUL: {
|
|
92
|
+
return `url(#dotGradient_${uid})`;
|
|
93
|
+
}
|
|
94
|
+
default:
|
|
95
|
+
return "";
|
|
96
|
+
}
|
|
97
|
+
}, [uid, resolveColor]);
|
|
74
98
|
React.useEffect(() => {
|
|
75
99
|
const unsubscribeMouseMoveRoot = eventEmitter.subscribe("onMouseMoveChart", (e) => {
|
|
76
100
|
e.persist();
|
|
@@ -90,13 +114,38 @@ function Dots(props) {
|
|
|
90
114
|
const isPrev = d3.defined()(data[i - 1] || {});
|
|
91
115
|
const isNext = d3.defined()(data[i + 1] || {});
|
|
92
116
|
const active = i === activeIndex;
|
|
93
|
-
const visible = typeof display === "function" ? display(i,
|
|
117
|
+
const visible = typeof display === "function" ? display(i, active, !isPrev && !isNext, d) : display || active || !isPrev && !isNext;
|
|
94
118
|
const radius = active ? ACTIVE_RADIUS : radiusBase;
|
|
95
119
|
if (!d3.defined()(d)) return acc;
|
|
96
120
|
if (!visible) return acc;
|
|
97
121
|
if (!patterns) {
|
|
98
122
|
var _ref;
|
|
99
|
-
acc.push((_ref = sstyled(styles), /* @__PURE__ */ React.createElement(
|
|
123
|
+
acc.push((_ref = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
124
|
+
key: i
|
|
125
|
+
}, d[HIGHLIGHT_DOT] && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SDotBorder, _ref.cn("SDotBorder", {
|
|
126
|
+
"visible": visible,
|
|
127
|
+
"active": active,
|
|
128
|
+
"hide": hide,
|
|
129
|
+
"transparent": transparent,
|
|
130
|
+
"cx": d3.x()(d),
|
|
131
|
+
"cy": d3.y()(d),
|
|
132
|
+
"r": 11.5
|
|
133
|
+
})), /* @__PURE__ */ React.createElement(SDotHighlight, _ref.cn("SDotHighlight", {
|
|
134
|
+
"color": resolveHighlightColor(d[HIGHLIGHT_DOT]),
|
|
135
|
+
"value": d,
|
|
136
|
+
"visible": visible,
|
|
137
|
+
"active": active,
|
|
138
|
+
"hide": hide,
|
|
139
|
+
"transparent": transparent,
|
|
140
|
+
"cx": d3.x()(d),
|
|
141
|
+
"cy": d3.y()(d),
|
|
142
|
+
"r": 8.5
|
|
143
|
+
}))), transparent && /* @__PURE__ */ React.createElement(SDotBackdrop, _ref.cn("SDotBackdrop", {
|
|
144
|
+
"hide": hide,
|
|
145
|
+
"cx": d3.x()(d),
|
|
146
|
+
"cy": d3.y()(d),
|
|
147
|
+
"r": radius
|
|
148
|
+
})), /* @__PURE__ */ React.createElement(SDot, _ref.cn("SDot", {
|
|
100
149
|
"render": "circle",
|
|
101
150
|
"color": resolveColor(color),
|
|
102
151
|
"patternKey": patternKey,
|
|
@@ -111,7 +160,7 @@ function Dots(props) {
|
|
|
111
160
|
"cy": d3.y()(d),
|
|
112
161
|
"r": radius,
|
|
113
162
|
"__excludeProps": ["display", "data", "scale"]
|
|
114
|
-
}))));
|
|
163
|
+
})))));
|
|
115
164
|
} else {
|
|
116
165
|
var _ref2;
|
|
117
166
|
acc.push((_ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SDot, _ref2.cn("SDot", {
|
|
@@ -135,7 +184,9 @@ function Dots(props) {
|
|
|
135
184
|
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SDots, _ref3.cn("SDots", {
|
|
136
185
|
"duration": `${duration}ms`,
|
|
137
186
|
"onClickCapture": handlerOnClick
|
|
138
|
-
}),
|
|
187
|
+
}), /* @__PURE__ */ React.createElement(PotentialGradient, _ref3.cn("PotentialGradient", {
|
|
188
|
+
"id": `dotGradient_${uid}`
|
|
189
|
+
})), patterns && /* @__PURE__ */ React.createElement(PatternSymbol, _ref3.cn("PatternSymbol", {
|
|
139
190
|
"color": resolveColor(color),
|
|
140
191
|
"patternKey": color,
|
|
141
192
|
"id": svgPatternId,
|
package/lib/esm/GroupBar.mjs
CHANGED
|
@@ -13,7 +13,8 @@ class GroupBarRoot extends Component {
|
|
|
13
13
|
Children,
|
|
14
14
|
scale,
|
|
15
15
|
scaleGroup,
|
|
16
|
-
x
|
|
16
|
+
x,
|
|
17
|
+
maxBarSize
|
|
17
18
|
} = this.asProps;
|
|
18
19
|
const xyScale = x ? scale[0] : scale[1];
|
|
19
20
|
if (scaleGroup) return scaleGroup;
|
|
@@ -26,7 +27,9 @@ class GroupBarRoot extends Component {
|
|
|
26
27
|
}
|
|
27
28
|
return acc;
|
|
28
29
|
}, []);
|
|
29
|
-
|
|
30
|
+
const groupWidth = scaleToBand(xyScale).bandwidth();
|
|
31
|
+
const paddingOuter = maxBarSize !== void 0 && maxBarSize < groupWidth ? 1 - maxBarSize / groupWidth : 0.1;
|
|
32
|
+
return scaleBand().range([0, scaleToBand(xyScale).bandwidth()]).domain(domain).paddingInner(0.1).paddingOuter(paddingOuter);
|
|
30
33
|
}
|
|
31
34
|
getBarProps({
|
|
32
35
|
y
|
|
@@ -11,26 +11,26 @@ const style = (
|
|
|
11
11
|
/*__reshadow_css_start__*/
|
|
12
12
|
(sstyled.insert(
|
|
13
13
|
/*__inner_css_start__*/
|
|
14
|
-
".
|
|
14
|
+
".___SBar_1d6up_gg_{fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245));transition-property:height,width,y;transition-duration:var(--duration_1d6up);transition-timing-function:ease-in-out}.___SBar_1d6up_gg_.__color_1d6up_gg_{fill:var(--color_1d6up)}.___SBar_1d6up_gg_.__pattern_1d6up_gg_.__color_1d6up_gg_{fill:var(--pattern_1d6up);stroke:var(--color_1d6up);stroke-width:1px}.___SBar_1d6up_gg_.__hide_1d6up_gg_{display:none}.___SBar_1d6up_gg_.__transparent_1d6up_gg_{opacity:.3}.___SBar_1d6up_gg_.__onClick_1d6up_gg_{cursor:pointer}.___SBackground_1d6up_gg_{fill:var(--intergalactic-chart-grid-bar-base-bg,oklch(.92 .008 233.5));opacity:.4}.___SBackground_1d6up_gg_.__onClick_1d6up_gg_{cursor:pointer}.___SBarAnnotation_1d6up_gg_{display:flex;justify-content:space-between}.___SBarLabel_1d6up_gg_{color:var(--intergalactic-text-primary,oklch(.23 .009 245));margin-right:auto}.___SBarLabel_1d6up_gg_,.___SBarPercent_1d6up_gg_{font-size:var(--intergalactic-fs-200,14px);line-height:var(--intergalactic-lh-200,1.4286)}.___SBarPercent_1d6up_gg_{color:var(--intergalactic-text-secondary,oklch(.182 .045 244.8/.593));margin-right:var(--intergalactic-spacing-2x,8px)}.___SBarValue_1d6up_gg_{min-width:52px;display:flex;justify-content:flex-end;color:var(--intergalactic-text-primary,oklch(.23 .009 245));font-size:var(--intergalactic-fs-200,14px);line-height:var(--intergalactic-lh-200,1.4286);text-align:right}.___SCompactHorizontalBarHoverRect_1d6up_gg_{fill:var(--intergalactic-chart-grid-bar-hover,oklch(.375 .09 242.7/.05))}",
|
|
15
15
|
/*__inner_css_end__*/
|
|
16
|
-
"
|
|
16
|
+
"1d6up_gg_"
|
|
17
17
|
), /*__reshadow_css_end__*/
|
|
18
18
|
{
|
|
19
|
-
"__SBar": "
|
|
20
|
-
"--duration": "--
|
|
21
|
-
"_color": "
|
|
22
|
-
"--color": "--
|
|
23
|
-
"_pattern": "
|
|
24
|
-
"--pattern": "--
|
|
25
|
-
"_hide": "
|
|
26
|
-
"_transparent": "
|
|
27
|
-
"_onClick": "
|
|
28
|
-
"__SBackground": "
|
|
29
|
-
"__SBarAnnotation": "
|
|
30
|
-
"__SBarLabel": "
|
|
31
|
-
"__SBarPercent": "
|
|
32
|
-
"__SBarValue": "
|
|
33
|
-
"__SCompactHorizontalBarHoverRect": "
|
|
19
|
+
"__SBar": "___SBar_1d6up_gg_",
|
|
20
|
+
"--duration": "--duration_1d6up",
|
|
21
|
+
"_color": "__color_1d6up_gg_",
|
|
22
|
+
"--color": "--color_1d6up",
|
|
23
|
+
"_pattern": "__pattern_1d6up_gg_",
|
|
24
|
+
"--pattern": "--pattern_1d6up",
|
|
25
|
+
"_hide": "__hide_1d6up_gg_",
|
|
26
|
+
"_transparent": "__transparent_1d6up_gg_",
|
|
27
|
+
"_onClick": "__onClick_1d6up_gg_",
|
|
28
|
+
"__SBackground": "___SBackground_1d6up_gg_",
|
|
29
|
+
"__SBarAnnotation": "___SBarAnnotation_1d6up_gg_",
|
|
30
|
+
"__SBarLabel": "___SBarLabel_1d6up_gg_",
|
|
31
|
+
"__SBarPercent": "___SBarPercent_1d6up_gg_",
|
|
32
|
+
"__SBarValue": "___SBarValue_1d6up_gg_",
|
|
33
|
+
"__SCompactHorizontalBarHoverRect": "___SCompactHorizontalBarHoverRect_1d6up_gg_"
|
|
34
34
|
})
|
|
35
35
|
);
|
|
36
36
|
const MIN_WIDTH = 2;
|
package/lib/esm/Hover.mjs
CHANGED
|
@@ -7,29 +7,33 @@ import React from "react";
|
|
|
7
7
|
import createElement from "./createElement.mjs";
|
|
8
8
|
import Tooltip from "./Tooltip.mjs";
|
|
9
9
|
import { eventToPoint, invert, getIndexFromData, scaleOfBandwidth, scaleToBand } from "./utils.mjs";
|
|
10
|
-
import { TextMeasurer } from "./utils/TextMeasurer.mjs";
|
|
11
10
|
/*!__reshadow-styles__:"./style/hover.shadow.css"*/
|
|
12
11
|
const style = (
|
|
13
12
|
/*__reshadow_css_start__*/
|
|
14
13
|
(sstyled.insert(
|
|
15
14
|
/*__inner_css_start__*/
|
|
16
|
-
|
|
15
|
+
'.___SHoverLine_zj7nr_gg_,.___SHoverLine_zj7nr_gg_:focus-visible{outline:none;stroke:var(--intergalactic-chart-grid-x-axis,oklch(.88 .011 234.9))}.___SHoverRect_zj7nr_gg_,.___SHoverRect_zj7nr_gg_:focus-visible{outline:none;fill:var(--intergalactic-chart-grid-bar-hover,oklch(.375 .09 242.7/.05))}.___SHoveredTickWrapper_zj7nr_gg_{font-size:var(--intergalactic-fs-100,12px);font-feature-settings:"tnum";font-variant-numeric:tabular-nums;line-height:var(--intergalactic-lh-100,1.3334);color:var(--intergalactic-chart-grid-text-label,#00132466);text-align:center}.___SHoveredTickWrapper_zj7nr_gg_[data-is-first=true]{text-align:left}.___SHoveredTickWrapper_zj7nr_gg_[data-is-last=true]{text-align:right}.___SHoveredTickWrapper_zj7nr_gg_._position_top_zj7nr_gg_ .___SHoveredTickContent_zj7nr_gg_{align-content:end}.___SHoveredTickWrapper_zj7nr_gg_ .___SHoveredTickContent_zj7nr_gg_{height:100%}.___SHoveredTickWrapper_zj7nr_gg_ .___SHoveredTick_zj7nr_gg_{display:inline-block;padding:3px 12px;border-radius:6px;background-color:var(--intergalactic-chart-x-axis-accent-tick,oklch(.96 .005 232.5))}',
|
|
17
16
|
/*__inner_css_end__*/
|
|
18
|
-
"
|
|
17
|
+
"zj7nr_gg_"
|
|
19
18
|
), /*__reshadow_css_end__*/
|
|
20
19
|
{
|
|
21
|
-
"__SHoverLine": "
|
|
22
|
-
"__SHoverRect": "
|
|
23
|
-
"
|
|
24
|
-
"
|
|
20
|
+
"__SHoverLine": "___SHoverLine_zj7nr_gg_",
|
|
21
|
+
"__SHoverRect": "___SHoverRect_zj7nr_gg_",
|
|
22
|
+
"__SHoveredTickWrapper": "___SHoveredTickWrapper_zj7nr_gg_",
|
|
23
|
+
"_position_top": "_position_top_zj7nr_gg_",
|
|
24
|
+
"__SHoveredTickContent": "___SHoveredTickContent_zj7nr_gg_",
|
|
25
|
+
"__SHoveredTick": "___SHoveredTick_zj7nr_gg_"
|
|
25
26
|
})
|
|
26
27
|
);
|
|
27
28
|
const STROKE_WIDTH = 1;
|
|
28
29
|
const NOTCH_WIDTH = 9;
|
|
29
30
|
const NOTCH_DELTA = NOTCH_WIDTH / 2 - STROKE_WIDTH / 4;
|
|
30
|
-
function formatValue(value) {
|
|
31
|
+
function formatValue(locale, value) {
|
|
31
32
|
if (value instanceof Date) {
|
|
32
|
-
return
|
|
33
|
+
return new Intl.DateTimeFormat(locale ?? "en", {
|
|
34
|
+
day: "numeric",
|
|
35
|
+
month: "short"
|
|
36
|
+
}).format(value);
|
|
33
37
|
}
|
|
34
38
|
return value;
|
|
35
39
|
}
|
|
@@ -40,7 +44,6 @@ class Hover extends Component {
|
|
|
40
44
|
xIndex: null,
|
|
41
45
|
yIndex: null
|
|
42
46
|
});
|
|
43
|
-
_defineProperty(this, "measurer", new TextMeasurer());
|
|
44
47
|
_defineProperty(this, "virtualElement", canUseDOM() ? document.createElement("div") : {});
|
|
45
48
|
_defineProperty(this, "handlerMouseMoveRoot", trottle((e, currentTarget, isTickUnder) => {
|
|
46
49
|
const {
|
|
@@ -130,7 +133,9 @@ class HoverLineRoot extends Hover {
|
|
|
130
133
|
render() {
|
|
131
134
|
var _ref3;
|
|
132
135
|
const {
|
|
133
|
-
hideHoverLine
|
|
136
|
+
hideHoverLine,
|
|
137
|
+
meta,
|
|
138
|
+
locale
|
|
134
139
|
} = this.asProps;
|
|
135
140
|
const {
|
|
136
141
|
xIndex,
|
|
@@ -176,14 +181,15 @@ class HoverLineRoot extends Hover {
|
|
|
176
181
|
"y1": yRange[1],
|
|
177
182
|
"y2": yRange[1]
|
|
178
183
|
}))), !hideTickHover && /* @__PURE__ */ React.createElement(HoveredTick, _ref3.cn("HoveredTick", {
|
|
179
|
-
"
|
|
184
|
+
"size": meta.getTicksSize("horizontal"),
|
|
185
|
+
"position": meta.getTicksPosition("horizontal"),
|
|
186
|
+
"tickFormatter": dataHints.titles.getHorizontalAxesTitle ?? formatValue.bind(null, locale),
|
|
180
187
|
"value": data[xIndex]?.[x],
|
|
181
188
|
"isFirstTick": xIndex === 0,
|
|
182
189
|
"isLastTick": xIndex === data.length - 1,
|
|
183
|
-
"textMeasurer": this.measurer,
|
|
184
190
|
"styles": styles,
|
|
185
191
|
"x": x1,
|
|
186
|
-
"
|
|
192
|
+
"yRange": yRange
|
|
187
193
|
}))) : null, yIndex !== null ? /* @__PURE__ */ React.createElement(SHoverLine, _ref3.cn("SHoverLine", {
|
|
188
194
|
"render": "g",
|
|
189
195
|
"index": yIndex,
|
|
@@ -212,7 +218,8 @@ class HoverRectRoot extends Hover {
|
|
|
212
218
|
render() {
|
|
213
219
|
var _ref4;
|
|
214
220
|
const {
|
|
215
|
-
hideHoverLine
|
|
221
|
+
hideHoverLine,
|
|
222
|
+
meta
|
|
216
223
|
} = this.asProps;
|
|
217
224
|
if (hideHoverLine) {
|
|
218
225
|
return null;
|
|
@@ -225,7 +232,8 @@ class HoverRectRoot extends Hover {
|
|
|
225
232
|
data,
|
|
226
233
|
scale,
|
|
227
234
|
dataHints,
|
|
228
|
-
hideTickHover
|
|
235
|
+
hideTickHover,
|
|
236
|
+
locale
|
|
229
237
|
} = this.asProps;
|
|
230
238
|
const {
|
|
231
239
|
xIndex,
|
|
@@ -249,12 +257,13 @@ class HoverRectRoot extends Hover {
|
|
|
249
257
|
"x": xScale(data[xIndex][x]) - xStep * xPaddingInner / 2,
|
|
250
258
|
"y": yRange[1]
|
|
251
259
|
})), !hideTickHover && /* @__PURE__ */ React.createElement(HoveredTick, _ref4.cn("HoveredTick", {
|
|
252
|
-
"
|
|
260
|
+
"size": meta.getTicksSize("horizontal"),
|
|
261
|
+
"position": meta.getTicksPosition("horizontal"),
|
|
262
|
+
"tickFormatter": dataHints.titles.getHorizontalAxesTitle ?? formatValue.bind(null, locale),
|
|
253
263
|
"value": data[xIndex]?.[x],
|
|
254
|
-
"textMeasurer": this.measurer,
|
|
255
264
|
"styles": styles,
|
|
256
265
|
"x": xScale(data[xIndex][x]) + xStep * (1 - xPaddingInner) / 2,
|
|
257
|
-
"
|
|
266
|
+
"yRange": yRange
|
|
258
267
|
}))), yIndex !== null && /* @__PURE__ */ React.createElement(SHoverRect, _ref4.cn("SHoverRect", {
|
|
259
268
|
"aria-hidden": true,
|
|
260
269
|
"render": "rect",
|
|
@@ -267,53 +276,47 @@ class HoverRectRoot extends Hover {
|
|
|
267
276
|
}
|
|
268
277
|
}
|
|
269
278
|
_defineProperty(HoverRectRoot, "displayName", "HoverRect");
|
|
279
|
+
const HOVERED_TICK_MARGIN_Y = 8;
|
|
280
|
+
const HOVERED_TICK_PADDING_Y = 3;
|
|
270
281
|
const HOVERED_TICK_PADDING_X = 12;
|
|
271
|
-
const HOVERED_TICK_PADDING_Y = 4;
|
|
272
|
-
const HOVERED_TOCK_BORDER_RADIUS = 6;
|
|
273
282
|
function HoveredTick(props) {
|
|
274
283
|
var _ref5;
|
|
275
284
|
const {
|
|
276
|
-
paddingX = HOVERED_TICK_PADDING_X,
|
|
277
|
-
paddingY = HOVERED_TICK_PADDING_Y,
|
|
278
|
-
borderRadius = HOVERED_TOCK_BORDER_RADIUS,
|
|
279
285
|
tickFormatter,
|
|
280
286
|
value,
|
|
281
287
|
isFirstTick = false,
|
|
282
288
|
isLastTick = false,
|
|
283
|
-
textMeasurer,
|
|
284
289
|
styles,
|
|
285
290
|
x,
|
|
286
|
-
|
|
291
|
+
yRange,
|
|
292
|
+
size,
|
|
293
|
+
position
|
|
287
294
|
} = props;
|
|
288
|
-
const
|
|
289
|
-
const STickHover = "rect";
|
|
290
|
-
const STick = "text";
|
|
295
|
+
const contentRef = React.useRef(null);
|
|
291
296
|
const formattedValue = tickFormatter(value);
|
|
297
|
+
if (size?.width === void 0 || size?.height === void 0 || position === null) return null;
|
|
292
298
|
const {
|
|
293
|
-
width
|
|
294
|
-
height
|
|
295
|
-
} =
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const
|
|
300
|
-
const tickX = isFirstTick ? x
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
})), /* @__PURE__ */ React.createElement(STick, _ref5.cn("STick", {
|
|
315
|
-
...tickPos
|
|
316
|
-
}), formattedValue));
|
|
299
|
+
width,
|
|
300
|
+
height
|
|
301
|
+
} = size;
|
|
302
|
+
const SHoveredTickWrapper = "foreignObject";
|
|
303
|
+
const SHoveredTickContent = "div";
|
|
304
|
+
const SHoveredTick = "span";
|
|
305
|
+
const w = width + HOVERED_TICK_PADDING_X * 2;
|
|
306
|
+
const tickX = isFirstTick ? x : isLastTick ? x - w : x - w / 2;
|
|
307
|
+
const tickY = position === "top" ? yRange[1] - height - HOVERED_TICK_MARGIN_Y + HOVERED_TICK_PADDING_Y : yRange[0] + HOVERED_TICK_MARGIN_Y - HOVERED_TICK_PADDING_Y;
|
|
308
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SHoveredTickWrapper, _ref5.cn("SHoveredTickWrapper", {
|
|
309
|
+
"x": tickX,
|
|
310
|
+
"y": tickY,
|
|
311
|
+
"width": w,
|
|
312
|
+
"height": height,
|
|
313
|
+
"data-is-first": isFirstTick,
|
|
314
|
+
"data-is-last": isLastTick,
|
|
315
|
+
"position": position
|
|
316
|
+
}), /* @__PURE__ */ React.createElement(SHoveredTickContent, _ref5.cn("SHoveredTickContent", {
|
|
317
|
+
"inert": "",
|
|
318
|
+
"ref": contentRef
|
|
319
|
+
}), /* @__PURE__ */ React.createElement(SHoveredTick, _ref5.cn("SHoveredTick", {}), formattedValue)));
|
|
317
320
|
}
|
|
318
321
|
function HoverLineTooltip(props) {
|
|
319
322
|
var _ref = arguments[0], _ref6;
|