@semcore/d3-chart 17.2.0-prerelease.7 → 17.3.0-prerelease.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/lib/cjs/Area.js +11 -11
- package/lib/cjs/Axis.js +16 -16
- package/lib/cjs/Bar.js +16 -16
- package/lib/cjs/Bubble.js +14 -14
- package/lib/cjs/CompactHorizontalBar.js +16 -16
- package/lib/cjs/Donut.js +9 -9
- package/lib/cjs/Dots.js +8 -8
- package/lib/cjs/HorizontalBar.js +16 -16
- package/lib/cjs/Hover.js +3 -3
- package/lib/cjs/Line.js +9 -9
- package/lib/cjs/Plot.js +2 -2
- package/lib/cjs/Radar.js +20 -20
- package/lib/cjs/Radar.js.map +1 -1
- package/lib/cjs/RadialTree.js +12 -12
- package/lib/cjs/Reference.js +12 -12
- package/lib/cjs/ScatterPlot.js +9 -9
- package/lib/cjs/Tooltip.js +9 -9
- package/lib/cjs/Venn.js +9 -9
- package/lib/cjs/a11y/PlotA11yModule.js +2 -2
- package/lib/cjs/a11y/PlotA11yView.js +2 -2
- package/lib/cjs/a11y/serialize.js +6 -1
- package/lib/cjs/a11y/serialize.js.map +1 -1
- package/lib/cjs/component/Chart/AbstractChart.js +85 -11
- package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
- package/lib/cjs/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/AreaChart.js +6 -2
- package/lib/cjs/component/Chart/AreaChart.js.map +1 -1
- package/lib/cjs/component/Chart/BarChart.js +8 -4
- package/lib/cjs/component/Chart/BarChart.js.map +1 -1
- package/lib/cjs/component/Chart/BubbleChart.js +6 -2
- package/lib/cjs/component/Chart/BubbleChart.js.map +1 -1
- package/lib/cjs/component/Chart/CigaretteChart.js +22 -12
- package/lib/cjs/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/cjs/component/Chart/CompactHorizontalBarChart.js +7 -3
- package/lib/cjs/component/Chart/CompactHorizontalBarChart.js.map +1 -1
- package/lib/cjs/component/Chart/HistogramChart.js +8 -4
- package/lib/cjs/component/Chart/HistogramChart.js.map +1 -1
- package/lib/cjs/component/Chart/LineChart.js +7 -3
- package/lib/cjs/component/Chart/LineChart.js.map +1 -1
- package/lib/cjs/component/Chart/ScatterPlotChart.js +6 -2
- package/lib/cjs/component/Chart/ScatterPlotChart.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +17 -17
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/lib/cjs/style/abstract-chart.shadow.css +7 -0
- package/lib/es6/Area.js +11 -11
- package/lib/es6/Axis.js +16 -16
- package/lib/es6/Bar.js +16 -16
- package/lib/es6/Bubble.js +14 -14
- package/lib/es6/CompactHorizontalBar.js +16 -16
- package/lib/es6/Donut.js +9 -9
- package/lib/es6/Dots.js +8 -8
- package/lib/es6/HorizontalBar.js +16 -16
- package/lib/es6/Hover.js +3 -3
- package/lib/es6/Line.js +9 -9
- package/lib/es6/Plot.js +2 -2
- package/lib/es6/Radar.js +20 -20
- package/lib/es6/Radar.js.map +1 -1
- package/lib/es6/RadialTree.js +12 -12
- package/lib/es6/Reference.js +12 -12
- package/lib/es6/ScatterPlot.js +9 -9
- package/lib/es6/Tooltip.js +9 -9
- package/lib/es6/Venn.js +9 -9
- package/lib/es6/a11y/PlotA11yModule.js +2 -2
- package/lib/es6/a11y/PlotA11yView.js +2 -2
- package/lib/es6/a11y/serialize.js +6 -1
- package/lib/es6/a11y/serialize.js.map +1 -1
- package/lib/es6/component/Chart/AbstractChart.js +85 -11
- package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
- package/lib/es6/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/es6/component/Chart/AreaChart.js +6 -2
- package/lib/es6/component/Chart/AreaChart.js.map +1 -1
- package/lib/es6/component/Chart/BarChart.js +8 -4
- package/lib/es6/component/Chart/BarChart.js.map +1 -1
- package/lib/es6/component/Chart/BubbleChart.js +6 -2
- package/lib/es6/component/Chart/BubbleChart.js.map +1 -1
- package/lib/es6/component/Chart/CigaretteChart.js +22 -12
- package/lib/es6/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/es6/component/Chart/CompactHorizontalBarChart.js +7 -3
- package/lib/es6/component/Chart/CompactHorizontalBarChart.js.map +1 -1
- package/lib/es6/component/Chart/HistogramChart.js +8 -4
- package/lib/es6/component/Chart/HistogramChart.js.map +1 -1
- package/lib/es6/component/Chart/LineChart.js +7 -3
- package/lib/es6/component/Chart/LineChart.js.map +1 -1
- package/lib/es6/component/Chart/ScatterPlotChart.js +6 -2
- package/lib/es6/component/Chart/ScatterPlotChart.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +17 -17
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/lib/es6/style/abstract-chart.shadow.css +7 -0
- package/lib/esm/Area.mjs +12 -12
- package/lib/esm/Axis.mjs +17 -17
- package/lib/esm/Bar.mjs +17 -17
- package/lib/esm/Bubble.mjs +15 -15
- package/lib/esm/CompactHorizontalBar.mjs +17 -17
- package/lib/esm/Donut.mjs +10 -10
- package/lib/esm/Dots.mjs +9 -9
- package/lib/esm/HorizontalBar.mjs +17 -17
- package/lib/esm/Hover.mjs +4 -4
- package/lib/esm/Line.mjs +10 -10
- package/lib/esm/Plot.mjs +3 -3
- package/lib/esm/Radar.mjs +21 -21
- package/lib/esm/RadialTree.mjs +13 -13
- package/lib/esm/Reference.mjs +13 -13
- package/lib/esm/ScatterPlot.mjs +10 -10
- package/lib/esm/Tooltip.mjs +10 -10
- package/lib/esm/Venn.mjs +10 -10
- package/lib/esm/a11y/PlotA11yModule.mjs +3 -3
- package/lib/esm/a11y/PlotA11yView.mjs +3 -3
- package/lib/esm/a11y/serialize.mjs +6 -1
- package/lib/esm/component/Chart/AbstractChart.mjs +86 -12
- package/lib/esm/component/Chart/AreaChart.mjs +6 -2
- package/lib/esm/component/Chart/BarChart.mjs +8 -4
- package/lib/esm/component/Chart/BubbleChart.mjs +6 -2
- package/lib/esm/component/Chart/CigaretteChart.mjs +22 -12
- package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +7 -3
- package/lib/esm/component/Chart/HistogramChart.mjs +8 -4
- package/lib/esm/component/Chart/LineChart.mjs +7 -3
- package/lib/esm/component/Chart/ScatterPlotChart.mjs +6 -2
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +5 -5
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +18 -18
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +7 -7
- package/lib/esm/style/abstract-chart.shadow.css +7 -0
- package/lib/types/component/Chart/AbstractChart.d.ts +14 -0
- package/lib/types/component/Chart/AbstractChart.type.d.ts +11 -2
- package/package.json +16 -16
- package/vitest.config.mts +17 -0
package/lib/esm/ScatterPlot.mjs
CHANGED
|
@@ -13,19 +13,19 @@ const style = (
|
|
|
13
13
|
/*__reshadow_css_start__*/
|
|
14
14
|
(sstyled.insert(
|
|
15
15
|
/*__inner_css_start__*/
|
|
16
|
-
".
|
|
16
|
+
".___SScatterPlot_14241_gg_{fill:var(--intergalactic-chart-palette-order-1,oklch(.58 .168 278.2));transition-property:cx,cy;transition-duration:var(--duration_14241);transition-timing-function:ease-in-out;opacity:.5}@media (hover:hover){.___SScatterPlot_14241_gg_:hover{opacity:.8}}.___SScatterPlot_14241_gg_.__color_14241_gg_{fill:var(--color_14241)}.___SScatterPlot_14241_gg_.__pattern_14241_gg_.__color_14241_gg_{fill:var(--pattern_14241);stroke:var(--color_14241);stroke-width:1px}.___SScatterPlot_14241_gg_.__transparent_14241_gg_{opacity:.3}.___SValue_14241_gg_{text-anchor:middle;font-size:var(--intergalactic-fs-50,10px);stroke:var(--intergalactic-chart-palette-order-9,oklch(.53 .157 279.2))}.___SValue_14241_gg_.__color_14241_gg_{stroke:var(--color_14241)}.___SValue_14241_gg_.__transparent_14241_gg_{opacity:.3}",
|
|
17
17
|
/*__inner_css_end__*/
|
|
18
|
-
"
|
|
18
|
+
"14241_gg_"
|
|
19
19
|
), /*__reshadow_css_end__*/
|
|
20
20
|
{
|
|
21
|
-
"__SScatterPlot": "
|
|
22
|
-
"_color": "
|
|
23
|
-
"--color": "--
|
|
24
|
-
"_pattern": "
|
|
25
|
-
"--pattern": "--
|
|
26
|
-
"_transparent": "
|
|
27
|
-
"__SValue": "
|
|
28
|
-
"--duration": "--
|
|
21
|
+
"__SScatterPlot": "___SScatterPlot_14241_gg_",
|
|
22
|
+
"_color": "__color_14241_gg_",
|
|
23
|
+
"--color": "--color_14241",
|
|
24
|
+
"_pattern": "__pattern_14241_gg_",
|
|
25
|
+
"--pattern": "--pattern_14241",
|
|
26
|
+
"_transparent": "__transparent_14241_gg_",
|
|
27
|
+
"__SValue": "___SValue_14241_gg_",
|
|
28
|
+
"--duration": "--duration_14241"
|
|
29
29
|
})
|
|
30
30
|
);
|
|
31
31
|
class ScatterPlotRoot extends Component {
|
package/lib/esm/Tooltip.mjs
CHANGED
|
@@ -12,19 +12,19 @@ const style = (
|
|
|
12
12
|
/*__reshadow_css_start__*/
|
|
13
13
|
(sstyled.insert(
|
|
14
14
|
/*__inner_css_start__*/
|
|
15
|
-
".
|
|
15
|
+
".___STooltip_j5bmf_gg_{font-size:var(--intergalactic-fs-100,12px);line-height:var(--intergalactic-lh-100,133%);position:relative;background-color:var(--intergalactic-bg-primary-neutral,oklch(1 0 0));border-radius:var(--intergalactic-popper-rounded,6px);border:1px solid var(--intergalactic-border-secondary,#00151012);box-sizing:border-box;box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 #00151012);padding:var(--intergalactic-spacing-3x,12px)}@media (color-gamut:p3){.___STooltip_j5bmf_gg_{border:1px solid var(--intergalactic-border-secondary,oklch(.176 .033 175.7/.07));box-shadow:var(--intergalactic-box-shadow-popper,1px 1px 10px 0 oklch(.176 .033 175.7/.07))}}.___STitle_j5bmf_gg_{color:var(--intergalactic-text-secondary,#00030095);margin-bottom:var(--intergalactic-spacing-2x,8px)}@media (color-gamut:p3){.___STitle_j5bmf_gg_{color:var(--intergalactic-text-secondary,oklch(.088 .026 147.7/.583))}}.___SDotGroup_j5bmf_gg_{display:flex;align-items:center}.___SDot_j5bmf_gg_{margin-right:var(--intergalactic-spacing-2x,8px)}.___SDotCircle_j5bmf_gg_.__color_j5bmf_gg_{background-color:var(--color_j5bmf);width:8px;height:8px;border-radius:50%}.___SFooter_j5bmf_gg_{background:var(--intergalactic-bg-secondary-neutral,oklch(.98 .001 180));padding:var(--intergalactic-spacing-1x,4px) var(--intergalactic-spacing-3x,12px);border-radius:0 0 var(--intergalactic-rounded-medium,6px) var(--intergalactic-rounded-medium,6px);margin:var(--intergalactic-spacing-3x,12px) calc(var(--intergalactic-spacing-3x, 12px)*-1) calc(var(--intergalactic-spacing-3x, 12px)*-1)}",
|
|
16
16
|
/*__inner_css_end__*/
|
|
17
|
-
"
|
|
17
|
+
"j5bmf_gg_"
|
|
18
18
|
), /*__reshadow_css_end__*/
|
|
19
19
|
{
|
|
20
|
-
"__STooltip": "
|
|
21
|
-
"__STitle": "
|
|
22
|
-
"__SDotGroup": "
|
|
23
|
-
"__SDot": "
|
|
24
|
-
"__SDotCircle": "
|
|
25
|
-
"_color": "
|
|
26
|
-
"--color": "--
|
|
27
|
-
"__SFooter": "
|
|
20
|
+
"__STooltip": "___STooltip_j5bmf_gg_",
|
|
21
|
+
"__STitle": "___STitle_j5bmf_gg_",
|
|
22
|
+
"__SDotGroup": "___SDotGroup_j5bmf_gg_",
|
|
23
|
+
"__SDot": "___SDot_j5bmf_gg_",
|
|
24
|
+
"__SDotCircle": "___SDotCircle_j5bmf_gg_",
|
|
25
|
+
"_color": "__color_j5bmf_gg_",
|
|
26
|
+
"--color": "--color_j5bmf",
|
|
27
|
+
"__SFooter": "___SFooter_j5bmf_gg_"
|
|
28
28
|
})
|
|
29
29
|
);
|
|
30
30
|
const TooltipDotRenderContext = /* @__PURE__ */ React.createContext({
|
package/lib/esm/Venn.mjs
CHANGED
|
@@ -16,19 +16,19 @@ const style = (
|
|
|
16
16
|
/*__reshadow_css_start__*/
|
|
17
17
|
(sstyled.insert(
|
|
18
18
|
/*__inner_css_start__*/
|
|
19
|
-
".
|
|
19
|
+
".___SCircle_1gs70_gg_{fill:var(--intergalactic-chart-palette-order-2,oklch(.82 .15 170));stroke:var(--intergalactic-chart-grid-border,#fff);stroke-width:2px;fill-opacity:.5;transition-property:cx,cy;transition-duration:var(--duration_1gs70);transition-timing-function:ease-in-out}@media (hover:hover){.___SCircle_1gs70_gg_:hover{fill-opacity:.7}}.___SCircle_1gs70_gg_.__color_1gs70_gg_{fill:var(--color_1gs70)}.___SCircle_1gs70_gg_.__pattern_1gs70_gg_.__color_1gs70_gg_{fill:var(--pattern_1gs70);fill-opacity:.7;stroke:var(--color_1gs70);stroke-width:1px}@media (hover:hover){.___SCircle_1gs70_gg_.__pattern_1gs70_gg_.__color_1gs70_gg_:hover{fill-opacity:.85}}.___SCircle_1gs70_gg_.__transparent_1gs70_gg_{opacity:.3}.___SIntersection_1gs70_gg_{stroke:var(--intergalactic-chart-grid-border,#fff);stroke-width:2px;fill-opacity:0}@media (hover:hover){.___SIntersection_1gs70_gg_:hover{fill-opacity:.1}}.___SIntersection_1gs70_gg_.__transparent_1gs70_gg_{opacity:.3}",
|
|
20
20
|
/*__inner_css_end__*/
|
|
21
|
-
"
|
|
21
|
+
"1gs70_gg_"
|
|
22
22
|
), /*__reshadow_css_end__*/
|
|
23
23
|
{
|
|
24
|
-
"__SCircle": "
|
|
25
|
-
"_color": "
|
|
26
|
-
"--color": "--
|
|
27
|
-
"_transparent": "
|
|
28
|
-
"__SIntersection": "
|
|
29
|
-
"--duration": "--
|
|
30
|
-
"_pattern": "
|
|
31
|
-
"--pattern": "--
|
|
24
|
+
"__SCircle": "___SCircle_1gs70_gg_",
|
|
25
|
+
"_color": "__color_1gs70_gg_",
|
|
26
|
+
"--color": "--color_1gs70",
|
|
27
|
+
"_transparent": "__transparent_1gs70_gg_",
|
|
28
|
+
"__SIntersection": "___SIntersection_1gs70_gg_",
|
|
29
|
+
"--duration": "--duration_1gs70",
|
|
30
|
+
"_pattern": "__pattern_1gs70_gg_",
|
|
31
|
+
"--pattern": "--pattern_1gs70"
|
|
32
32
|
})
|
|
33
33
|
);
|
|
34
34
|
class VennRoot extends Component {
|
|
@@ -10,12 +10,12 @@ const styles = (
|
|
|
10
10
|
/*__reshadow_css_start__*/
|
|
11
11
|
(sstyled.insert(
|
|
12
12
|
/*__inner_css_start__*/
|
|
13
|
-
".
|
|
13
|
+
".___SPlotA11yModule_18sta_gg_{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}",
|
|
14
14
|
/*__inner_css_end__*/
|
|
15
|
-
"
|
|
15
|
+
"18sta_gg_"
|
|
16
16
|
), /*__reshadow_css_end__*/
|
|
17
17
|
{
|
|
18
|
-
"__SPlotA11yModule": "
|
|
18
|
+
"__SPlotA11yModule": "___SPlotA11yModule_18sta_gg_"
|
|
19
19
|
})
|
|
20
20
|
);
|
|
21
21
|
function PlotA11yModule(props) {
|
|
@@ -13,12 +13,12 @@ const styles = (
|
|
|
13
13
|
/*__reshadow_css_start__*/
|
|
14
14
|
(sstyled.insert(
|
|
15
15
|
/*__inner_css_start__*/
|
|
16
|
-
".
|
|
16
|
+
".___SPlotA11yView_1hm9h_gg_{position:relative;display:block;background-color:var(--intergalactic-bg-primary-neutral,oklch(1 0 0));color:var(--intergalactic-text-primary,oklch(.1 .03 137/.899));border:3px solid var(--intergalactic-border-primary,#000c0829);font-size:var(--intergalactic-fs-50,10px);z-index:var(--intergalactic-z-index-overlay,500);padding:2px;width:200px;height:200px;max-width:80%;max-height:80%;overflow:auto}@media (color-gamut:p3){.___SPlotA11yView_1hm9h_gg_{border:3px solid var(--intergalactic-border-primary,oklch(.137 .026 175.7/.161))}}.___SPlotA11yView_1hm9h_gg_ a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline;margin-bottom:var(--intergalactic-spacing-2x,8px);display:block}.___SPlotA11yView_1hm9h_gg_ :is(table,td,th){border:1px solid var(--intergalactic-border-primary,#000c0829)}@media (color-gamut:p3){.___SPlotA11yView_1hm9h_gg_ :is(table,td,th){border:1px solid var(--intergalactic-border-primary,oklch(.137 .026 175.7/.161))}}",
|
|
17
17
|
/*__inner_css_end__*/
|
|
18
|
-
"
|
|
18
|
+
"1hm9h_gg_"
|
|
19
19
|
), /*__reshadow_css_end__*/
|
|
20
20
|
{
|
|
21
|
-
"__SPlotA11yView": "
|
|
21
|
+
"__SPlotA11yView": "___SPlotA11yView_1hm9h_gg_"
|
|
22
22
|
})
|
|
23
23
|
);
|
|
24
24
|
function PlotA11yView({
|
|
@@ -237,7 +237,12 @@ ${dataRangeSummary}`;
|
|
|
237
237
|
minSize
|
|
238
238
|
});
|
|
239
239
|
const entitiesList = biggestClusters.map((clusterInsight) => {
|
|
240
|
-
const labels = formatLimitedSizeList(clusterInsight.labels.
|
|
240
|
+
const labels = formatLimitedSizeList(clusterInsight.labels.reduce((acc, label) => {
|
|
241
|
+
if (typeof label === "string") {
|
|
242
|
+
acc.push(titlesFormatter?.(label) ?? label);
|
|
243
|
+
}
|
|
244
|
+
return acc;
|
|
245
|
+
}, []), intl, maxListSymbols);
|
|
241
246
|
const anonymous = clusterInsight.labels.length === 0 || labels === String(clusterInsight.size);
|
|
242
247
|
return intl.formatMessage({
|
|
243
248
|
id: anonymous ? "entity-type-clusters-label-anonymous" : "entity-type-clusters-label"
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import { sstyled, Component, assignProps } from "@semcore/core";
|
|
3
4
|
import { Box, Flex } from "@semcore/base-components";
|
|
4
5
|
import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
|
|
5
6
|
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
7
|
+
import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
|
|
8
|
+
import cssToIntDefault from "@semcore/core/lib/utils/cssToIntDefault";
|
|
9
|
+
import trottle from "@semcore/core/lib/utils/rafTrottle";
|
|
6
10
|
import { Text } from "@semcore/typography";
|
|
7
11
|
import React, { Fragment } from "react";
|
|
8
12
|
import "../../index.mjs";
|
|
@@ -18,14 +22,15 @@ const style = (
|
|
|
18
22
|
/*__reshadow_css_start__*/
|
|
19
23
|
(sstyled.insert(
|
|
20
24
|
/*__inner_css_start__*/
|
|
21
|
-
".
|
|
25
|
+
".___SChart_giu6t_gg_{width:100%;height:100%;min-width:0;min-height:0}.___STooltipChildrenWrapper_giu6t_gg_{display:grid;grid-column-gap:var(--intergalactic-spacing-2x,8px);-moz-column-gap:var(--intergalactic-spacing-2x,8px);column-gap:var(--intergalactic-spacing-2x,8px)}.___STooltipChildrenWrapper_giu6t_gg_._columnsCount_2_giu6t_gg_{grid-template-columns:auto minmax(28px,max-content)}.___STooltipChildrenWrapper_giu6t_gg_._columnsCount_3_giu6t_gg_{grid-template-columns:auto minmax(28px,max-content) minmax(28px,max-content)}",
|
|
22
26
|
/*__inner_css_end__*/
|
|
23
|
-
"
|
|
27
|
+
"giu6t_gg_"
|
|
24
28
|
), /*__reshadow_css_end__*/
|
|
25
29
|
{
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
30
|
+
"__SChart": "___SChart_giu6t_gg_",
|
|
31
|
+
"__STooltipChildrenWrapper": "___STooltipChildrenWrapper_giu6t_gg_",
|
|
32
|
+
"_columnsCount_2": "_columnsCount_2_giu6t_gg_",
|
|
33
|
+
"_columnsCount_3": "_columnsCount_3_giu6t_gg_"
|
|
29
34
|
})
|
|
30
35
|
);
|
|
31
36
|
const NOT_A_VALUE = "n/a";
|
|
@@ -34,6 +39,13 @@ class AbstractChart extends Component {
|
|
|
34
39
|
super(props);
|
|
35
40
|
_defineProperty(this, "plotPadding", 6);
|
|
36
41
|
_defineProperty(this, "dataHints", makeDataHintsContainer());
|
|
42
|
+
_defineProperty(this, "chartRef", /* @__PURE__ */ React.createRef());
|
|
43
|
+
_defineProperty(this, "legendRef", /* @__PURE__ */ React.createRef());
|
|
44
|
+
_defineProperty(this, "observer", void 0);
|
|
45
|
+
this.handleResize = trottle(this.handleResize.bind(this));
|
|
46
|
+
if (canUseDOM() && (!props.plotWidth || !props.plotHeight)) {
|
|
47
|
+
this.observer = new ResizeObserver(this.handleResize);
|
|
48
|
+
}
|
|
37
49
|
this.setHighlightedLine = this.setHighlightedLine.bind(this);
|
|
38
50
|
this.handleChangeVisible = this.handleChangeVisible.bind(this);
|
|
39
51
|
this.handleMouseEnter = this.handleMouseEnter.bind(this);
|
|
@@ -44,9 +56,14 @@ class AbstractChart extends Component {
|
|
|
44
56
|
this.state = {
|
|
45
57
|
dataDefinitions: this.getDefaultDataDefinitions(),
|
|
46
58
|
highlightedLine: -1,
|
|
47
|
-
withTrend: false
|
|
59
|
+
withTrend: false,
|
|
60
|
+
plotWidth: 0,
|
|
61
|
+
plotHeight: 0
|
|
48
62
|
};
|
|
49
63
|
}
|
|
64
|
+
componentDidMount() {
|
|
65
|
+
this.observer?.observe(this.chartRef.current);
|
|
66
|
+
}
|
|
50
67
|
componentDidUpdate(prevProps) {
|
|
51
68
|
if (prevProps.data !== this.props.data || prevProps.legendProps !== this.props.legendProps) {
|
|
52
69
|
this.setState({
|
|
@@ -54,6 +71,15 @@ class AbstractChart extends Component {
|
|
|
54
71
|
});
|
|
55
72
|
}
|
|
56
73
|
}
|
|
74
|
+
componentWillUnmount() {
|
|
75
|
+
this.observer?.disconnect();
|
|
76
|
+
}
|
|
77
|
+
get plotWidth() {
|
|
78
|
+
return this.asProps.plotWidth ?? this.state.plotWidth;
|
|
79
|
+
}
|
|
80
|
+
get plotHeight() {
|
|
81
|
+
return this.asProps.plotHeight ?? this.state.plotHeight;
|
|
82
|
+
}
|
|
57
83
|
getDefaultDataDefinitions() {
|
|
58
84
|
const {
|
|
59
85
|
data,
|
|
@@ -333,7 +359,9 @@ class AbstractChart extends Component {
|
|
|
333
359
|
"aria-label": this.getLegendAriaLabel()
|
|
334
360
|
};
|
|
335
361
|
if (lProps.legendType === "Table") {
|
|
336
|
-
return /* @__PURE__ */ React.createElement(LegendTable, commonLegendProps
|
|
362
|
+
return /* @__PURE__ */ React.createElement(LegendTable, _extends({}, commonLegendProps, {
|
|
363
|
+
ref: this.legendRef
|
|
364
|
+
}));
|
|
337
365
|
}
|
|
338
366
|
if ("withTrend" in lProps) {
|
|
339
367
|
const flexLegendProps = {
|
|
@@ -343,9 +371,13 @@ class AbstractChart extends Component {
|
|
|
343
371
|
trendIsVisible: withTrend,
|
|
344
372
|
onTrendIsVisibleChange: this.handleWithTrendChange
|
|
345
373
|
};
|
|
346
|
-
return /* @__PURE__ */ React.createElement(LegendFlex, flexLegendProps
|
|
374
|
+
return /* @__PURE__ */ React.createElement(LegendFlex, _extends({}, flexLegendProps, {
|
|
375
|
+
ref: this.legendRef
|
|
376
|
+
}));
|
|
347
377
|
}
|
|
348
|
-
return /* @__PURE__ */ React.createElement(LegendFlex, commonLegendProps
|
|
378
|
+
return /* @__PURE__ */ React.createElement(LegendFlex, _extends({}, commonLegendProps, {
|
|
379
|
+
ref: this.legendRef
|
|
380
|
+
}));
|
|
349
381
|
}
|
|
350
382
|
renderAxis() {
|
|
351
383
|
const {
|
|
@@ -445,8 +477,6 @@ class AbstractChart extends Component {
|
|
|
445
477
|
const SChart = Flex;
|
|
446
478
|
const {
|
|
447
479
|
styles,
|
|
448
|
-
plotWidth,
|
|
449
|
-
plotHeight,
|
|
450
480
|
data,
|
|
451
481
|
patterns,
|
|
452
482
|
a11yAltTextConfig,
|
|
@@ -454,6 +484,10 @@ class AbstractChart extends Component {
|
|
|
454
484
|
eventEmitter,
|
|
455
485
|
showTooltip
|
|
456
486
|
} = this.asProps;
|
|
487
|
+
const {
|
|
488
|
+
plotWidth,
|
|
489
|
+
plotHeight
|
|
490
|
+
} = this;
|
|
457
491
|
const {
|
|
458
492
|
extractedAriaProps
|
|
459
493
|
} = extractAriaProps(this.asProps);
|
|
@@ -461,7 +495,8 @@ class AbstractChart extends Component {
|
|
|
461
495
|
...assignProps({
|
|
462
496
|
"gap": 5,
|
|
463
497
|
"__excludeProps": ["data", "eventEmitter"],
|
|
464
|
-
"role": "group"
|
|
498
|
+
"role": "group",
|
|
499
|
+
"ref": this.chartRef
|
|
465
500
|
}, _ref2)
|
|
466
501
|
}), this.renderLegend(), /* @__PURE__ */ React.createElement(Plot, _ref4.cn("Plot", {
|
|
467
502
|
"data": data,
|
|
@@ -476,6 +511,45 @@ class AbstractChart extends Component {
|
|
|
476
511
|
...extractedAriaProps
|
|
477
512
|
}), this.renderAxis(), !showTooltip ? null : this.renderTooltip(), this.renderChart()));
|
|
478
513
|
}
|
|
514
|
+
handleResize(entities) {
|
|
515
|
+
const {
|
|
516
|
+
aspect,
|
|
517
|
+
direction,
|
|
518
|
+
onResize,
|
|
519
|
+
plotWidth,
|
|
520
|
+
plotHeight
|
|
521
|
+
} = this.asProps;
|
|
522
|
+
const chartElement = this.chartRef.current;
|
|
523
|
+
if (!chartElement) return;
|
|
524
|
+
const legendElement = this.legendRef.current;
|
|
525
|
+
const computedStyles = window.getComputedStyle(chartElement);
|
|
526
|
+
let width = chartElement.clientWidth;
|
|
527
|
+
let height = chartElement.clientHeight;
|
|
528
|
+
if (legendElement) {
|
|
529
|
+
const gap = cssToIntDefault(computedStyles.gap, 0);
|
|
530
|
+
if (direction?.includes("column")) {
|
|
531
|
+
height = height - legendElement.clientHeight - gap;
|
|
532
|
+
} else {
|
|
533
|
+
width = width - legendElement.clientWidth - gap;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (aspect) {
|
|
537
|
+
const minHeight = cssToIntDefault(computedStyles.getPropertyValue("min-height"), -1);
|
|
538
|
+
const maxHeight = cssToIntDefault(computedStyles.getPropertyValue("max-height"), -1);
|
|
539
|
+
height = width / aspect;
|
|
540
|
+
if (minHeight !== -1 && height < minHeight) {
|
|
541
|
+
height = minHeight;
|
|
542
|
+
}
|
|
543
|
+
if (maxHeight !== -1 && height > maxHeight) {
|
|
544
|
+
height = maxHeight;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
this.setState({
|
|
548
|
+
plotWidth: plotWidth ? 0 : width,
|
|
549
|
+
plotHeight: plotHeight ? 0 : height
|
|
550
|
+
});
|
|
551
|
+
onResize?.([width, height], entities);
|
|
552
|
+
}
|
|
479
553
|
}
|
|
480
554
|
_defineProperty(AbstractChart, "style", style);
|
|
481
555
|
export {
|
|
@@ -15,10 +15,12 @@ class AreaChartComponent extends AbstractChart {
|
|
|
15
15
|
const {
|
|
16
16
|
xScale,
|
|
17
17
|
marginY = 40,
|
|
18
|
-
plotWidth,
|
|
19
18
|
data,
|
|
20
19
|
groupKey
|
|
21
20
|
} = this.asProps;
|
|
21
|
+
const {
|
|
22
|
+
plotWidth
|
|
23
|
+
} = this;
|
|
22
24
|
if (xScale) {
|
|
23
25
|
return xScale;
|
|
24
26
|
}
|
|
@@ -34,9 +36,11 @@ class AreaChartComponent extends AbstractChart {
|
|
|
34
36
|
const {
|
|
35
37
|
yScale,
|
|
36
38
|
marginX = 24,
|
|
37
|
-
plotHeight,
|
|
38
39
|
stacked
|
|
39
40
|
} = this.asProps;
|
|
41
|
+
const {
|
|
42
|
+
plotHeight
|
|
43
|
+
} = this;
|
|
40
44
|
if (yScale) {
|
|
41
45
|
return yScale;
|
|
42
46
|
}
|
|
@@ -225,12 +225,14 @@ class BarChartComponent extends AbstractChart {
|
|
|
225
225
|
const {
|
|
226
226
|
marginY = 40,
|
|
227
227
|
marginX = 24,
|
|
228
|
-
plotWidth,
|
|
229
|
-
plotHeight,
|
|
230
228
|
invertAxis,
|
|
231
229
|
data,
|
|
232
230
|
groupKey
|
|
233
231
|
} = this.asProps;
|
|
232
|
+
const {
|
|
233
|
+
plotWidth,
|
|
234
|
+
plotHeight
|
|
235
|
+
} = this;
|
|
234
236
|
const testItem = data[0][groupKey];
|
|
235
237
|
const range = invertAxis ? [plotHeight - marginX, this.plotPadding] : [marginY, plotWidth - this.plotPadding];
|
|
236
238
|
if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {
|
|
@@ -244,11 +246,13 @@ class BarChartComponent extends AbstractChart {
|
|
|
244
246
|
const {
|
|
245
247
|
marginY = 40,
|
|
246
248
|
marginX = 24,
|
|
247
|
-
plotWidth,
|
|
248
|
-
plotHeight,
|
|
249
249
|
invertAxis,
|
|
250
250
|
type
|
|
251
251
|
} = this.asProps;
|
|
252
|
+
const {
|
|
253
|
+
plotWidth,
|
|
254
|
+
plotHeight
|
|
255
|
+
} = this;
|
|
252
256
|
const max = type === "stack" ? super.maxStackedValue : Math.max(...super.flatValues);
|
|
253
257
|
return scaleLinear().range(invertAxis ? [marginY, plotWidth - this.plotPadding] : [plotHeight - marginX, this.plotPadding]).domain([0, max]);
|
|
254
258
|
}
|
|
@@ -49,9 +49,11 @@ class BubbleChartComponent extends AbstractChart {
|
|
|
49
49
|
const {
|
|
50
50
|
xScale,
|
|
51
51
|
marginY = 30,
|
|
52
|
-
plotWidth,
|
|
53
52
|
data
|
|
54
53
|
} = this.asProps;
|
|
54
|
+
const {
|
|
55
|
+
plotWidth
|
|
56
|
+
} = this;
|
|
55
57
|
if (xScale) {
|
|
56
58
|
return xScale;
|
|
57
59
|
}
|
|
@@ -63,9 +65,11 @@ class BubbleChartComponent extends AbstractChart {
|
|
|
63
65
|
const {
|
|
64
66
|
yScale,
|
|
65
67
|
marginX = 30,
|
|
66
|
-
plotHeight,
|
|
67
68
|
data
|
|
68
69
|
} = this.asProps;
|
|
70
|
+
const {
|
|
71
|
+
plotHeight
|
|
72
|
+
} = this;
|
|
69
73
|
if (yScale) {
|
|
70
74
|
return yScale;
|
|
71
75
|
}
|
|
@@ -96,12 +96,14 @@ class CigaretteChartComponent extends AbstractChart {
|
|
|
96
96
|
}
|
|
97
97
|
computeCigaretteItems() {
|
|
98
98
|
const {
|
|
99
|
-
plotWidth,
|
|
100
|
-
plotHeight,
|
|
101
99
|
data,
|
|
102
100
|
invertAxis,
|
|
103
101
|
minimalBarWidth
|
|
104
102
|
} = this.asProps;
|
|
103
|
+
const {
|
|
104
|
+
plotWidth,
|
|
105
|
+
plotHeight
|
|
106
|
+
} = this;
|
|
105
107
|
const dataDefinitions = invertAxis ? this.activeDataDefinitions : [...this.activeDataDefinitions].reverse();
|
|
106
108
|
const count = this.activePositiveDataDefinitions.length;
|
|
107
109
|
const totalGapWidth = DEFAULT_GAP * Math.max(0, count - 1);
|
|
@@ -152,13 +154,13 @@ class CigaretteChartComponent extends AbstractChart {
|
|
|
152
154
|
get xScale() {
|
|
153
155
|
const {
|
|
154
156
|
plotWidth
|
|
155
|
-
} = this
|
|
157
|
+
} = this;
|
|
156
158
|
return scaleLinear([0, plotWidth]);
|
|
157
159
|
}
|
|
158
160
|
get yScale() {
|
|
159
161
|
const {
|
|
160
162
|
plotHeight
|
|
161
|
-
} = this
|
|
163
|
+
} = this;
|
|
162
164
|
return scaleLinear([plotHeight, 0]);
|
|
163
165
|
}
|
|
164
166
|
renderChart() {
|
|
@@ -168,14 +170,16 @@ class CigaretteChartComponent extends AbstractChart {
|
|
|
168
170
|
uid,
|
|
169
171
|
duration,
|
|
170
172
|
patterns,
|
|
171
|
-
plotHeight,
|
|
172
|
-
plotWidth,
|
|
173
173
|
onClick
|
|
174
174
|
} = this.asProps;
|
|
175
175
|
const {
|
|
176
176
|
dataDefinitions,
|
|
177
177
|
highlightedLine
|
|
178
178
|
} = this.state;
|
|
179
|
+
const {
|
|
180
|
+
plotWidth,
|
|
181
|
+
plotHeight
|
|
182
|
+
} = this;
|
|
179
183
|
this.offset = 0;
|
|
180
184
|
const items = this.computeCigaretteItems();
|
|
181
185
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, items.map((item, index) => {
|
|
@@ -358,21 +362,25 @@ class CigaretteChartComponent extends AbstractChart {
|
|
|
358
362
|
const SChart = Flex;
|
|
359
363
|
const {
|
|
360
364
|
styles,
|
|
361
|
-
plotWidth,
|
|
362
|
-
plotHeight,
|
|
363
365
|
data,
|
|
364
366
|
patterns,
|
|
367
|
+
direction,
|
|
365
368
|
invertAxis,
|
|
366
369
|
a11yAltTextConfig
|
|
367
370
|
} = this.asProps;
|
|
371
|
+
const {
|
|
372
|
+
plotWidth,
|
|
373
|
+
plotHeight
|
|
374
|
+
} = this;
|
|
368
375
|
const header = this.renderHeader();
|
|
369
376
|
if (invertAxis) {
|
|
370
377
|
var _ref5;
|
|
371
378
|
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SChart, _ref5.cn("SChart", {
|
|
372
379
|
...assignProps({
|
|
373
380
|
"gap": 6,
|
|
374
|
-
"direction":
|
|
375
|
-
"__excludeProps": ["onClick", "data"]
|
|
381
|
+
"direction": direction,
|
|
382
|
+
"__excludeProps": ["onClick", "data"],
|
|
383
|
+
"ref": this.chartRef
|
|
376
384
|
}, _ref2)
|
|
377
385
|
}), /* @__PURE__ */ React.createElement(Flex, _ref5.cn("Flex", {
|
|
378
386
|
"direction": "column"
|
|
@@ -392,7 +400,8 @@ class CigaretteChartComponent extends AbstractChart {
|
|
|
392
400
|
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SChart, _ref6.cn("SChart", {
|
|
393
401
|
...assignProps({
|
|
394
402
|
"gap": 6,
|
|
395
|
-
"__excludeProps": ["onClick", "data"]
|
|
403
|
+
"__excludeProps": ["onClick", "data"],
|
|
404
|
+
"ref": this.chartRef
|
|
396
405
|
}, _ref2)
|
|
397
406
|
}), /* @__PURE__ */ React.createElement(Plot, _ref6.cn("Plot", {
|
|
398
407
|
"ref": this.plotRef,
|
|
@@ -462,7 +471,8 @@ _defineProperty(CigaretteChartComponent, "defaultProps", (props) => {
|
|
|
462
471
|
plotWidth: !invertAxis && !props.plotWidth ? 44 : props.plotWidth,
|
|
463
472
|
plotHeight: invertAxis && !props.plotHeight ? 28 : props.plotHeight,
|
|
464
473
|
showPercentValueInTooltip: false,
|
|
465
|
-
minimalBarWidth: DEFAULT_MINIMAL_BAR_WIDTH
|
|
474
|
+
minimalBarWidth: DEFAULT_MINIMAL_BAR_WIDTH,
|
|
475
|
+
direction: invertAxis ? "column" : "row"
|
|
466
476
|
};
|
|
467
477
|
});
|
|
468
478
|
_defineProperty(CigaretteChartComponent, "enhance", [resolveColorEnhance(), uniqueIDEnhancement(), i18nEnhance(localizedMessages)]);
|
|
@@ -64,17 +64,21 @@ class CompactHorizontalBarChartComponent extends AbstractChart {
|
|
|
64
64
|
get categoryScale() {
|
|
65
65
|
const {
|
|
66
66
|
marginY = 40,
|
|
67
|
-
plotHeight,
|
|
68
67
|
data,
|
|
69
68
|
y
|
|
70
69
|
} = this.asProps;
|
|
70
|
+
const {
|
|
71
|
+
plotHeight
|
|
72
|
+
} = this;
|
|
71
73
|
return scaleBand().range([plotHeight - marginY, marginY]).domain([...data].reverse().map((d) => d[y])).paddingInner(0.6).paddingOuter(0.2);
|
|
72
74
|
}
|
|
73
75
|
get valueScale() {
|
|
74
76
|
const {
|
|
75
|
-
marginY = 0
|
|
76
|
-
plotWidth
|
|
77
|
+
marginY = 0
|
|
77
78
|
} = this.asProps;
|
|
79
|
+
const {
|
|
80
|
+
plotWidth
|
|
81
|
+
} = this;
|
|
78
82
|
const sum = [...super.flatValues.values()].reduce((acc, d) => acc + d, 0);
|
|
79
83
|
return scaleLinear().range([marginY, plotWidth]).domain([marginY, sum]);
|
|
80
84
|
}
|
|
@@ -17,12 +17,14 @@ class HistogramChartComponent extends AbstractChart {
|
|
|
17
17
|
xScale,
|
|
18
18
|
marginY = 30,
|
|
19
19
|
marginX = 30,
|
|
20
|
-
plotWidth,
|
|
21
|
-
plotHeight,
|
|
22
20
|
invertAxis,
|
|
23
21
|
data,
|
|
24
22
|
groupKey
|
|
25
23
|
} = this.asProps;
|
|
24
|
+
const {
|
|
25
|
+
plotWidth,
|
|
26
|
+
plotHeight
|
|
27
|
+
} = this;
|
|
26
28
|
if (xScale) {
|
|
27
29
|
return xScale;
|
|
28
30
|
}
|
|
@@ -40,11 +42,13 @@ class HistogramChartComponent extends AbstractChart {
|
|
|
40
42
|
yScale,
|
|
41
43
|
marginY = 30,
|
|
42
44
|
marginX = 30,
|
|
43
|
-
plotHeight,
|
|
44
|
-
plotWidth,
|
|
45
45
|
invertAxis,
|
|
46
46
|
data
|
|
47
47
|
} = this.asProps;
|
|
48
|
+
const {
|
|
49
|
+
plotWidth,
|
|
50
|
+
plotHeight
|
|
51
|
+
} = this;
|
|
48
52
|
let max;
|
|
49
53
|
if (this.isStack) {
|
|
50
54
|
max = data.reduce((max2, item) => {
|
|
@@ -14,10 +14,12 @@ class LineChartComponent extends AbstractChart {
|
|
|
14
14
|
const {
|
|
15
15
|
xScale,
|
|
16
16
|
marginY = 30,
|
|
17
|
-
plotWidth,
|
|
18
17
|
data,
|
|
19
18
|
groupKey
|
|
20
19
|
} = this.asProps;
|
|
20
|
+
const {
|
|
21
|
+
plotWidth
|
|
22
|
+
} = this;
|
|
21
23
|
if (xScale) {
|
|
22
24
|
return xScale;
|
|
23
25
|
}
|
|
@@ -32,9 +34,11 @@ class LineChartComponent extends AbstractChart {
|
|
|
32
34
|
get yScale() {
|
|
33
35
|
const {
|
|
34
36
|
yScale,
|
|
35
|
-
marginX = 30
|
|
36
|
-
plotHeight
|
|
37
|
+
marginX = 30
|
|
37
38
|
} = this.asProps;
|
|
39
|
+
const {
|
|
40
|
+
plotHeight
|
|
41
|
+
} = this;
|
|
38
42
|
if (yScale) {
|
|
39
43
|
return yScale;
|
|
40
44
|
}
|
|
@@ -22,11 +22,13 @@ class ScatterPlotChartComponent extends AbstractChart {
|
|
|
22
22
|
const {
|
|
23
23
|
xScale,
|
|
24
24
|
marginY = 30,
|
|
25
|
-
plotWidth,
|
|
26
25
|
data,
|
|
27
26
|
groupKey,
|
|
28
27
|
valueKey
|
|
29
28
|
} = this.asProps;
|
|
29
|
+
const {
|
|
30
|
+
plotWidth
|
|
31
|
+
} = this;
|
|
30
32
|
if (xScale) {
|
|
31
33
|
return xScale;
|
|
32
34
|
}
|
|
@@ -43,9 +45,11 @@ class ScatterPlotChartComponent extends AbstractChart {
|
|
|
43
45
|
const {
|
|
44
46
|
yScale,
|
|
45
47
|
marginX = 30,
|
|
46
|
-
plotHeight,
|
|
47
48
|
valueKey
|
|
48
49
|
} = this.asProps;
|
|
50
|
+
const {
|
|
51
|
+
plotHeight
|
|
52
|
+
} = this;
|
|
49
53
|
if (yScale) {
|
|
50
54
|
return yScale;
|
|
51
55
|
}
|
|
@@ -13,14 +13,14 @@ const style = (
|
|
|
13
13
|
/*__reshadow_css_start__*/
|
|
14
14
|
(sstyled.insert(
|
|
15
15
|
/*__inner_css_start__*/
|
|
16
|
-
".
|
|
16
|
+
".___SLegendFlex_e76xg_gg_._direction_row_e76xg_gg_{align-items:flex-start;align-content:flex-start;flex-wrap:wrap;gap:8px 16px}.___SLegendFlex_e76xg_gg_._direction_column_e76xg_gg_{align-items:flex-start;flex-wrap:wrap;gap:8px}",
|
|
17
17
|
/*__inner_css_end__*/
|
|
18
|
-
"
|
|
18
|
+
"e76xg_gg_"
|
|
19
19
|
), /*__reshadow_css_end__*/
|
|
20
20
|
{
|
|
21
|
-
"__SLegendFlex": "
|
|
22
|
-
"_direction_row": "
|
|
23
|
-
"_direction_column": "
|
|
21
|
+
"__SLegendFlex": "___SLegendFlex_e76xg_gg_",
|
|
22
|
+
"_direction_row": "_direction_row_e76xg_gg_",
|
|
23
|
+
"_direction_column": "_direction_column_e76xg_gg_"
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
26
|
class LegendFlexRoot extends BaseLegend {
|