@semcore/d3-chart 18.0.0-prerelease.1 → 18.0.0-prerelease.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -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 +16 -16
- 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/HorizontalBar.js +16 -16
- package/lib/cjs/Hover.js +66 -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/a11y/PlotA11yView.js +2 -2
- package/lib/cjs/component/Chart/AbstractChart.js +21 -18
- 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 +6 -3
- 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.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/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 +16 -16
- package/lib/cjs/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +7 -7
- package/lib/cjs/component/ChartLegend/LegendTable/legend-table.shadow.css +2 -2
- package/lib/cjs/index.js +55 -1
- 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 -5
- package/lib/cjs/style/axis.shadow.css +51 -60
- package/lib/cjs/style/bar.shadow.css +6 -6
- package/lib/cjs/style/bubble.shadow.css +3 -3
- package/lib/cjs/style/donut.shadow.css +2 -2
- package/lib/cjs/style/dot.shadow.css +37 -2
- package/lib/cjs/style/hover.shadow.css +30 -13
- package/lib/cjs/style/line.shadow.css +3 -3
- 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 +2 -2
- package/lib/cjs/style/reference.shadow.css +4 -4
- package/lib/cjs/style/scatterplot.shadow.css +1 -1
- package/lib/cjs/style/tooltip.shadow.css +12 -12
- 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/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 +16 -16
- 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/HorizontalBar.js +16 -16
- package/lib/es6/Hover.js +66 -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/a11y/PlotA11yView.js +2 -2
- package/lib/es6/component/Chart/AbstractChart.js +21 -18
- 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 +6 -3
- 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.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/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 +16 -16
- package/lib/es6/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +7 -7
- package/lib/es6/component/ChartLegend/LegendTable/legend-table.shadow.css +2 -2
- package/lib/es6/index.js +1 -0
- 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 -5
- package/lib/es6/style/axis.shadow.css +51 -60
- package/lib/es6/style/bar.shadow.css +6 -6
- package/lib/es6/style/bubble.shadow.css +3 -3
- package/lib/es6/style/donut.shadow.css +2 -2
- package/lib/es6/style/dot.shadow.css +37 -2
- package/lib/es6/style/hover.shadow.css +30 -13
- package/lib/es6/style/line.shadow.css +3 -3
- 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 +2 -2
- package/lib/es6/style/reference.shadow.css +4 -4
- package/lib/es6/style/scatterplot.shadow.css +1 -1
- package/lib/es6/style/tooltip.shadow.css +12 -12
- 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/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 +17 -17
- package/lib/esm/Donut.mjs +19 -20
- package/lib/esm/Dots.mjs +66 -15
- package/lib/esm/HorizontalBar.mjs +17 -17
- package/lib/esm/Hover.mjs +67 -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/a11y/PlotA11yView.mjs +3 -3
- package/lib/esm/component/Chart/AbstractChart.mjs +22 -19
- 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 +6 -3
- package/lib/esm/component/Chart/BubbleChart.mjs +4 -0
- 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/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 +17 -17
- package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +8 -8
- package/lib/esm/component/ChartLegend/LegendTable/legend-table.shadow.css +2 -2
- package/lib/esm/index.mjs +8 -0
- package/lib/esm/style/abstract-chart.shadow.css +13 -3
- package/lib/esm/style/area.shadow.css +8 -5
- package/lib/esm/style/axis.shadow.css +51 -60
- package/lib/esm/style/bar.shadow.css +6 -6
- package/lib/esm/style/bubble.shadow.css +3 -3
- package/lib/esm/style/donut.shadow.css +2 -2
- package/lib/esm/style/dot.shadow.css +37 -2
- package/lib/esm/style/hover.shadow.css +30 -13
- package/lib/esm/style/line.shadow.css +3 -3
- 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 +2 -2
- package/lib/esm/style/reference.shadow.css +4 -4
- package/lib/esm/style/scatterplot.shadow.css +1 -1
- package/lib/esm/style/tooltip.shadow.css +12 -12
- 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.map +1 -1
- package/lib/types/component/Chart/AbstractChart.type.d.ts +22 -4
- 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 +1 -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.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/utils.d.ts +4 -1
- package/lib/types/utils.d.ts.map +1 -1
- package/package.json +15 -15
- package/lib/esm/utils/TextMeasurer.mjs +0 -27
|
@@ -2,8 +2,8 @@ SPlotA11yView {
|
|
|
2
2
|
position: relative;
|
|
3
3
|
display: block;
|
|
4
4
|
background-color: var(--intergalactic-bg-primary-neutral, oklch(1 0 0));
|
|
5
|
-
color: var(--intergalactic-text-primary, oklch(0.
|
|
6
|
-
border: 3px solid var(--intergalactic-border-primary, oklch(0.
|
|
5
|
+
color: var(--intergalactic-text-primary, oklch(0.23 0.009 245));
|
|
6
|
+
border: 3px solid var(--intergalactic-border-primary, oklch(0.277 0.066 242.6 / 0.18));
|
|
7
7
|
font-size: var(--intergalactic-fs-50, 10px);
|
|
8
8
|
z-index: var(--intergalactic-z-index-overlay, 500);
|
|
9
9
|
padding: 2px;
|
|
@@ -21,6 +21,6 @@ SPlotA11yView {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
table, td, th {
|
|
24
|
-
border: 1px solid var(--intergalactic-border-primary, oklch(0.
|
|
24
|
+
border: 1px solid var(--intergalactic-border-primary, oklch(0.277 0.066 242.6 / 0.18));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
SAxis {
|
|
2
|
-
stroke: var(--intergalactic-chart-grid-line, oklch(0.
|
|
2
|
+
stroke: var(--intergalactic-chart-grid-line, oklch(0.7 0.021 242));
|
|
3
3
|
stroke-width: 1;
|
|
4
4
|
fill: transparent;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
SAxisLine,
|
|
8
8
|
SAxisTick {
|
|
9
|
-
stroke: var(--intergalactic-chart-grid-line, oklch(0.
|
|
9
|
+
stroke: var(--intergalactic-chart-grid-line, oklch(0.7 0.021 242));
|
|
10
10
|
stroke-width: 1;
|
|
11
11
|
stroke-dasharray: 2;
|
|
12
12
|
fill: transparent;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
SAxisLine[active] {
|
|
16
|
-
stroke: var(--intergalactic-chart-grid-y-accent-hover-line, oklch(0.88 0.
|
|
16
|
+
stroke: var(--intergalactic-chart-grid-y-accent-hover-line, oklch(0.88 0.011 234.9));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
SAxisLabel {
|
|
@@ -31,7 +31,7 @@ SAxisLabel[yDirection] {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
SPolygon {
|
|
34
|
-
fill: var(--intergalactic-chart-palette-order-1, oklch(0.23 0.
|
|
34
|
+
fill: var(--intergalactic-chart-palette-order-1, oklch(0.23 0.009 245));
|
|
35
35
|
opacity: 0.2;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -49,7 +49,7 @@ SPolygonDot {
|
|
|
49
49
|
stroke-width: 2px;
|
|
50
50
|
stroke: var(--intergalactic-chart-grid-border, #ffffff);
|
|
51
51
|
r: 6px;
|
|
52
|
-
fill: var(--intergalactic-chart-palette-order-1, oklch(0.23 0.
|
|
52
|
+
fill: var(--intergalactic-chart-palette-order-1, oklch(0.23 0.009 245));
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
SPolygonDot[transparent] {
|
|
@@ -61,7 +61,7 @@ SPolygonDot[color] {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
SPolygonLine {
|
|
64
|
-
stroke: var(--intergalactic-chart-palette-order-1, oklch(0.23 0.
|
|
64
|
+
stroke: var(--intergalactic-chart-palette-order-1, oklch(0.23 0.009 245));
|
|
65
65
|
stroke-width: 3;
|
|
66
66
|
fill: transparent;
|
|
67
67
|
}
|
|
@@ -76,5 +76,5 @@ SPolygonLine[color] {
|
|
|
76
76
|
|
|
77
77
|
SPieRect {
|
|
78
78
|
outline: none;
|
|
79
|
-
fill: var(--intergalactic-chart-grid-bar-
|
|
79
|
+
fill: var(--intergalactic-chart-grid-bar-hover, oklch(0.375 0.09 242.7 / 0.05));
|
|
80
80
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
SRadian {
|
|
4
4
|
cursor: pointer;
|
|
5
|
-
fill: var(--intergalactic-text-large-info, oklch(0.
|
|
5
|
+
fill: var(--intergalactic-text-large-info, oklch(0.23 0.009 245));
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
SLine {
|
|
9
|
-
stroke: var(--intergalactic-text-large-info, oklch(0.
|
|
9
|
+
stroke: var(--intergalactic-text-large-info, oklch(0.23 0.009 245));
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
SLine[stroke] {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
SReferenceLine {
|
|
2
2
|
fill: none;
|
|
3
|
-
stroke: var(--intergalactic-chart-grid-y-accent-hover-line, oklch(0.88 0.
|
|
3
|
+
stroke: var(--intergalactic-chart-grid-y-accent-hover-line, oklch(0.88 0.011 234.9));
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
STitle {
|
|
7
7
|
font-size: var(--intergalactic-fs-100, 12px);
|
|
8
|
-
fill: var(--intergalactic-chart-grid-text-label, oklch(0.
|
|
8
|
+
fill: var(--intergalactic-chart-grid-text-label, oklch(from oklch(0.182 0.045 244.8 / 0.593) l c h / 0.4));
|
|
9
9
|
transform-origin: var(--transform-origin);
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -31,13 +31,13 @@ STitle[position='left'] {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
SBackground {
|
|
34
|
-
fill: var(--intergalactic-chart-grid-period-bg, oklch(0.96 0.
|
|
34
|
+
fill: var(--intergalactic-chart-grid-period-bg, oklch(0.96 0.005 232.5));
|
|
35
35
|
}
|
|
36
36
|
SStripes {
|
|
37
37
|
fill: var(--fill);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
SStripesPatternPath {
|
|
41
|
-
stroke: var(--intergalactic-chart-grid-period-pattern, oklch(0.95 0.
|
|
41
|
+
stroke: var(--intergalactic-chart-grid-period-pattern, oklch(0.95 0.006 232.7));
|
|
42
42
|
stroke-width: 1px;
|
|
43
43
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@import './var.css';
|
|
2
2
|
|
|
3
3
|
SScatterPlot {
|
|
4
|
-
fill: var(--intergalactic-chart-palette-order-1, oklch(0.23 0.
|
|
4
|
+
fill: var(--intergalactic-chart-palette-order-1, oklch(0.23 0.009 245));
|
|
5
5
|
transition-property: cx, cy;
|
|
6
6
|
transition-duration: var(--duration);
|
|
7
7
|
transition-timing-function: ease-in-out;
|
|
@@ -5,18 +5,18 @@ STooltip {
|
|
|
5
5
|
line-height: var(--intergalactic-lh-100, 1.3334);
|
|
6
6
|
font-variant-numeric: tabular-nums;
|
|
7
7
|
position: relative;
|
|
8
|
-
color: var(--intergalactic-text-primary-invert, oklch(0.
|
|
9
|
-
background-color: var(--intergalactic-tooltip-bg-invert, oklch(0.23 0.
|
|
8
|
+
color: var(--intergalactic-text-primary-invert, oklch(0.991 0.005 232.5 / 0.959));
|
|
9
|
+
background-color: var(--intergalactic-tooltip-bg-invert, oklch(0.23 0.009 245));
|
|
10
10
|
border-radius: var(--intergalactic-popper-rounded, 6px);
|
|
11
|
-
border: 1px solid var(--intergalactic-tooltip-border-invert, oklch(0.4 0.
|
|
11
|
+
border: 1px solid var(--intergalactic-tooltip-border-invert, oklch(0.4 0.015 245));
|
|
12
12
|
box-sizing: border-box;
|
|
13
|
-
box-shadow: var(--intergalactic-box-shadow-popper, 1px 1px 10px 0px oklch(0.
|
|
14
|
-
padding: var(--intergalactic-spacing-
|
|
13
|
+
box-shadow: var(--intergalactic-box-shadow-popper, 1px 1px 10px 0px oklch(0.324 0.077 242.1 / 0.079));
|
|
14
|
+
padding: var(--intergalactic-spacing-3x, 12px);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
STitle {
|
|
18
|
-
color: var(--intergalactic-text-secondary-invert, oklch(0.
|
|
19
|
-
margin-bottom: var(--intergalactic-spacing-
|
|
18
|
+
color: var(--intergalactic-text-secondary-invert, oklch(0.953 0.025 240.1 / 0.726));
|
|
19
|
+
margin-bottom: var(--intergalactic-spacing-2x, 8px);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
SDotGroup {
|
|
@@ -25,7 +25,7 @@ SDotGroup {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
SDot {
|
|
28
|
-
margin-right: var(--intergalactic-spacing-
|
|
28
|
+
margin-right: var(--intergalactic-spacing-2x, 8px);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
SDotCircle[color][lightness] {
|
|
@@ -38,11 +38,11 @@ SDotCircle[color][lightness] {
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
SFooter {
|
|
41
|
-
background: var(--intergalactic-bg-secondary-invert, oklch(0.
|
|
42
|
-
color: var(--intergalactic-text-secondary-invert, oklch(0.
|
|
43
|
-
padding: var(--intergalactic-spacing-
|
|
41
|
+
background: var(--intergalactic-bg-secondary-invert, oklch(0.907 0.048 245.2 / 0.129));
|
|
42
|
+
color: var(--intergalactic-text-secondary-invert, oklch(0.953 0.025 240.1 / 0.726));
|
|
43
|
+
padding: var(--intergalactic-spacing-1x, 4px) var(--intergalactic-spacing-3x, 12px);
|
|
44
44
|
border-radius: 0 0 var(--intergalactic-rounded-medium, 6px) var(--intergalactic-rounded-medium, 6px);
|
|
45
|
-
margin: var(--intergalactic-spacing-
|
|
45
|
+
margin: var(--intergalactic-spacing-3x, 12px) calc(-1 * var(--intergalactic-spacing-3x, 12px)) calc(-1 * var(--intergalactic-spacing-3x, 12px));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
SDotPattern {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Axis.d.js","names":[],"sources":["../../../src/types/Axis.d.ts"],"sourcesContent":["import type { UnknownProperties } from '@semcore/core';\n\nimport type { Context } from './context';\nimport type { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IXAxisProps extends XAxisProps, UnknownProperties {}\nexport type XAxisProps = Context & {\n /** The position of the axis relative chart\n * @default '
|
|
1
|
+
{"version":3,"file":"Axis.d.js","names":[],"sources":["../../../src/types/Axis.d.ts"],"sourcesContent":["import type { UnknownProperties } from '@semcore/core';\n\nimport type { Context } from './context';\nimport type { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IXAxisProps extends XAxisProps, UnknownProperties {}\nexport type XAxisProps = Context & {\n /** The position of the axis relative chart\n * @default 'bottom' */\n position?: 'top' | 'right' | 'bottom' | 'left' | number;\n /** Element hide property\n * @default false */\n hide?: boolean;\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IYAxisProps extends YAxisProps, UnknownProperties {}\nexport type YAxisProps = Context & {\n /** The position of the axis relative chart\n * @default 'left' */\n position?: 'top' | 'right' | 'bottom' | 'left' | number;\n /** Element hide property\n * @default true */\n hide?: boolean;\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IAxisTicksProps extends AxisTicksProps, UnknownProperties {}\nexport type AxisTicksProps = Context & {\n /** The position of the axis relative chart */\n position?: 'top' | 'right' | 'bottom' | 'left';\n /** Element hide property */\n hide?: boolean;\n /** Values for axis ticks */\n ticks?: any[];\n /** Enables multiline tick labels, applicable only for band scales */\n /** @deprecated has no effect since v.18 */\n multiline?: boolean;\n /**\n * Enable `--intergalactic-text-primary` color for ticks\n */\n primaryText?: boolean;\n};\n\n/** @deprecated */\nexport interface IAxisGridProps extends AxisGridProps, UnknownProperties {}\nexport type AxisGridProps = Context & {\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IAxisTitleProps extends AxisTitleProps, UnknownProperties {}\nexport type AxisTitleProps = Context & {\n /** The position of the axis relative chart */\n position?: 'top' | 'right' | 'bottom' | 'left';\n\n /** For vertical titles disables characters rotation while puts\n * characters into the vertical column for better reading in some languages.\n * @default true for `zh` and `ja` locales and false for all others.\n */\n verticalWritingMode?: boolean;\n};\n\n/** @deprecated */\nexport interface IAxisTicksContext extends AxisTicksContext, UnknownProperties {}\nexport type AxisTicksContext = {\n /** Value element of data */\n /** @deprecated */\n value: any;\n /** Index element of data */\n index: number;\n /** Horizontal coordinate of tick */\n x: number;\n /** Vertical coordinate of tick */\n y: number;\n /** Size of plot */\n size: [width: number, height: number];\n};\n\ndeclare const XAxis: IntergalacticD3Component<'path', XAxisProps> & {\n Ticks: IntergalacticD3Component<'path', AxisTicksProps, AxisTicksContext>;\n Grid: IntergalacticD3Component<'path', AxisGridProps>;\n Title: IntergalacticD3Component<'text', AxisTitleProps>;\n};\n\ndeclare const YAxis: IntergalacticD3Component<'path', YAxisProps> & {\n Ticks: IntergalacticD3Component<'path', AxisTicksProps, AxisTicksContext>;\n Grid: IntergalacticD3Component<'path', AxisGridProps>;\n Title: IntergalacticD3Component<'text', AxisTitleProps>;\n};\n\nexport { XAxis, YAxis };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Donut.d.js","names":[],"sources":["../../../src/types/Donut.d.ts"],"sourcesContent":["import type { UnknownProperties } from '@semcore/core';\n\nimport type { Context } from './context';\nimport type { PatternsConfig } from './Pattern';\nimport type { IntergalacticD3Component } from './Plot';\nimport type { TooltipType } from './Tooltip';\n\n/** @deprecated */\nexport interface IDonutProps extends DonutProps, UnknownProperties {}\nexport type DonutProps = Context & {\n /** Inner radius\n * @default 0\n
|
|
1
|
+
{"version":3,"file":"Donut.d.js","names":[],"sources":["../../../src/types/Donut.d.ts"],"sourcesContent":["import type { UnknownProperties } from '@semcore/core';\n\nimport type { Context } from './context';\nimport type { PatternsConfig } from './Pattern';\nimport type { IntergalacticD3Component } from './Plot';\nimport type { TooltipType } from './Tooltip';\n\n/** @deprecated */\nexport interface IDonutProps extends DonutProps, UnknownProperties {}\nexport type DonutProps = Context & {\n /** Inner radius\n * @default 0\n */\n innerRadius?: number;\n /** Outer radius\n * @default calculated by the formula from width, height\n * */\n outerRadius?: number;\n /** Semi donut */\n halfsize?: boolean;\n /** Animation duration in ms. Set `0` to disable animation.\n * @default 500\n */\n duration?: number;\n /** Additional padding between segments in radians.\n * @default 0\n */\n paddingAngle?: number;\n /** Enables charts patterns that enhances charts accessibility */\n patterns?: PatternsConfig;\n /** Callback triggered when a user clicks on a pie */\n onClick?: (key: string, event: React.SyntheticEvent) => void;\n};\n\n/** @deprecated */\nexport interface IPieProps extends PieProps, UnknownProperties {}\nexport type PieProps = Context & {\n /**\n * Name of the field in the data\n * */\n dataKey: string;\n /**\n * Human readable name of the segment\n * */\n name: string;\n /** Color pie **/\n color?: string;\n /**\n * Active sector\n * */\n active?: boolean;\n /** Enables element transparency */\n transparent?: boolean;\n};\n\n/** @deprecated */\nexport interface IEmptyDataProps extends EmptyDataProps, UnknownProperties {}\nexport type EmptyDataProps = Context & {};\n\n/** @deprecated */\nexport interface ILabelProps extends LabelProps, UnknownProperties {}\nexport type LabelProps = Context & {\n label?: string;\n};\n\ndeclare const Donut: IntergalacticD3Component<'g', DonutProps> & {\n Pie: IntergalacticD3Component<'path', PieProps>;\n EmptyData: IntergalacticD3Component<'path', EmptyDataProps>;\n Label: IntergalacticD3Component<'text', LabelProps>;\n Tooltip: TooltipType<PieProps>;\n};\n\nexport default Donut;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hover.d.js","names":[],"sources":["../../../src/types/Hover.d.ts"],"sourcesContent":["import type { NSBox } from '@semcore/base-components';\nimport type { UnknownProperties, ReturnEl } from '@semcore/core';\nimport type React from 'react';\n\nimport type { Context } from './context';\nimport type { IntergalacticD3Component } from './Plot';\nimport type { TooltipTypeBase } from './Tooltip';\n\n/** @deprecated */\nexport interface IHoverProps extends HoverProps, UnknownProperties {}\nexport type HoverProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n /** Hide tick hover */\n hideTickHover?: boolean;\n};\n\ntype HoverTooltip = (<X, Y>(\n props: {\n /** Field name from `data` array item for the XAxis */\n x?: X;\n /** Field name from `data` array item for the YAxis */\n y?: Y;\n /** Handle click by trigger has an index - it is an index of the data array. */\n onClick?: (index: number, e: React.SyntheticEvent) => void;\n children: (props: {\n /** Index in `data` array of the current item */\n xIndex: X extends string ? number : never;\n /** Index in `data` array of the current item */\n yIndex: Y extends string ? number : never;\n }) => { children: ReturnEl };\n /** Flag for hide line on hovered value */\n hideHoverLine?: boolean | ((xIndex: number | null, yIndex: number | null) => boolean);\n } & Omit<NSBox.Props, 'children'>,\n) => ReturnEl) &\nTooltipTypeBase;\n\ntype HoverContext = {\n /** Index in `data` array of the current item */\n index: number;\n};\n\ndeclare const HoverLine: IntergalacticD3Component<'g', HoverProps, HoverContext> & {\n Tooltip: HoverTooltip;\n};\n\ndeclare const HoverRect: IntergalacticD3Component<'g', HoverProps, HoverContext> & {\n Tooltip: HoverTooltip;\n};\nexport { HoverLine, HoverRect };\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Hover.d.js","names":[],"sources":["../../../src/types/Hover.d.ts"],"sourcesContent":["import type { NSBox } from '@semcore/base-components';\nimport type { UnknownProperties, ReturnEl } from '@semcore/core';\nimport type React from 'react';\n\nimport type { Context } from './context';\nimport type { IntergalacticD3Component } from './Plot';\nimport type { TooltipTypeBase } from './Tooltip';\n\n/** @deprecated */\nexport interface IHoverProps extends HoverProps, UnknownProperties {}\nexport type HoverProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n /** Hide tick hover */\n hideTickHover?: boolean;\n};\n\ntype HoverTooltip = (<X, Y>(\n props: {\n /** Field name from `data` array item for the XAxis */\n x?: X;\n /** Field name from `data` array item for the YAxis */\n y?: Y;\n /** Handle click by trigger has an index - it is an index of the data array. */\n onClick?: (index: number, e: React.SyntheticEvent) => void;\n children: (props: {\n /** Index in `data` array of the current item */\n xIndex: X extends string ? number : never;\n /** Index in `data` array of the current item */\n yIndex: Y extends string ? number : never;\n }) => { children: ReturnEl };\n /** Flag for hide line on hovered value */\n hideHoverLine?: boolean | ((xIndex: number | null, yIndex: number | null) => boolean);\n /** Hide tick hover */\n hideTickHover?: boolean;\n } & Omit<NSBox.Props, 'children'>,\n) => ReturnEl) &\nTooltipTypeBase;\n\ntype HoverContext = {\n /** Index in `data` array of the current item */\n index: number;\n};\n\ndeclare const HoverLine: IntergalacticD3Component<'g', HoverProps, HoverContext> & {\n Tooltip: HoverTooltip;\n};\n\ndeclare const HoverRect: IntergalacticD3Component<'g', HoverProps, HoverContext> & {\n Tooltip: HoverTooltip;\n};\nexport { HoverLine, HoverRect };\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import EventEmitter from '@semcore/core/lib/utils/eventEmitter';
|
|
2
2
|
import { extent, bisector } from 'd3-array';
|
|
3
3
|
import { scaleQuantize, scaleBand, scaleSqrt } from 'd3-scale';
|
|
4
|
+
import { DATA_TYPE } from './component/Chart';
|
|
4
5
|
export const eventToPoint = (event, svgRoot) => {
|
|
5
6
|
const node = event.currentTarget || event.target;
|
|
6
7
|
const rect = svgRoot.getBoundingClientRect();
|
|
@@ -217,4 +218,21 @@ export const calculateBubbleDomain = (data, key, range) => {
|
|
|
217
218
|
return [Math.floor(min), Math.floor(max)];
|
|
218
219
|
};
|
|
219
220
|
export const PlotEventEmitter = EventEmitter;
|
|
221
|
+
export function getDataOfType(data, type, y) {
|
|
222
|
+
const result = [];
|
|
223
|
+
let prevPoint = null;
|
|
224
|
+
let insideRun = false;
|
|
225
|
+
data.forEach(item => {
|
|
226
|
+
const valid = item[y] !== interpolateValue;
|
|
227
|
+
if (valid && item[DATA_TYPE] === type) {
|
|
228
|
+
if (!insideRun && prevPoint !== null) result.push(prevPoint);
|
|
229
|
+
result.push(item);
|
|
230
|
+
insideRun = true;
|
|
231
|
+
} else {
|
|
232
|
+
insideRun = false;
|
|
233
|
+
}
|
|
234
|
+
if (valid) prevPoint = item;
|
|
235
|
+
});
|
|
236
|
+
return result;
|
|
237
|
+
}
|
|
220
238
|
//# sourceMappingURL=utils.js.map
|
package/lib/es6/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["EventEmitter","extent","bisector","scaleQuantize","scaleBand","scaleSqrt","eventToPoint","event","svgRoot","node","currentTarget","target","rect","getBoundingClientRect","clientX","left","clientLeft","clientY","top","clientTop","invert","scale","value","range","domain","paddingOuter","step","slice","reverse","definedNullData","x","y","plot","definedData","undefined","scaleOfBandwidth","bandwidth","minMax","data","key","d","getNullData","defined","name","reduce","acc","i","push","prev","next","defNext","find","length","defPrev","getIndexFromData","Array","isArray","bisect","center","index","findIndex","keys","Object","map","_key","item","interpolateValue","lastKeyIndex","console","warn","roundedPath","w","h","r","tl","tr","bl","br","result","scaleToBand","band","memoize","func","results","args","argsKey","join","measureText","text","fontSize","span","document","createElement","style","line","split","append","createTextNode","display","body","textWidth","offsetWidth","textHeight","offsetHeight","remove","Math","max","idCounter","uniqueId","prefix","Symbol","getChartDefaultColorName","getBubbleChartValueScale","z","el","getScatterPlotRadius","valueKey","calculateBubbleDomain","miniestValue","min","maxestValue","pixelRatio","abs","valueScale","minValueShift","maxValueShift","floor","PlotEventEmitter"],"sources":["../../src/utils.ts"],"sourcesContent":["import EventEmitter from '@semcore/core/lib/utils/eventEmitter';\nimport { extent, bisector, type Numeric } from 'd3-array';\nimport {\n scaleQuantize,\n type ScaleIdentity,\n type ScaleTime,\n type ScaleContinuousNumeric,\n type ScaleBand,\n type ScalePoint,\n type NumberValue,\n scaleBand,\n scaleSqrt,\n} from 'd3-scale';\nimport type React from 'react';\n\nexport const eventToPoint = (event: React.MouseEvent<HTMLElement>, svgRoot: SVGElement) => {\n const node = (event.currentTarget || event.target) as HTMLElement;\n const rect = svgRoot.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n};\n\ntype InvertableScale =\n | ScaleIdentity\n | ScaleBand<{}>\n | ScaleTime<unknown, unknown>\n | ScaleContinuousNumeric<unknown, unknown>;\nexport const invert = <Scale extends InvertableScale = InvertableScale>(\n scale: Scale,\n value: number,\n) => {\n if ('invert' in scale && scale.invert) return scale.invert(value);\n\n const range = scale.range() as [number, number];\n const domain = scale.domain();\n if ('paddingOuter' in scale) {\n range[0] += scale.paddingOuter() * scale.step();\n range[1] -= scale.paddingOuter() * scale.step();\n }\n\n return scaleQuantize()\n .domain((range[0] <= range[1] ? range : range.slice().reverse()) as NumberValue[])\n .range((range[0] <= range[1] ? domain : domain.slice().reverse()) as number[])(value);\n};\n\nexport const definedNullData = (x: number, y: number) => (plot: { [xOrY: number]: unknown }) =>\n plot[x] !== null && plot[y] !== null;\n\nexport const definedData = (x: number, y: number) => (plot: { [xOrY: number]: unknown }) =>\n plot[x] !== null && plot[x] !== undefined && plot[y] !== null && plot[y] !== undefined;\n\nexport const scaleOfBandwidth = <Scale extends ScaleBand<{}>>(scale: Scale, value: number) =>\n scale.bandwidth ? scale(value)! + scale.bandwidth() / 2 : scale(value);\n\nexport const minMax = <\n Key extends string = string,\n Data extends { [key: string]: Numeric | null | undefined }[] = {\n [key: string]: Numeric | null | undefined;\n }[],\n>(\n data: Data,\n key: Key,\n): [min: Data[0][Key], max: Data[0][Key]] => {\n if (typeof key === 'string') {\n return extent(data, (d) => d[key]) as any;\n }\n return extent(data, key) as any;\n};\n\nexport const getNullData = <\n Name extends string = string,\n Data extends { [name in Name]?: unknown | null } = {},\n>(\n data: Data[],\n defined: (data: Data) => boolean,\n name: Name,\n) =>\n data.reduce((acc, d, i, data) => {\n if (defined(d)) {\n acc.push({\n [name]: null,\n } as Data);\n } else {\n const prev = data[i - 1];\n const next = data[i + 1];\n\n if (i === 0) {\n const defNext = data.find(defined);\n acc.push({\n ...d,\n [name]: defNext ? defNext[name] : null,\n });\n }\n\n // prev\n if (prev && defined(prev)) {\n acc.push(prev);\n }\n\n // next\n if (next && defined(next)) {\n acc.push(next);\n }\n\n if (data.length - 1 === i) {\n const defPrev = data.slice().reverse().find(defined);\n acc.push({\n ...d,\n [name]: defPrev ? defPrev[name] : null,\n });\n }\n }\n return acc;\n }, [] as Data[]);\n\ntype IndexFromDataScale =\n | ScaleIdentity\n | ScaleTime<unknown, unknown>\n | ScaleContinuousNumeric<unknown, unknown>\n | ScaleBand<{}>\n | ScalePoint<{}>;\nexport const getIndexFromData = <\n Key extends string,\n Data extends {\n [key in Key]: number;\n } = { [key in Key]: number },\n Scale extends IndexFromDataScale = IndexFromDataScale,\n>(\n data: Data[],\n scale: Scale,\n key: Key,\n value: number,\n) => {\n // detect line chart\n if ('invert' in scale && typeof scale.invert === 'function' && Array.isArray(data)) {\n const bisect = bisector((d: { [key: string]: number }) => d[key]).center;\n return bisect(data, value);\n } else if ('step' in scale && typeof scale.step !== 'undefined' && Array.isArray(data)) { // detect bar chart\n const index = data.findIndex((d) => d[key] === value);\n return index >= 0 ? index : null;\n } else if ('invert' in scale && typeof scale.invert === 'function' && !Array.isArray(data)) { // detect cigarette chart\n const keys = Object.keys(data);\n const domain = keys.map((_key, index) => {\n return keys.slice(0, index).reduce((acc, item) => {\n if (data[item] !== interpolateValue) {\n acc = acc + data[item];\n }\n\n return acc;\n }, 0);\n });\n\n let key = null;\n\n const lastKeyIndex = keys.length - 1;\n\n if (value > domain[lastKeyIndex]) {\n key = keys[lastKeyIndex];\n } else {\n for (let i = 0; i < lastKeyIndex; i++) {\n if (i === 0 && value < domain[i]) {\n break;\n }\n\n if (value > domain[i] && value < domain[i + 1]) {\n key = keys[i];\n break;\n }\n }\n }\n\n return key;\n } else {\n // eslint-disable-next-line no-console\n console.warn('[d3-chart/utils/getIndexFromData] encountered incompatible scale type');\n return null;\n }\n};\n\nexport const roundedPath = (\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n tl = false,\n tr = false,\n bl = false,\n br = false,\n) => {\n let result = `M${x + r},${y}`;\n result += `h${w - 2 * r}`;\n if (tr) {\n result += `a${r},${r} 0 0 1 ${r},${r}`;\n } else {\n result += `h${r}`;\n result += `v${r}`;\n }\n result += `v${h - 2 * r}`;\n if (br) {\n result += `a${r},${r} 0 0 1 ${-r},${r}`;\n } else {\n result += `v${r}`;\n result += `h${-r}`;\n }\n result += `h${2 * r - w}`;\n if (bl) {\n result += `a${r},${r} 0 0 1 ${-r},${-r}`;\n } else {\n result += `h${-r}`;\n result += `v${-r}`;\n }\n result += `v${2 * r - h}`;\n if (tl) {\n result += `a${r},${r} 0 0 1 ${r},${-r}`;\n } else {\n result += `v${-r}`;\n result += `h${r}`;\n }\n result += 'z';\n return result;\n};\n\nexport const scaleToBand = (scale: ScaleBand<{}>) => {\n if ('bandwidth' in scale) {\n return scale;\n }\n\n const band = scaleBand()\n .range((scale as any).range())\n .domain((scale as any).domain());\n\n return band;\n};\n\nexport const memoize = <Func extends (...args: any[]) => any>(func: Func): Func => {\n const results: { [cacheKey: string]: any } = {};\n return ((...args: any[]) => {\n const argsKey = args.join(',');\n if (!results[argsKey]) {\n results[argsKey] = func(...args);\n }\n return results[argsKey];\n }) as Func;\n};\n\nexport const measureText = memoize((text: string, fontSize?: number) => {\n if (!text) return 0;\n\n const span = document.createElement('span');\n if (fontSize) {\n span.style.fontSize = `${fontSize}px`;\n }\n for (const line of text.split('\\n')) {\n span.append(document.createTextNode(line));\n span.append(document.createElement('br'));\n }\n span.style.display = 'inline-block';\n document.body.append(span);\n const textWidth = span.offsetWidth;\n const textHeight = span.offsetHeight;\n span.remove();\n return Math.max(textWidth, textHeight);\n});\n\nlet idCounter = 0;\nexport const uniqueId = (prefix = 'id-') => `${prefix}${idCounter++}`;\n\nexport const interpolateValue = Symbol('intergalactic-d3-chart-line-interpolate');\n\nexport const getChartDefaultColorName = (index: number) => {\n index++;\n if (index < 1) index = 1;\n if (index > 24) index %= 24;\n\n return `chart-palette-order-${index}`;\n};\n\nexport const getBubbleChartValueScale = (data: any[], key: string) => {\n const z = scaleSqrt()\n .domain([0, Math.max(...data.map((el) => el[key]))])\n .range([5.5, 50.5]); // min/max radius\n\n return z;\n};\n\nexport const getScatterPlotRadius = (valueKey?: string): number => {\n return valueKey !== undefined ? 12 : 5.5;\n};\n\ntype BubbleChartDataItem = {\n value: number;\n x: number;\n y: number;\n};\n\nexport const calculateBubbleDomain = (\n data: Array<BubbleChartDataItem>,\n key: 'x' | 'y',\n range: [number, number],\n): [min: number, max: number] => {\n const miniestValue = data.reduce(\n (acc, item) => {\n if (item[key] - item.value < acc.min) {\n acc.min = item[key] - item.value;\n acc.value = item.value;\n }\n return acc;\n },\n { value: data[0].value, min: data[0][key] - data[0].value },\n ).value;\n const maxestValue = data.reduce(\n (acc, item) => {\n if (item.value + item[key] > acc.max) {\n acc.max = item.value + item.x;\n acc.value = item.value;\n }\n return acc;\n },\n { value: data[0].value, max: data[0].value + data[0][key] },\n ).value;\n\n let [min, max] = minMax(data, key);\n\n const pixelRatio = Math.abs(max - min) / Math.abs(range[0] - range[1]);\n const valueScale = getBubbleChartValueScale(data, 'value');\n const minValueShift = valueScale(miniestValue) * pixelRatio;\n const maxValueShift = valueScale(maxestValue) * pixelRatio;\n min -= minValueShift * 2;\n max += maxValueShift * 2;\n\n return [Math.floor(min), Math.floor(max)];\n};\n\ntype CommonEvents = {\n setTooltipVisible: (visible: boolean) => void;\n setTooltipPosition: (x: number, y: number) => void;\n};\n\ntype Events = {\n [K in keyof CommonEvents as `${K}_${string}`]: CommonEvents[K];\n};\n\nexport const PlotEventEmitter = EventEmitter<Events>;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,sCAAsC;AAC/D,SAASC,MAAM,EAAEC,QAAQ,QAAsB,UAAU;AACzD,SACEC,aAAa,EAObC,SAAS,EACTC,SAAS,QACJ,UAAU;AAGjB,OAAO,MAAMC,YAAY,GAAGA,CAACC,KAAoC,EAAEC,OAAmB,KAAK;EACzF,MAAMC,IAAI,GAAIF,KAAK,CAACG,aAAa,IAAIH,KAAK,CAACI,MAAsB;EACjE,MAAMC,IAAI,GAAGJ,OAAO,CAACK,qBAAqB,CAAC,CAAC;EAC5C,OAAO,CAACN,KAAK,CAACO,OAAO,GAAGF,IAAI,CAACG,IAAI,GAAGN,IAAI,CAACO,UAAU,EAAET,KAAK,CAACU,OAAO,GAAGL,IAAI,CAACM,GAAG,GAAGT,IAAI,CAACU,SAAS,CAAC;AACjG,CAAC;AAOD,OAAO,MAAMC,MAAM,GAAGA,CACpBC,KAAY,EACZC,KAAa,KACV;EACH,IAAI,QAAQ,IAAID,KAAK,IAAIA,KAAK,CAACD,MAAM,EAAE,OAAOC,KAAK,CAACD,MAAM,CAACE,KAAK,CAAC;EAEjE,MAAMC,KAAK,GAAGF,KAAK,CAACE,KAAK,CAAC,CAAqB;EAC/C,MAAMC,MAAM,GAAGH,KAAK,CAACG,MAAM,CAAC,CAAC;EAC7B,IAAI,cAAc,IAAIH,KAAK,EAAE;IAC3BE,KAAK,CAAC,CAAC,CAAC,IAAIF,KAAK,CAACI,YAAY,CAAC,CAAC,GAAGJ,KAAK,CAACK,IAAI,CAAC,CAAC;IAC/CH,KAAK,CAAC,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CAAC,GAAGd,IAAI,CAACiB,GAAG,CAACnG,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,CAAC;EACtE,MAAMoG,UAAU,GAAGX,wBAAwB,CAAC1E,IAAI,EAAE,OAAO,CAAC;EAC1D,MAAMsF,aAAa,GAAGD,UAAU,CAACL,YAAY,CAAC,GAAGG,UAAU;EAC3D,MAAMI,aAAa,GAAGF,UAAU,CAACH,WAAW,CAAC,GAAGC,UAAU;EAC1DF,GAAG,IAAIK,aAAa,GAAG,CAAC;EACxBlB,GAAG,IAAImB,aAAa,GAAG,CAAC;EAExB,OAAO,CAACpB,IAAI,CAACqB,KAAK,CAACP,GAAG,CAAC,EAAEd,IAAI,CAACqB,KAAK,CAACpB,GAAG,CAAC,CAAC;AAC3C,CAAC;AAWD,OAAO,MAAMqB,gBAAgB,GAAG/H,YAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["EventEmitter","extent","bisector","scaleQuantize","scaleBand","scaleSqrt","DATA_TYPE","eventToPoint","event","svgRoot","node","currentTarget","target","rect","getBoundingClientRect","clientX","left","clientLeft","clientY","top","clientTop","invert","scale","value","range","domain","paddingOuter","step","slice","reverse","definedNullData","x","y","plot","definedData","undefined","scaleOfBandwidth","bandwidth","minMax","data","key","d","getNullData","defined","name","reduce","acc","i","push","prev","next","defNext","find","length","defPrev","getIndexFromData","Array","isArray","bisect","center","index","findIndex","keys","Object","map","_key","item","interpolateValue","lastKeyIndex","console","warn","roundedPath","w","h","r","tl","tr","bl","br","result","scaleToBand","band","memoize","func","results","args","argsKey","join","measureText","text","fontSize","span","document","createElement","style","line","split","append","createTextNode","display","body","textWidth","offsetWidth","textHeight","offsetHeight","remove","Math","max","idCounter","uniqueId","prefix","Symbol","getChartDefaultColorName","getBubbleChartValueScale","z","el","getScatterPlotRadius","valueKey","calculateBubbleDomain","miniestValue","min","maxestValue","pixelRatio","abs","valueScale","minValueShift","maxValueShift","floor","PlotEventEmitter","getDataOfType","type","prevPoint","insideRun","forEach","valid"],"sources":["../../src/utils.ts"],"sourcesContent":["import EventEmitter from '@semcore/core/lib/utils/eventEmitter';\nimport { extent, bisector, type Numeric } from 'd3-array';\nimport {\n scaleQuantize,\n type ScaleIdentity,\n type ScaleTime,\n type ScaleContinuousNumeric,\n type ScaleBand,\n type ScalePoint,\n type NumberValue,\n scaleBand,\n scaleSqrt,\n} from 'd3-scale';\nimport type React from 'react';\n\nimport type { FORECAST, POTENTIAL } from './component/Chart';\nimport { DATA_TYPE } from './component/Chart';\nimport type { ObjectData, ObjectDataKey } from './component/Chart/AbstractChart.type';\n\nexport const eventToPoint = (event: React.MouseEvent<HTMLElement>, svgRoot: SVGElement) => {\n const node = (event.currentTarget || event.target) as HTMLElement;\n const rect = svgRoot.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n};\n\ntype InvertableScale =\n | ScaleIdentity\n | ScaleBand<{}>\n | ScaleTime<unknown, unknown>\n | ScaleContinuousNumeric<unknown, unknown>;\nexport const invert = <Scale extends InvertableScale = InvertableScale>(\n scale: Scale,\n value: number,\n) => {\n if ('invert' in scale && scale.invert) return scale.invert(value);\n\n const range = scale.range() as [number, number];\n const domain = scale.domain();\n if ('paddingOuter' in scale) {\n range[0] += scale.paddingOuter() * scale.step();\n range[1] -= scale.paddingOuter() * scale.step();\n }\n\n return scaleQuantize()\n .domain((range[0] <= range[1] ? range : range.slice().reverse()) as NumberValue[])\n .range((range[0] <= range[1] ? domain : domain.slice().reverse()) as number[])(value);\n};\n\nexport const definedNullData = (x: number, y: number) => (plot: { [xOrY: number]: unknown }) =>\n plot[x] !== null && plot[y] !== null;\n\nexport const definedData = (x: number, y: number) => (plot: { [xOrY: number]: unknown }) =>\n plot[x] !== null && plot[x] !== undefined && plot[y] !== null && plot[y] !== undefined;\n\nexport const scaleOfBandwidth = <Scale extends ScaleBand<{}>>(scale: Scale, value: number) =>\n scale.bandwidth ? scale(value)! + scale.bandwidth() / 2 : scale(value);\n\nexport const minMax = <\n Key extends string = string,\n Data extends { [key: string]: Numeric | null | undefined }[] = {\n [key: string]: Numeric | null | undefined;\n }[],\n>(\n data: Data,\n key: Key,\n): [min: Data[0][Key], max: Data[0][Key]] => {\n if (typeof key === 'string') {\n return extent(data, (d) => d[key]) as any;\n }\n return extent(data, key) as any;\n};\n\nexport const getNullData = <\n Name extends string = string,\n Data extends { [name in Name]?: unknown | null } = {},\n>(\n data: Data[],\n defined: (data: Data) => boolean,\n name: Name,\n) =>\n data.reduce((acc, d, i, data) => {\n if (defined(d)) {\n acc.push({\n [name]: null,\n } as Data);\n } else {\n const prev = data[i - 1];\n const next = data[i + 1];\n\n if (i === 0) {\n const defNext = data.find(defined);\n acc.push({\n ...d,\n [name]: defNext ? defNext[name] : null,\n });\n }\n\n // prev\n if (prev && defined(prev)) {\n acc.push(prev);\n }\n\n // next\n if (next && defined(next)) {\n acc.push(next);\n }\n\n if (data.length - 1 === i) {\n const defPrev = data.slice().reverse().find(defined);\n acc.push({\n ...d,\n [name]: defPrev ? defPrev[name] : null,\n });\n }\n }\n return acc;\n }, [] as Data[]);\n\ntype IndexFromDataScale =\n | ScaleIdentity\n | ScaleTime<unknown, unknown>\n | ScaleContinuousNumeric<unknown, unknown>\n | ScaleBand<{}>\n | ScalePoint<{}>;\nexport const getIndexFromData = <\n Key extends string,\n Data extends {\n [key in Key]: number;\n } = { [key in Key]: number },\n Scale extends IndexFromDataScale = IndexFromDataScale,\n>(\n data: Data[],\n scale: Scale,\n key: Key,\n value: number,\n) => {\n // detect line chart\n if ('invert' in scale && typeof scale.invert === 'function' && Array.isArray(data)) {\n const bisect = bisector((d: { [key: string]: number }) => d[key]).center;\n return bisect(data, value);\n } else if ('step' in scale && typeof scale.step !== 'undefined' && Array.isArray(data)) { // detect bar chart\n const index = data.findIndex((d) => d[key] === value);\n return index >= 0 ? index : null;\n } else if ('invert' in scale && typeof scale.invert === 'function' && !Array.isArray(data)) { // detect cigarette chart\n const keys = Object.keys(data);\n const domain = keys.map((_key, index) => {\n return keys.slice(0, index).reduce((acc, item) => {\n if (data[item] !== interpolateValue) {\n acc = acc + data[item];\n }\n\n return acc;\n }, 0);\n });\n\n let key = null;\n\n const lastKeyIndex = keys.length - 1;\n\n if (value > domain[lastKeyIndex]) {\n key = keys[lastKeyIndex];\n } else {\n for (let i = 0; i < lastKeyIndex; i++) {\n if (i === 0 && value < domain[i]) {\n break;\n }\n\n if (value > domain[i] && value < domain[i + 1]) {\n key = keys[i];\n break;\n }\n }\n }\n\n return key;\n } else {\n // eslint-disable-next-line no-console\n console.warn('[d3-chart/utils/getIndexFromData] encountered incompatible scale type');\n return null;\n }\n};\n\nexport const roundedPath = (\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n tl = false,\n tr = false,\n bl = false,\n br = false,\n) => {\n let result = `M${x + r},${y}`;\n result += `h${w - 2 * r}`;\n if (tr) {\n result += `a${r},${r} 0 0 1 ${r},${r}`;\n } else {\n result += `h${r}`;\n result += `v${r}`;\n }\n result += `v${h - 2 * r}`;\n if (br) {\n result += `a${r},${r} 0 0 1 ${-r},${r}`;\n } else {\n result += `v${r}`;\n result += `h${-r}`;\n }\n result += `h${2 * r - w}`;\n if (bl) {\n result += `a${r},${r} 0 0 1 ${-r},${-r}`;\n } else {\n result += `h${-r}`;\n result += `v${-r}`;\n }\n result += `v${2 * r - h}`;\n if (tl) {\n result += `a${r},${r} 0 0 1 ${r},${-r}`;\n } else {\n result += `v${-r}`;\n result += `h${r}`;\n }\n result += 'z';\n return result;\n};\n\nexport const scaleToBand = (scale: ScaleBand<{}>) => {\n if ('bandwidth' in scale) {\n return scale;\n }\n\n const band = scaleBand()\n .range((scale as any).range())\n .domain((scale as any).domain());\n\n return band;\n};\n\nexport const memoize = <Func extends (...args: any[]) => any>(func: Func): Func => {\n const results: { [cacheKey: string]: any } = {};\n return ((...args: any[]) => {\n const argsKey = args.join(',');\n if (!results[argsKey]) {\n results[argsKey] = func(...args);\n }\n return results[argsKey];\n }) as Func;\n};\n\nexport const measureText = memoize((text: string, fontSize?: number) => {\n if (!text) return 0;\n\n const span = document.createElement('span');\n if (fontSize) {\n span.style.fontSize = `${fontSize}px`;\n }\n for (const line of text.split('\\n')) {\n span.append(document.createTextNode(line));\n span.append(document.createElement('br'));\n }\n span.style.display = 'inline-block';\n document.body.append(span);\n const textWidth = span.offsetWidth;\n const textHeight = span.offsetHeight;\n span.remove();\n return Math.max(textWidth, textHeight);\n});\n\nlet idCounter = 0;\nexport const uniqueId = (prefix = 'id-') => `${prefix}${idCounter++}`;\n\nexport const interpolateValue = Symbol('intergalactic-d3-chart-line-interpolate');\n\nexport const getChartDefaultColorName = (index: number) => {\n index++;\n if (index < 1) index = 1;\n if (index > 24) index %= 24;\n\n return `chart-palette-order-${index}`;\n};\n\nexport const getBubbleChartValueScale = (data: any[], key: string) => {\n const z = scaleSqrt()\n .domain([0, Math.max(...data.map((el) => el[key]))])\n .range([5.5, 50.5]); // min/max radius\n\n return z;\n};\n\nexport const getScatterPlotRadius = (valueKey?: string): number => {\n return valueKey !== undefined ? 12 : 5.5;\n};\n\ntype BubbleChartDataItem = {\n value: number;\n x: number;\n y: number;\n};\n\nexport const calculateBubbleDomain = (\n data: Array<BubbleChartDataItem>,\n key: 'x' | 'y',\n range: [number, number],\n): [min: number, max: number] => {\n const miniestValue = data.reduce(\n (acc, item) => {\n if (item[key] - item.value < acc.min) {\n acc.min = item[key] - item.value;\n acc.value = item.value;\n }\n return acc;\n },\n { value: data[0].value, min: data[0][key] - data[0].value },\n ).value;\n const maxestValue = data.reduce(\n (acc, item) => {\n if (item.value + item[key] > acc.max) {\n acc.max = item.value + item.x;\n acc.value = item.value;\n }\n return acc;\n },\n { value: data[0].value, max: data[0].value + data[0][key] },\n ).value;\n\n let [min, max] = minMax(data, key);\n\n const pixelRatio = Math.abs(max - min) / Math.abs(range[0] - range[1]);\n const valueScale = getBubbleChartValueScale(data, 'value');\n const minValueShift = valueScale(miniestValue) * pixelRatio;\n const maxValueShift = valueScale(maxestValue) * pixelRatio;\n min -= minValueShift * 2;\n max += maxValueShift * 2;\n\n return [Math.floor(min), Math.floor(max)];\n};\n\ntype CommonEvents = {\n setTooltipVisible: (visible: boolean) => void;\n setTooltipPosition: (x: number, y: number) => void;\n};\n\ntype Events = {\n [K in keyof CommonEvents as `${K}_${string}`]: CommonEvents[K];\n};\n\nexport const PlotEventEmitter = EventEmitter<Events>;\n\nexport function getDataOfType(data: ObjectData[], type: typeof FORECAST | typeof POTENTIAL, y: ObjectDataKey) {\n const result: ObjectData[] = [];\n let prevPoint: ObjectData | null = null;\n let insideRun = false;\n\n data.forEach((item) => {\n const valid = item[y] !== interpolateValue;\n\n if (valid && item[DATA_TYPE] === type) {\n if (!insideRun && prevPoint !== null) result.push(prevPoint);\n\n result.push(item);\n\n insideRun = true;\n } else {\n insideRun = false;\n }\n\n if (valid) prevPoint = item;\n });\n\n return result;\n}\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,sCAAsC;AAC/D,SAASC,MAAM,EAAEC,QAAQ,QAAsB,UAAU;AACzD,SACEC,aAAa,EAObC,SAAS,EACTC,SAAS,QACJ,UAAU;AAIjB,SAASC,SAAS,QAAQ,mBAAmB;AAG7C,OAAO,MAAMC,YAAY,GAAGA,CAACC,KAAoC,EAAEC,OAAmB,KAAK;EACzF,MAAMC,IAAI,GAAIF,KAAK,CAACG,aAAa,IAAIH,KAAK,CAACI,MAAsB;EACjE,MAAMC,IAAI,GAAGJ,OAAO,CAACK,qBAAqB,CAAC,CAAC;EAC5C,OAAO,CAACN,KAAK,CAACO,OAAO,GAAGF,IAAI,CAACG,IAAI,GAAGN,IAAI,CAACO,UAAU,EAAET,KAAK,CAACU,OAAO,GAAGL,IAAI,CAACM,GAAG,GAAGT,IAAI,CAACU,SAAS,CAAC;AACjG,CAAC;AAOD,OAAO,MAAMC,MAAM,GAAGA,CACpBC,KAAY,EACZC,KAAa,KACV;EACH,IAAI,QAAQ,IAAID,K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AAIpE,IAAI,CAAC5D,SAAS,CAAC,KAAK4H,IAAI,EAAE;MACrC,IAAI,CAACE,SAAS,IAAID,SAAS,KAAK,IAAI,EAAEpD,MAAM,CAAC/B,IAAI,CAACmF,SAAS,CAAC;MAE5DpD,MAAM,CAAC/B,IAAI,CAACkB,IAAI,CAAC;MAEjBkE,SAAS,GAAG,IAAI;IAClB,CAAC,MAAM;MACLA,SAAS,GAAG,KAAK;IACnB;IAEA,IAAIE,KAAK,EAAEH,SAAS,GAAGjE,IAAI;EAC7B,CAAC,CAAC;EAEF,OAAOa,MAAM;AACf","ignoreList":[]}
|
package/lib/esm/Area.mjs
CHANGED
|
@@ -6,31 +6,34 @@ import { bisector } from "d3-array";
|
|
|
6
6
|
import { line, curveLinear, area } from "d3-shape";
|
|
7
7
|
import React from "react";
|
|
8
8
|
import AnimatedClipPath from "./AnimatedClipPath.mjs";
|
|
9
|
+
import "./component/Chart/index.mjs";
|
|
9
10
|
import { SvgElement } from "./component/SvgElement.mjs";
|
|
10
11
|
import createElement from "./createElement.mjs";
|
|
11
12
|
import Dots from "./Dots.mjs";
|
|
12
|
-
import { PatternFill } from "./Pattern.mjs";
|
|
13
|
-
import { interpolateValue, getNullData, definedNullData, eventToPoint, invert, definedData, scaleOfBandwidth } from "./utils.mjs";
|
|
13
|
+
import { ForecastGradient, StrokeMask, PotentialGradient, PatternFill } from "./Pattern.mjs";
|
|
14
|
+
import { interpolateValue, getNullData, definedNullData, eventToPoint, invert, getDataOfType, definedData, scaleOfBandwidth } from "./utils.mjs";
|
|
15
|
+
import { FORECAST, POTENTIAL, DATA_TYPE } from "./component/Chart/AbstractChart.type.mjs";
|
|
14
16
|
/*!__reshadow-styles__:"./style/area.shadow.css"*/
|
|
15
17
|
const style = (
|
|
16
18
|
/*__reshadow_css_start__*/
|
|
17
19
|
(sstyled.insert(
|
|
18
20
|
/*__inner_css_start__*/
|
|
19
|
-
".
|
|
21
|
+
".___SArea_umi3l_gg_{fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245));fill-opacity:.1}.___SArea_umi3l_gg_.__withGradient_umi3l_gg_{-webkit-mask-image:linear-gradient(180deg,#000 0,#0000007a 60%,#0000);mask-image:linear-gradient(180deg,#000 0,#0000007a 60%,#0000)}.___SArea_umi3l_gg_.__color_umi3l_gg_{fill:var(--color_umi3l)}.___SArea_umi3l_gg_.__pattern_umi3l_gg_{fill:var(--pattern_umi3l);fill-opacity:.5}.___SArea_umi3l_gg_.__transparent_umi3l_gg_{opacity:.3}.___SAreaLine_umi3l_gg_{stroke:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245));stroke-width:2;fill:#0000}.___SAreaLine_umi3l_gg_.__color_umi3l_gg_{stroke:var(--color_umi3l)}.___SAreaLine_umi3l_gg_.__transparent_umi3l_gg_{opacity:.3}.___SAreaLine_umi3l_gg_,.___SArea_umi3l_gg_{transition-property:d;transition-duration:var(--duration_umi3l);transition-timing-function:ease-in-out}.___SNull_umi3l_gg_{fill:#0000;stroke:var(--intergalactic-chart-palette-order-null,oklch(.9 .009 234));stroke-dasharray:4}.___SNull_umi3l_gg_.__hide_umi3l_gg_{display:none}",
|
|
20
22
|
/*__inner_css_end__*/
|
|
21
|
-
"
|
|
23
|
+
"umi3l_gg_"
|
|
22
24
|
), /*__reshadow_css_end__*/
|
|
23
25
|
{
|
|
24
|
-
"__SArea": "
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
26
|
+
"__SArea": "___SArea_umi3l_gg_",
|
|
27
|
+
"_withGradient": "__withGradient_umi3l_gg_",
|
|
28
|
+
"_color": "__color_umi3l_gg_",
|
|
29
|
+
"--color": "--color_umi3l",
|
|
30
|
+
"_pattern": "__pattern_umi3l_gg_",
|
|
31
|
+
"--pattern": "--pattern_umi3l",
|
|
32
|
+
"_transparent": "__transparent_umi3l_gg_",
|
|
33
|
+
"__SAreaLine": "___SAreaLine_umi3l_gg_",
|
|
34
|
+
"--duration": "--duration_umi3l",
|
|
35
|
+
"__SNull": "___SNull_umi3l_gg_",
|
|
36
|
+
"_hide": "__hide_umi3l_gg_"
|
|
34
37
|
})
|
|
35
38
|
);
|
|
36
39
|
class AreaRoot extends Component {
|
|
@@ -107,8 +110,99 @@ class AreaRoot extends Component {
|
|
|
107
110
|
const index = bisector((d) => d[x]).center(data, vX);
|
|
108
111
|
onClick(index, e);
|
|
109
112
|
}
|
|
110
|
-
|
|
113
|
+
renderForecast() {
|
|
111
114
|
var _ref;
|
|
115
|
+
const SArea = SvgElement;
|
|
116
|
+
const SAreaLine = SvgElement;
|
|
117
|
+
const {
|
|
118
|
+
styles,
|
|
119
|
+
hide,
|
|
120
|
+
d3,
|
|
121
|
+
d3Line,
|
|
122
|
+
color,
|
|
123
|
+
uid,
|
|
124
|
+
duration,
|
|
125
|
+
y,
|
|
126
|
+
transparent,
|
|
127
|
+
resolveColor
|
|
128
|
+
} = this.asProps;
|
|
129
|
+
const data = getDataOfType(this.asProps.data, FORECAST, y);
|
|
130
|
+
return _ref = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SAreaLine, _ref.cn("SAreaLine", {
|
|
131
|
+
"tag": "path",
|
|
132
|
+
"aria-hidden": true,
|
|
133
|
+
"clipPath": `url(#${uid}-animation)`,
|
|
134
|
+
"d": d3Line(data),
|
|
135
|
+
"color": resolveColor(color),
|
|
136
|
+
"use:duration": `${duration}ms`,
|
|
137
|
+
"transparent": transparent,
|
|
138
|
+
"strokeDasharray": "0 4",
|
|
139
|
+
"strokeLinecap": "round"
|
|
140
|
+
})), /* @__PURE__ */ React.createElement(SArea, _ref.cn("SArea", {
|
|
141
|
+
"aria-hidden": true,
|
|
142
|
+
"tag": "path",
|
|
143
|
+
"clipPath": `url(#${uid})`,
|
|
144
|
+
"d": d3(data),
|
|
145
|
+
"hide": hide,
|
|
146
|
+
"pattern": `url(#${uid}-forecast-gradient)`,
|
|
147
|
+
"mask": `url(#${uid}-forecast-mask)`,
|
|
148
|
+
"use:duration": `${duration}ms`,
|
|
149
|
+
"transparent": transparent,
|
|
150
|
+
"onClickCapture": this.handlerOnClick.bind(this)
|
|
151
|
+
})), /* @__PURE__ */ React.createElement(ForecastGradient, _ref.cn("ForecastGradient", {
|
|
152
|
+
"id": `${uid}-forecast-gradient`,
|
|
153
|
+
"color": resolveColor(color)
|
|
154
|
+
})), /* @__PURE__ */ React.createElement(StrokeMask, _ref.cn("StrokeMask", {
|
|
155
|
+
"id": `${uid}-forecast-mask`,
|
|
156
|
+
"color": resolveColor(color)
|
|
157
|
+
})));
|
|
158
|
+
}
|
|
159
|
+
renderPotential() {
|
|
160
|
+
var _ref2;
|
|
161
|
+
const SArea = SvgElement;
|
|
162
|
+
const SAreaLine = SvgElement;
|
|
163
|
+
const {
|
|
164
|
+
styles,
|
|
165
|
+
hide,
|
|
166
|
+
d3,
|
|
167
|
+
d3Line,
|
|
168
|
+
uid,
|
|
169
|
+
duration,
|
|
170
|
+
y,
|
|
171
|
+
transparent
|
|
172
|
+
} = this.asProps;
|
|
173
|
+
const data = getDataOfType(this.asProps.data, POTENTIAL, y);
|
|
174
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SAreaLine, _ref2.cn("SAreaLine", {
|
|
175
|
+
"tag": "path",
|
|
176
|
+
"aria-hidden": true,
|
|
177
|
+
"clipPath": `url(#${uid}-animation)`,
|
|
178
|
+
"d": d3Line(data),
|
|
179
|
+
"color": `url(#${uid}-potential-gradient-line)`,
|
|
180
|
+
"use:duration": `${duration}ms`,
|
|
181
|
+
"transparent": transparent,
|
|
182
|
+
"strokeDasharray": "4 4"
|
|
183
|
+
})), /* @__PURE__ */ React.createElement(SArea, _ref2.cn("SArea", {
|
|
184
|
+
"aria-hidden": true,
|
|
185
|
+
"tag": "path",
|
|
186
|
+
"clipPath": `url(#${uid})`,
|
|
187
|
+
"d": d3(data),
|
|
188
|
+
"hide": hide,
|
|
189
|
+
"pattern": `url(#${uid}-potential-gradient)`,
|
|
190
|
+
"mask": `url(#${uid}-potential-mask)`,
|
|
191
|
+
"use:duration": `${duration}ms`,
|
|
192
|
+
"transparent": transparent,
|
|
193
|
+
"onClickCapture": this.handlerOnClick.bind(this)
|
|
194
|
+
})), /* @__PURE__ */ React.createElement(PotentialGradient, _ref2.cn("PotentialGradient", {
|
|
195
|
+
"id": `${uid}-potential-gradient`,
|
|
196
|
+
"type": "area"
|
|
197
|
+
})), /* @__PURE__ */ React.createElement(PotentialGradient, _ref2.cn("PotentialGradient", {
|
|
198
|
+
"id": `${uid}-potential-gradient-line`,
|
|
199
|
+
"type": "line"
|
|
200
|
+
})), /* @__PURE__ */ React.createElement(StrokeMask, _ref2.cn("StrokeMask", {
|
|
201
|
+
"id": `${uid}-potential-mask`
|
|
202
|
+
})));
|
|
203
|
+
}
|
|
204
|
+
render() {
|
|
205
|
+
var _ref3;
|
|
112
206
|
const SArea = this.Element;
|
|
113
207
|
const SAreaLine = SvgElement;
|
|
114
208
|
const {
|
|
@@ -126,13 +220,14 @@ class AreaRoot extends Component {
|
|
|
126
220
|
transparent,
|
|
127
221
|
forcedAdvancedMode,
|
|
128
222
|
resolveColor,
|
|
129
|
-
patterns
|
|
223
|
+
patterns,
|
|
224
|
+
withGradient
|
|
130
225
|
} = this.asProps;
|
|
131
226
|
const advancedMode = forcedAdvancedMode || !!findComponent(Children, [Area.Line.displayName]);
|
|
132
|
-
const data = this.asProps.data.filter((item) => item[y] !== interpolateValue);
|
|
227
|
+
const data = this.asProps.data.filter((item) => item[y] !== interpolateValue && item[DATA_TYPE] !== FORECAST && item[DATA_TYPE] !== POTENTIAL);
|
|
133
228
|
this.asProps.dataHintsHandler.specifyDataRowFields(x, y);
|
|
134
229
|
this.asProps.dataHintsHandler.establishDataType("time-series");
|
|
135
|
-
return
|
|
230
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, !advancedMode && /* @__PURE__ */ React.createElement(SAreaLine, _ref3.cn("SAreaLine", {
|
|
136
231
|
"tag": "path",
|
|
137
232
|
"aria-hidden": true,
|
|
138
233
|
"clipPath": `url(#${uid}-animation)`,
|
|
@@ -140,7 +235,7 @@ class AreaRoot extends Component {
|
|
|
140
235
|
"color": resolveColor(color),
|
|
141
236
|
"use:duration": `${duration}ms`,
|
|
142
237
|
"transparent": transparent
|
|
143
|
-
})), /* @__PURE__ */ React.createElement(SArea,
|
|
238
|
+
})), this.renderForecast(), this.renderPotential(), /* @__PURE__ */ React.createElement(SArea, _ref3.cn("SArea", {
|
|
144
239
|
"aria-hidden": true,
|
|
145
240
|
"clipPath": `url(#${uid})`,
|
|
146
241
|
"render": "path",
|
|
@@ -150,13 +245,19 @@ class AreaRoot extends Component {
|
|
|
150
245
|
"color": resolveColor(color),
|
|
151
246
|
"use:duration": `${duration}ms`,
|
|
152
247
|
"transparent": transparent,
|
|
153
|
-
"onClickCapture": this.handlerOnClick.bind(this)
|
|
154
|
-
|
|
248
|
+
"onClickCapture": this.handlerOnClick.bind(this),
|
|
249
|
+
"withGradient": patterns ? void 0 : withGradient
|
|
250
|
+
})), duration && /* @__PURE__ */ React.createElement(AnimatedClipPath, _ref3.cn("AnimatedClipPath", {
|
|
155
251
|
"duration": duration,
|
|
156
252
|
"id": uid,
|
|
157
253
|
"width": 0,
|
|
158
254
|
"height": size[1]
|
|
159
|
-
})),
|
|
255
|
+
})), duration && /* @__PURE__ */ React.createElement(AnimatedClipPath, _ref3.cn("AnimatedClipPath", {
|
|
256
|
+
"duration": duration,
|
|
257
|
+
"id": `${uid}-animation`,
|
|
258
|
+
"width": 0,
|
|
259
|
+
"height": size[1]
|
|
260
|
+
})), patterns && /* @__PURE__ */ React.createElement(PatternFill, _ref3.cn("PatternFill", {
|
|
160
261
|
"id": `${uid}-pattern`,
|
|
161
262
|
"patternKey": color,
|
|
162
263
|
"color": resolveColor(color),
|
|
@@ -184,7 +285,7 @@ _defineProperty(AreaRoot, "defaultProps", ({
|
|
|
184
285
|
};
|
|
185
286
|
});
|
|
186
287
|
function Line(props) {
|
|
187
|
-
var
|
|
288
|
+
var _ref4;
|
|
188
289
|
const {
|
|
189
290
|
Element: SAreaLine,
|
|
190
291
|
styles,
|
|
@@ -196,7 +297,7 @@ function Line(props) {
|
|
|
196
297
|
uid,
|
|
197
298
|
transparent
|
|
198
299
|
} = props;
|
|
199
|
-
return
|
|
300
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SAreaLine, _ref4.cn("SAreaLine", {
|
|
200
301
|
"render": "path",
|
|
201
302
|
"clipPath": `url(#${uid})`,
|
|
202
303
|
"d": d3(data),
|
|
@@ -206,7 +307,7 @@ function Line(props) {
|
|
|
206
307
|
}));
|
|
207
308
|
}
|
|
208
309
|
function Null(props) {
|
|
209
|
-
var
|
|
310
|
+
var _ref5;
|
|
210
311
|
const {
|
|
211
312
|
Element: SNull,
|
|
212
313
|
styles,
|
|
@@ -216,7 +317,7 @@ function Null(props) {
|
|
|
216
317
|
color,
|
|
217
318
|
resolveColor
|
|
218
319
|
} = props;
|
|
219
|
-
return
|
|
320
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SNull, _ref5.cn("SNull", {
|
|
220
321
|
"render": "path",
|
|
221
322
|
"d": d3(data),
|
|
222
323
|
"hide": hide,
|