@elliemae/ds-dataviz 3.9.0 → 3.10.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/graphs/Chart/Chart.js +1 -4
- package/dist/cjs/graphs/Chart/Chart.js.map +2 -2
- package/dist/cjs/graphs/Chart/ChartContext.js +1 -4
- package/dist/cjs/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useChart.js +26 -22
- package/dist/cjs/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useGetters.js +90 -0
- package/dist/cjs/graphs/Chart/config/useGetters.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js +1 -1
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js.map +1 -1
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +42 -13
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useScales.js +67 -41
- package/dist/cjs/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/cjs/graphs/Chart/helpers/colorPallet.js +1 -1
- package/dist/cjs/graphs/Chart/helpers/colorPallet.js.map +1 -1
- package/dist/cjs/graphs/Chart/helpers/index.js +4 -4
- package/dist/cjs/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js +124 -0
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js +42 -11
- package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/Axes.js +13 -2
- package/dist/cjs/graphs/Chart/parts/Axis/Axes.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +72 -23
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +36 -16
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js +10 -8
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +60 -60
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ClipPaths.js +85 -0
- package/dist/cjs/graphs/Chart/parts/ClipPaths.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/BottomLabel.js +2 -2
- package/dist/cjs/graphs/Chart/parts/Labels/BottomLabel.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Labels/LeftLabel.js +7 -14
- package/dist/cjs/graphs/Chart/parts/Labels/LeftLabel.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js +4 -4
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js +1 -1
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js +6 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js +2 -77
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +3 -3
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +3 -3
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js +112 -0
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js +4 -7
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js +114 -0
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js +14 -29
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js +84 -0
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +4 -9
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Area.js +1 -3
- package/dist/cjs/graphs/Chart/series/Area.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js +4 -24
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/StackedBar.js +3 -2
- package/dist/cjs/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/cjs/graphs/Chart/styles.js +12 -11
- package/dist/cjs/graphs/Chart/styles.js.map +2 -2
- package/dist/cjs/graphs/constants.js +6 -5
- package/dist/cjs/graphs/constants.js.map +2 -2
- package/dist/esm/graphs/Chart/Chart.js +1 -4
- package/dist/esm/graphs/Chart/Chart.js.map +2 -2
- package/dist/esm/graphs/Chart/ChartContext.js +1 -4
- package/dist/esm/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useChart.js +27 -23
- package/dist/esm/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useGetters.js +64 -0
- package/dist/esm/graphs/Chart/config/useGetters.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useInternalMargins.js +1 -1
- package/dist/esm/graphs/Chart/config/useInternalMargins.js.map +1 -1
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +42 -13
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useScales.js +67 -41
- package/dist/esm/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/colorPallet.js +1 -1
- package/dist/esm/graphs/Chart/helpers/colorPallet.js.map +1 -1
- package/dist/esm/graphs/Chart/helpers/index.js +4 -4
- package/dist/esm/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js +98 -0
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js +42 -11
- package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/Axes.js +13 -2
- package/dist/esm/graphs/Chart/parts/Axis/Axes.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +72 -23
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +36 -16
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js +10 -8
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +60 -60
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ClipPaths.js +59 -0
- package/dist/esm/graphs/Chart/parts/ClipPaths.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/BottomLabel.js +2 -2
- package/dist/esm/graphs/Chart/parts/Labels/BottomLabel.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Labels/LeftLabel.js +8 -15
- package/dist/esm/graphs/Chart/parts/Labels/LeftLabel.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js +5 -5
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js +1 -1
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js +6 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js +3 -78
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +3 -3
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +3 -3
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js +86 -0
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js +4 -7
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js +88 -0
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js +14 -29
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js +58 -0
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js +5 -10
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Area.js +1 -3
- package/dist/esm/graphs/Chart/series/Area.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalBars.js +4 -24
- package/dist/esm/graphs/Chart/series/HorizontalBars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/StackedBar.js +3 -2
- package/dist/esm/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/esm/graphs/Chart/styles.js +13 -12
- package/dist/esm/graphs/Chart/styles.js.map +2 -2
- package/dist/esm/graphs/constants.js +7 -6
- package/dist/esm/graphs/constants.js.map +2 -2
- package/package.json +8 -8
- package/dist/cjs/graphs/Chart/Pie.js +0 -49
- package/dist/cjs/graphs/Chart/Pie.js.map +0 -7
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js +0 -83
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js.map +0 -7
- package/dist/esm/graphs/Chart/Pie.js +0 -23
- package/dist/esm/graphs/Chart/Pie.js.map +0 -7
- package/dist/esm/graphs/Chart/parts/ActivePoint.js +0 -57
- package/dist/esm/graphs/Chart/parts/ActivePoint.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Labels/BottomLabel.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledAxisLabel } from '../../styles';\n\nexport const BottomLabel = () => {\n const {\n internalMargin,\n setBottomLabel,\n innerHeight,\n innerWidth,\n axisBottomHeight,\n props: { xAxis },\n } = useContext(ChartContext);\n\n return (\n <g\n ref={setBottomLabel}\n transform={`translate(${innerWidth / 2 + internalMargin.left},${\n innerHeight + axisBottomHeight + internalMargin.top + 20\n })`}\n >\n <StyledAxisLabel className=\"axis-label\" textAnchor=\"middle\">\n {xAxis?.label}\n </StyledAxisLabel>\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAEzB,MAAM,cAAc,MAAM;AAC/B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM;AAAA,EACjB,IAAI,WAAW,YAAY;AAE3B,SACE,oBAAC;AAAA,IACC,KAAK;AAAA,IACL,WAAW,aAAa,aAAa,IAAI,eAAe,QACtD,cAAc,mBAAmB,eAAe,MAAM;AAAA,IAGxD,8BAAC;AAAA,MAAgB,WAAU;AAAA,MAAa,YAAW;AAAA,MAChD,iBAAO;AAAA,KACV;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext } from "react";
|
|
4
4
|
import { ChartContext } from "../../ChartContext";
|
|
5
5
|
import { StyledAxisLabel } from "../../styles";
|
|
@@ -11,22 +11,15 @@ const LeftLabel = () => {
|
|
|
11
11
|
leftLegendWidth,
|
|
12
12
|
props: { yAxis }
|
|
13
13
|
} = useContext(ChartContext);
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsx("g", {
|
|
15
15
|
ref: setLeftLabel,
|
|
16
16
|
transform: `translate(${leftLegendWidth > 0 ? leftLegendWidth + 8 : 0},${innerHeight / 2 + internalMargin.top}) rotate(-90)`,
|
|
17
|
-
children:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/* @__PURE__ */ jsx(StyledAxisLabel, {
|
|
24
|
-
className: "axis-label",
|
|
25
|
-
textAnchor: "middle",
|
|
26
|
-
dy: 15,
|
|
27
|
-
children: yAxis?.label
|
|
28
|
-
})
|
|
29
|
-
]
|
|
17
|
+
children: /* @__PURE__ */ jsx(StyledAxisLabel, {
|
|
18
|
+
className: "axis-label",
|
|
19
|
+
textAnchor: "middle",
|
|
20
|
+
dy: 15,
|
|
21
|
+
children: yAxis?.label
|
|
22
|
+
})
|
|
30
23
|
});
|
|
31
24
|
};
|
|
32
25
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Labels/LeftLabel.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledAxisLabel } from '../../styles';\n\nexport const LeftLabel = () => {\n const {\n innerHeight,\n internalMargin,\n setLeftLabel,\n leftLegendWidth,\n props: { yAxis },\n } = useContext(ChartContext);\n\n return (\n <g\n ref={setLeftLabel}\n transform={`translate(${leftLegendWidth > 0 ? leftLegendWidth + 8 : 0},${\n innerHeight / 2 + internalMargin.top\n }) rotate(-90)`}\n >\n <rect height=\"30\" width=\"1\" fill=\"transparent\"
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAA2B;AAC3C,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAEzB,MAAM,YAAY,MAAM;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM;AAAA,EACjB,IAAI,WAAW,YAAY;AAE3B,SACE,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledAxisLabel } from '../../styles';\n\nexport const LeftLabel = () => {\n const {\n innerHeight,\n internalMargin,\n setLeftLabel,\n leftLegendWidth,\n props: { yAxis },\n } = useContext(ChartContext);\n\n return (\n <g\n ref={setLeftLabel}\n transform={`translate(${leftLegendWidth > 0 ? leftLegendWidth + 8 : 0},${\n innerHeight / 2 + internalMargin.top\n }) rotate(-90)`}\n >\n {/* <rect height=\"30\" width=\"1\" fill=\"transparent\" /> */}\n <StyledAxisLabel className=\"axis-label\" textAnchor=\"middle\" dy={15}>\n {yAxis?.label}\n </StyledAxisLabel>\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAA2B;AAC3C,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAEzB,MAAM,YAAY,MAAM;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM;AAAA,EACjB,IAAI,WAAW,YAAY;AAE3B,SACE,oBAAC;AAAA,IACC,KAAK;AAAA,IACL,WAAW,aAAa,kBAAkB,IAAI,kBAAkB,IAAI,KAClE,cAAc,IAAI,eAAe;AAAA,IAInC,8BAAC;AAAA,MAAgB,WAAU;AAAA,MAAa,YAAW;AAAA,MAAS,IAAI;AAAA,MAC7D,iBAAO;AAAA,KACV;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useContext, useMemo, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { select } from "d3";
|
|
5
5
|
import { ChartContext } from "../../ChartContext";
|
|
6
6
|
import { LegendItem } from "./LegendItem";
|
|
7
7
|
const BottomLegend = () => {
|
|
@@ -11,7 +11,7 @@ const BottomLegend = () => {
|
|
|
11
11
|
const [xTransform, setXTransform] = useState(innerWidth / 2);
|
|
12
12
|
useLayoutEffect(() => {
|
|
13
13
|
if (ref.current && firstRender.current) {
|
|
14
|
-
const cells = selectAll(".cell");
|
|
14
|
+
const cells = select(ref.current).selectAll(".cell");
|
|
15
15
|
const padding = 30;
|
|
16
16
|
let offset = 0;
|
|
17
17
|
let verticalOffset = 0;
|
|
@@ -37,10 +37,10 @@ const BottomLegend = () => {
|
|
|
37
37
|
const margin = useMemo(() => {
|
|
38
38
|
let counter = 0;
|
|
39
39
|
if (bottomLabelHeight > 0) {
|
|
40
|
-
counter += bottomLabelHeight +
|
|
40
|
+
counter += bottomLabelHeight + 20;
|
|
41
41
|
}
|
|
42
42
|
if (axisBottomHeight > 0) {
|
|
43
|
-
counter += axisBottomHeight;
|
|
43
|
+
counter += axisBottomHeight + 15;
|
|
44
44
|
}
|
|
45
45
|
return counter;
|
|
46
46
|
}, [bottomLabelHeight, axisBottomHeight]);
|
|
@@ -53,7 +53,7 @@ const BottomLegend = () => {
|
|
|
53
53
|
className: "bottom-legend",
|
|
54
54
|
children: [
|
|
55
55
|
/* @__PURE__ */ jsx("rect", {
|
|
56
|
-
height:
|
|
56
|
+
height: 60,
|
|
57
57
|
width: 1,
|
|
58
58
|
fill: "transparent"
|
|
59
59
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Legend/BottomLegend.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useLayoutEffect, useRef, useState } from 'react';\nimport { selectAll, select } from 'd3';\nimport { ChartContext } from '../../ChartContext';\nimport { LegendItem } from './LegendItem';\n\nexport const BottomLegend = () => {\n const { colorScale, axisBottomHeight, innerWidth, innerHeight, bottomLabelHeight, internalMargin, setBottomLegend } =\n useContext(ChartContext);\n\n const ref = useRef(null);\n const firstRender = useRef(true);\n\n const [xTransform, setXTransform] = useState(innerWidth / 2);\n useLayoutEffect(() => {\n if (ref.current && firstRender.current) {\n const cells = selectAll('.cell');\n const padding = 30;\n let offset = 0;\n let verticalOffset = 0;\n\n cells.each((d, i) => {\n if (cells._groups[0][i - 1]) {\n const lastCell = select(cells._groups[0][i - 1]);\n const d3sel = select(cells._groups[0][i]);\n\n const { width } = lastCell.node().getBBox();\n if (offset + width + padding > innerWidth - innerWidth / 3) {\n offset = 0;\n verticalOffset += 20;\n } else {\n offset += width + padding;\n }\n\n d3sel.attr('transform', `translate(${offset}, ${verticalOffset})`);\n }\n });\n const bounds = ref.current.getBoundingClientRect();\n setXTransform((prev) => prev - bounds.width / 2);\n firstRender.current = false;\n }\n }, [innerWidth]);\n\n const margin = useMemo(() => {\n let counter = 0;\n if (bottomLabelHeight > 0) {\n counter += bottomLabelHeight +
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,SAAS,iBAAiB,QAAQ,gBAAgB;AAC9E,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useLayoutEffect, useRef, useState } from 'react';\nimport { selectAll, select } from 'd3';\nimport { ChartContext } from '../../ChartContext';\nimport { LegendItem } from './LegendItem';\n\nexport const BottomLegend = () => {\n const { colorScale, axisBottomHeight, innerWidth, innerHeight, bottomLabelHeight, internalMargin, setBottomLegend } =\n useContext(ChartContext);\n\n const ref = useRef<SVGGElement>(null);\n const firstRender = useRef(true);\n\n const [xTransform, setXTransform] = useState(innerWidth / 2);\n useLayoutEffect(() => {\n if (ref.current && firstRender.current) {\n const cells = select(ref.current).selectAll('.cell');\n const padding = 30;\n let offset = 0;\n let verticalOffset = 0;\n\n cells.each((d, i) => {\n if (cells._groups[0][i - 1]) {\n const lastCell = select(cells._groups[0][i - 1]);\n const d3sel = select(cells._groups[0][i]);\n\n const { width } = lastCell.node().getBBox();\n if (offset + width + padding > innerWidth - innerWidth / 3) {\n offset = 0;\n verticalOffset += 20;\n } else {\n offset += width + padding;\n }\n\n d3sel.attr('transform', `translate(${offset}, ${verticalOffset})`);\n }\n });\n const bounds = ref.current.getBoundingClientRect();\n setXTransform((prev) => prev - bounds.width / 2);\n firstRender.current = false;\n }\n }, [innerWidth]);\n\n const margin = useMemo(() => {\n let counter = 0;\n if (bottomLabelHeight > 0) {\n counter += bottomLabelHeight + 20;\n }\n if (axisBottomHeight > 0) {\n counter += axisBottomHeight + 15;\n }\n return counter;\n }, [bottomLabelHeight, axisBottomHeight]);\n\n return useMemo(\n () => (\n <g ref={setBottomLegend}>\n <g\n ref={ref}\n transform={`translate(${xTransform + internalMargin.left}, ${innerHeight + internalMargin.top + margin})`}\n className=\"bottom-legend\"\n >\n <rect height={60} width={1} fill=\"transparent\" />\n {colorScale.domain().map((domainValue, i) => (\n <LegendItem domainValue={domainValue} key={domainValue} />\n ))}\n </g>\n </g>\n ),\n\n [colorScale, innerHeight, internalMargin.left, internalMargin.top, margin, setBottomLegend, xTransform],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,SAAS,iBAAiB,QAAQ,gBAAgB;AAC9E,SAAoB,cAAc;AAClC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAEpB,MAAM,eAAe,MAAM;AAChC,QAAM,EAAE,YAAY,kBAAkB,YAAY,aAAa,mBAAmB,gBAAgB,gBAAgB,IAChH,WAAW,YAAY;AAEzB,QAAM,MAAM,OAAoB,IAAI;AACpC,QAAM,cAAc,OAAO,IAAI;AAE/B,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,aAAa,CAAC;AAC3D,kBAAgB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Ac;AAAA,UAC9C,WAAW,OAAO,EAAE,IAAI,CAAC,aAAa,MACrC,oBAAC;AAAA,YAAW;AAAA,aAA+B,WAAa,CACzD;AAAA;AAAA,OACH;AAAA,KACF;AAAA,IAGF,CAAC,YAAY,aAAa,eAAe,MAAM,eAAe,KAAK,QAAQ,iBAAiB,UAAU;AAAA,EACxG;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -59,6 +59,7 @@ const LegendItem = ({ domainValue }) => {
|
|
|
59
59
|
() => /* @__PURE__ */ jsxs("g", {
|
|
60
60
|
onClick: handleOnClick,
|
|
61
61
|
className: "cell",
|
|
62
|
+
style: hiddenSeries.includes(domainValue) ? { opacity: 0.2 } : null,
|
|
62
63
|
children: [
|
|
63
64
|
/* @__PURE__ */ jsx(LegendIcon, {
|
|
64
65
|
fill: colorScale(domainValue)
|
|
@@ -70,7 +71,6 @@ const LegendItem = ({ domainValue }) => {
|
|
|
70
71
|
/* @__PURE__ */ jsx("text", {
|
|
71
72
|
x: 24,
|
|
72
73
|
dy: ".32em",
|
|
73
|
-
textDecoration: hiddenSeries.includes(domainValue) ? "line-through" : "",
|
|
74
74
|
fontWeight: "600",
|
|
75
75
|
children: domainValue
|
|
76
76
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Legend/LegendItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useCallback } from 'react';\nimport { LINE } from '../../../constants';\nimport { ChartContext } from '../../ChartContext';\n\nconst LegendItemLine = (props) => <line x1={-18} x2={18} y1={0} y2={0} {...props} strokeWidth={2} />;\nconst LegendItemCircle = (props) => <circle r={6} {...props} />;\nconst LegendItemSquare = (props) => <rect x={-6} y={-6} width={12} height={12} {...props} />;\nconst LegendItemDiamond = (props) => (\n <g transform=\"rotate(45)\">\n <rect x={-6} y={-6} width={12} height={12} {...props} />\n </g>\n);\n\nconst LegendItemsMap = {\n [LINE.POINT_STYLE.CIRCLE]: LegendItemCircle,\n [LINE.POINT_STYLE.SQUARE]: LegendItemSquare,\n [LINE.POINT_STYLE.DIAMOND]: LegendItemDiamond,\n};\n\nexport const LegendItem = ({ domainValue }) => {\n const {\n colorScale,\n setHiddenSeries,\n hiddenSeries,\n props: { series, types },\n } = useContext(ChartContext);\n\n const serieData = series.find((serie) => serie.name === domainValue);\n const LegendIcon =\n LegendItemsMap[serieData.pointStyle] ??\n (serieData.type === 'line' || types === 'scatter' ? LegendItemCircle : LegendItemSquare);\n\n const handleOnClick = useCallback(() => {\n setHiddenSeries((prev) => {\n if (prev.includes(domainValue)) return prev.filter((serie) => serie !== domainValue);\n if (prev.length + 1 !== series.length) return [...prev, domainValue];\n return prev;\n });\n }, [domainValue, series.length, setHiddenSeries]);\n\n return useMemo(\n () => (\n <g
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,SAAS,mBAAmB;AACxD,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAE7B,MAAM,iBAAiB,CAAC,UAAU,oBAAC;AAAA,EAAK,IAAI;AAAA,EAAK,IAAI;AAAA,EAAI,IAAI;AAAA,EAAG,IAAI;AAAA,EAAI,GAAG;AAAA,EAAO,aAAa;AAAA,CAAG;AAClG,MAAM,mBAAmB,CAAC,UAAU,oBAAC;AAAA,EAAO,GAAG;AAAA,EAAI,GAAG;AAAA,CAAO;AAC7D,MAAM,mBAAmB,CAAC,UAAU,oBAAC;AAAA,EAAK,GAAG;AAAA,EAAI,GAAG;AAAA,EAAI,OAAO;AAAA,EAAI,QAAQ;AAAA,EAAK,GAAG;AAAA,CAAO;AAC1F,MAAM,oBAAoB,CAAC,UACzB,oBAAC;AAAA,EAAE,WAAU;AAAA,EACX,8BAAC;AAAA,IAAK,GAAG;AAAA,IAAI,GAAG;AAAA,IAAI,OAAO;AAAA,IAAI,QAAQ;AAAA,IAAK,GAAG;AAAA,GAAO;AAAA,CACxD;AAGF,MAAM,iBAAiB;AAAA,EACrB,CAAC,KAAK,YAAY,SAAS;AAAA,EAC3B,CAAC,KAAK,YAAY,SAAS;AAAA,EAC3B,CAAC,KAAK,YAAY,UAAU;AAC9B;AAEO,MAAM,aAAa,CAAC,EAAE,YAAY,MAAM;AAC7C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,QAAQ,MAAM;AAAA,EACzB,IAAI,WAAW,YAAY;AAE3B,QAAM,YAAY,OAAO,KAAK,CAAC,UAAU,MAAM,SAAS,WAAW;AACnE,QAAM,aACJ,eAAe,UAAU,gBACxB,UAAU,SAAS,UAAU,UAAU,YAAY,mBAAmB;AAEzE,QAAM,gBAAgB,YAAY,MAAM;AACtC,oBAAgB,CAAC,SAAS;AACxB,UAAI,KAAK,SAAS,WAAW;AAAG,eAAO,KAAK,OAAO,CAAC,UAAU,UAAU,WAAW;AACnF,UAAI,KAAK,SAAS,MAAM,OAAO;AAAQ,eAAO,CAAC,GAAG,MAAM,WAAW;AACnE,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,aAAa,OAAO,QAAQ,eAAe,CAAC;AAEhD,SAAO;AAAA,IACL,MACE,qBAAC;AAAA,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useCallback } from 'react';\nimport { LINE } from '../../../constants';\nimport { ChartContext } from '../../ChartContext';\n\nconst LegendItemLine = (props) => <line x1={-18} x2={18} y1={0} y2={0} {...props} strokeWidth={2} />;\nconst LegendItemCircle = (props) => <circle r={6} {...props} />;\nconst LegendItemSquare = (props) => <rect x={-6} y={-6} width={12} height={12} {...props} />;\nconst LegendItemDiamond = (props) => (\n <g transform=\"rotate(45)\">\n <rect x={-6} y={-6} width={12} height={12} {...props} />\n </g>\n);\n\nconst LegendItemsMap = {\n [LINE.POINT_STYLE.CIRCLE]: LegendItemCircle,\n [LINE.POINT_STYLE.SQUARE]: LegendItemSquare,\n [LINE.POINT_STYLE.DIAMOND]: LegendItemDiamond,\n};\n\nexport const LegendItem = ({ domainValue }) => {\n const {\n colorScale,\n setHiddenSeries,\n hiddenSeries,\n props: { series, types },\n } = useContext(ChartContext);\n\n const serieData = series.find((serie) => serie.name === domainValue);\n const LegendIcon =\n LegendItemsMap[serieData.pointStyle] ??\n (serieData.type === 'line' || types === 'scatter' ? LegendItemCircle : LegendItemSquare);\n\n const handleOnClick = useCallback(() => {\n setHiddenSeries((prev) => {\n if (prev.includes(domainValue)) return prev.filter((serie) => serie !== domainValue);\n if (prev.length + 1 !== series.length) return [...prev, domainValue];\n return prev;\n });\n }, [domainValue, series.length, setHiddenSeries]);\n\n return useMemo(\n () => (\n <g\n onClick={handleOnClick}\n key={domainValue}\n className=\"cell\"\n style={hiddenSeries.includes(domainValue) ? { opacity: 0.2 } : null}\n >\n <LegendIcon fill={colorScale(domainValue)} />\n {serieData.type === 'line' ? (\n <LegendItemLine\n stroke={colorScale(domainValue)}\n strokeDasharray={LINE.DASH_STYLE_VALUES[serieData.dashStyle]}\n />\n ) : null}\n <text x={24} dy=\".32em\" fontWeight=\"600\">\n {domainValue}\n </text>\n </g>\n ),\n\n [LegendIcon, colorScale, domainValue, handleOnClick, hiddenSeries, serieData.dashStyle, serieData.type],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,SAAS,mBAAmB;AACxD,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAE7B,MAAM,iBAAiB,CAAC,UAAU,oBAAC;AAAA,EAAK,IAAI;AAAA,EAAK,IAAI;AAAA,EAAI,IAAI;AAAA,EAAG,IAAI;AAAA,EAAI,GAAG;AAAA,EAAO,aAAa;AAAA,CAAG;AAClG,MAAM,mBAAmB,CAAC,UAAU,oBAAC;AAAA,EAAO,GAAG;AAAA,EAAI,GAA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BAAC;AAAA,UAAW,MAAM,WAAW,WAAW;AAAA,SAAG;AAAA,QAC1C,UAAU,SAAS,SAClB,oBAAC;AAAA,UACC,QAAQ,WAAW,WAAW;AAAA,UAC9B,iBAAiB,KAAK,kBAAkB,UAAU;AAAA,SACpD,IACE;AAAA,QACJ,oBAAC;AAAA,UAAK,GAAG;AAAA,UAAI,IAAG;AAAA,UAAQ,YAAW;AAAA,UAChC;AAAA,SACH;AAAA;AAAA,OAbK,WAcP;AAAA,IAGF,CAAC,YAAY,YAAY,aAAa,eAAe,cAAc,UAAU,WAAW,UAAU,IAAI;AAAA,EACxG;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,13 +11,17 @@ const ScrapperLine = ({ yPosition, datum }) => {
|
|
|
11
11
|
setScrapperPosY,
|
|
12
12
|
innerWidth,
|
|
13
13
|
yScale,
|
|
14
|
+
setActivePoint,
|
|
15
|
+
isGrabbed,
|
|
14
16
|
props: { TooltipRenderer, scrapper }
|
|
15
17
|
} = useContext(ChartContext);
|
|
16
18
|
const theme = useContext(ThemeContext);
|
|
17
19
|
const [referenceElement, setReferenceElement] = useState();
|
|
18
20
|
const handleOnMouseEnter = useCallback(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
if (!isGrabbed)
|
|
22
|
+
setScrapperPosY(yPosition);
|
|
23
|
+
setActivePoint(null);
|
|
24
|
+
}, [isGrabbed, setScrapperPosY, setActivePoint, yPosition]);
|
|
21
25
|
const strokeDetectorWidth = yScale.bandwidth ? yScale.bandwidth() : "4px";
|
|
22
26
|
return /* @__PURE__ */ jsxs("g", {
|
|
23
27
|
children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/ScrapperLine.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useState } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles';\n\nexport const ScrapperLine = ({ yPosition, datum }) => {\n const {\n scrapperPosY,\n setScrapperPosY,\n innerWidth,\n yScale,\n props: { TooltipRenderer, scrapper },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const [referenceElement, setReferenceElement] = useState<React.SVGProps<SVGLineElement> | null>();\n\n const handleOnMouseEnter = useCallback(() => {\n setScrapperPosY(yPosition);\n }, [setScrapperPosY, yPosition]);\n\n const strokeDetectorWidth = yScale.bandwidth ? yScale.bandwidth() : '4px';\n\n return (\n <g>\n {scrapperPosY === yPosition ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <DSPopperJS\n withoutAnimation\n withoutArrow\n customOffset={[0, 5]}\n referenceElement={referenceElement}\n showPopover\n zIndex={theme.zIndex.tooltip}\n // placementOrderPreference=\"\"\n startPlacementPreference={scrapper.tooltipPreference}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={datum} />\n </StyledTooltipContainer>\n </DSPopperJS>\n </foreignObject>\n ) : null}\n <line\n ref={setReferenceElement}\n x1={innerWidth}\n strokeWidth=\"2px\"\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n <line\n // ref={setReferenceElement}\n x1={0}\n strokeWidth=\"2px\"\n stroke=\"grey\"\n strokeDasharray={(4, 4)}\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n ) : null}\n <line\n onMouseEnter={handleOnMouseEnter}\n x1={0}\n strokeWidth={strokeDetectorWidth}\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,aAAa,gBAAgB;AACzD,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B,8BAA8B;AAE7D,MAAM,eAAe,CAAC,EAAE,WAAW,MAAM,MAAM;AACpD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,iBAAiB,SAAS;AAAA,EACrC,IAAI,WAAW,YAAY;AAC3B,QAAM,QAAQ,WAAW,YAAY;AACrC,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAgD;AAEhG,QAAM,qBAAqB,YAAY,MAAM;AAC3C,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useState } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles';\n\nexport const ScrapperLine = ({ yPosition, datum }) => {\n const {\n scrapperPosY,\n setScrapperPosY,\n innerWidth,\n yScale,\n setActivePoint,\n isGrabbed,\n props: { TooltipRenderer, scrapper },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const [referenceElement, setReferenceElement] = useState<React.SVGProps<SVGLineElement> | null>();\n\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosY(yPosition);\n setActivePoint(null);\n }, [isGrabbed, setScrapperPosY, setActivePoint, yPosition]);\n\n const strokeDetectorWidth = yScale.bandwidth ? yScale.bandwidth() : '4px';\n\n return (\n <g>\n {scrapperPosY === yPosition ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <DSPopperJS\n withoutAnimation\n withoutArrow\n customOffset={[0, 5]}\n referenceElement={referenceElement}\n showPopover\n zIndex={theme.zIndex.tooltip}\n // placementOrderPreference=\"\"\n startPlacementPreference={scrapper.tooltipPreference}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={datum} />\n </StyledTooltipContainer>\n </DSPopperJS>\n </foreignObject>\n ) : null}\n <line\n ref={setReferenceElement}\n x1={innerWidth}\n strokeWidth=\"2px\"\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n <line\n // ref={setReferenceElement}\n x1={0}\n strokeWidth=\"2px\"\n stroke=\"grey\"\n strokeDasharray={(4, 4)}\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n ) : null}\n <line\n onMouseEnter={handleOnMouseEnter}\n x1={0}\n strokeWidth={strokeDetectorWidth}\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,aAAa,gBAAgB;AACzD,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B,8BAA8B;AAE7D,MAAM,eAAe,CAAC,EAAE,WAAW,MAAM,MAAM;AACpD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,iBAAiB,SAAS;AAAA,EACrC,IAAI,WAAW,YAAY;AAC3B,QAAM,QAAQ,WAAW,YAAY;AACrC,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAgD;AAEhG,QAAM,qBAAqB,YAAY,MAAM;AAC3C,QAAI,CAAC;AAAW,sBAAgB,SAAS;AACzC,mBAAe,IAAI;AAAA,EACrB,GAAG,CAAC,WAAW,iBAAiB,gBAAgB,SAAS,CAAC;AAE1D,QAAM,sBAAsB,OAAO,YAAY,OAAO,UAAU,IAAI;AAEpE,SACE,qBAAC;AAAA,IACE;AAAA,uBAAiB,YAChB,qBAAC;AAAA,QACE;AAAA,4BACC,oBAAC;AAAA,YACC,+BAAC;AAAA,cACC,kBAAgB;AAAA,cAChB,cAAY;AAAA,cACZ,cAAc,CAAC,GAAG,CAAC;AAAA,cACnB;AAAA,cACA,aAAW;AAAA,cACX,QAAQ,MAAM,OAAO;AAAA,cAErB,0BAA0B,SAAS;AAAA,cAEnC;AAAA,oCAAC,+BAA4B;AAAA,gBAC7B,oBAAC;AAAA,kBACC,8BAAC;AAAA,oBAAgB,MAAM;AAAA,mBAAO;AAAA,iBAChC;AAAA;AAAA,aACF;AAAA,WACF,IACE;AAAA,UACJ,oBAAC;AAAA,YACC,KAAK;AAAA,YACL,IAAI;AAAA,YACJ,aAAY;AAAA,YACZ,QAAO;AAAA,YACP,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,IAAI;AAAA,WACN;AAAA,UACA,oBAAC;AAAA,YAEC,IAAI;AAAA,YACJ,aAAY;AAAA,YACZ,QAAO;AAAA,YACP,kBAAkB,GAAG;AAAA,YACrB,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,IAAI;AAAA,WACN;AAAA;AAAA,OACF,IACE;AAAA,MACJ,oBAAC;AAAA,QACC,cAAc;AAAA,QACd,IAAI;AAAA,QACJ,aAAa;AAAA,QACb,QAAO;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,OACN;AAAA;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,85 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { ChartContext } from "../../ChartContext";
|
|
3
|
+
import { useMemo } from "react";
|
|
5
4
|
import { VerticalScrapperLine } from "./VerticalScrapperLine";
|
|
5
|
+
import { useUniqueData } from "../../helpers/useUniqueData";
|
|
6
6
|
const VerticalScrapper = () => {
|
|
7
|
-
const
|
|
8
|
-
xScale,
|
|
9
|
-
getBandwidth,
|
|
10
|
-
xScrollbarPosition,
|
|
11
|
-
containerRatio,
|
|
12
|
-
getXValue,
|
|
13
|
-
getYValue,
|
|
14
|
-
currentData: data,
|
|
15
|
-
props: { xAxis }
|
|
16
|
-
} = useContext(ChartContext);
|
|
17
|
-
function compare(a, b) {
|
|
18
|
-
if (a.xPosition < b.xPosition) {
|
|
19
|
-
return -1;
|
|
20
|
-
}
|
|
21
|
-
if (a.xPosition > b.xPosition) {
|
|
22
|
-
return 1;
|
|
23
|
-
}
|
|
24
|
-
return 0;
|
|
25
|
-
}
|
|
26
|
-
const isBandAxis = !!xScale.bandwidth;
|
|
27
|
-
const uniqueData = useMemo(() => {
|
|
28
|
-
let valueToPositionPerSeries;
|
|
29
|
-
if (isBandAxis) {
|
|
30
|
-
valueToPositionPerSeries = data.map(
|
|
31
|
-
(serie) => serie.data.map((datum) => {
|
|
32
|
-
const x = getXValue(datum);
|
|
33
|
-
const y = getYValue(datum);
|
|
34
|
-
return {
|
|
35
|
-
position: xScale(x),
|
|
36
|
-
name: serie.name,
|
|
37
|
-
xValue: x,
|
|
38
|
-
yValue: y
|
|
39
|
-
};
|
|
40
|
-
})
|
|
41
|
-
).flat(1);
|
|
42
|
-
} else {
|
|
43
|
-
valueToPositionPerSeries = data.map(
|
|
44
|
-
(serie) => serie.data.filter((datum) => {
|
|
45
|
-
const xScaleValue = xScale(xAxis.cols ? xAxis.cols[datum.position] : datum.value.x);
|
|
46
|
-
return xScaleValue >= xScrollbarPosition * (containerRatio ?? 1) && xScaleValue < xScrollbarPosition * (containerRatio ?? 1) + innerWidth;
|
|
47
|
-
}).map((datum) => {
|
|
48
|
-
return {
|
|
49
|
-
position: xScale(xAxis.cols ? xAxis.cols[datum.position] : datum.value.x),
|
|
50
|
-
name: serie.name,
|
|
51
|
-
xValue: xAxis.cols ? xAxis.cols[datum.position] : datum.value.x,
|
|
52
|
-
yValue: typeof datum.value === "number" ? datum.value : datum.value.y
|
|
53
|
-
};
|
|
54
|
-
})
|
|
55
|
-
).flat(1);
|
|
56
|
-
}
|
|
57
|
-
const postionUniqueData = {};
|
|
58
|
-
valueToPositionPerSeries.forEach((set) => {
|
|
59
|
-
if (postionUniqueData[[set.position]]) {
|
|
60
|
-
postionUniqueData[[set.position]] = [...postionUniqueData[[set.position]], { ...set }];
|
|
61
|
-
} else {
|
|
62
|
-
postionUniqueData[[set.position]] = [{ ...set }];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
const postionUniqueDataArray = Object.keys(postionUniqueData).map((key) => {
|
|
66
|
-
const xPosition = parseFloat(key) + (isBandAxis ? getBandwidth() / 2 : 0);
|
|
67
|
-
const datum = postionUniqueData[key];
|
|
68
|
-
return { xPosition, datum };
|
|
69
|
-
});
|
|
70
|
-
if (isBandAxis) {
|
|
71
|
-
return postionUniqueDataArray;
|
|
72
|
-
}
|
|
73
|
-
return postionUniqueDataArray.sort(compare).map((line, i, array) => {
|
|
74
|
-
const prevPoint = parseFloat(array[i - 1]?.xPosition ?? 0);
|
|
75
|
-
const postPoint = parseFloat(array[i + 1]?.xPosition ?? 0);
|
|
76
|
-
const rectDetector = {
|
|
77
|
-
left: (line.xPosition - prevPoint) / 2,
|
|
78
|
-
right: Math.abs((postPoint === 0 ? 0 : postPoint - line.xPosition) / 2)
|
|
79
|
-
};
|
|
80
|
-
return { ...line, rectDetector };
|
|
81
|
-
});
|
|
82
|
-
}, [isBandAxis, data, getXValue, getYValue, xScale, xAxis.cols, xScrollbarPosition, containerRatio, getBandwidth]);
|
|
7
|
+
const uniqueData = useUniqueData();
|
|
83
8
|
const render = useMemo(
|
|
84
9
|
() => /* @__PURE__ */ jsx("g", {
|
|
85
10
|
className: "vertical-scrapper",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/VerticalScrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { VerticalScrapperLine } from './VerticalScrapperLine';\nimport { useUniqueData } from '../../helpers/useUniqueData';\nexport const VerticalScrapper = () => {\n const uniqueData = useUniqueData();\n const render = useMemo(\n () => (\n <g className=\"vertical-scrapper\">\n {uniqueData.map((line) => (\n <VerticalScrapperLine\n rectDetector={line?.rectDetector}\n xPosition={line.xPosition}\n key={line.xPosition}\n datum={line.datum}\n />\n ))}\n </g>\n ),\n\n [uniqueData],\n );\n\n return render;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,eAAe;AAC/B,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AACvB,MAAM,mBAAmB,MAAM;AACpC,QAAM,aAAa,cAAc;AACjC,QAAM,SAAS;AAAA,IACb,MACE,oBAAC;AAAA,MAAE,WAAU;AAAA,MACV,qBAAW,IAAI,CAAC,SACf,oBAAC;AAAA,QACC,cAAc,MAAM;AAAA,QACpB,WAAW,KAAK;AAAA,QAEhB,OAAO,KAAK;AAAA,SADP,KAAK,SAEZ,CACD;AAAA,KACH;AAAA,IAGF,CAAC,UAAU;AAAA,EACb;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useContext, useCallback, useState, useMemo } from "react";
|
|
3
|
+
import React2, { useContext, useCallback, useState, useMemo } from "react";
|
|
4
4
|
import { DSPopperJS } from "@elliemae/ds-popperjs";
|
|
5
5
|
import { ThemeContext } from "@elliemae/ds-system";
|
|
6
6
|
import { ChartContext } from "../../ChartContext";
|
|
7
7
|
import { StyledMouseOverDetectionBox, StyledTooltipContainer } from "../../styles";
|
|
8
|
-
const VerticalScrapperLine = ({ rectDetector, xPosition, datum }) => {
|
|
8
|
+
const VerticalScrapperLine = React2.memo(({ rectDetector, xPosition, datum }) => {
|
|
9
9
|
const {
|
|
10
10
|
scrapperPosX,
|
|
11
11
|
setScrapperPosX,
|
|
@@ -86,7 +86,7 @@ const VerticalScrapperLine = ({ rectDetector, xPosition, datum }) => {
|
|
|
86
86
|
]
|
|
87
87
|
);
|
|
88
88
|
return render;
|
|
89
|
-
};
|
|
89
|
+
});
|
|
90
90
|
export {
|
|
91
91
|
VerticalScrapperLine
|
|
92
92
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/VerticalScrapperLine.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useState, useMemo } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles';\n\nexport const VerticalScrapperLine = ({ rectDetector, xPosition, datum }) => {\n const {\n scrapperPosX,\n setScrapperPosX,\n isGrabbed,\n xScale,\n setActivePoint,\n innerHeight,\n props: { TooltipRenderer, scrapper },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const [referenceElement, setReferenceElement] = useState<React.SVGProps<SVGLineElement> | null>();\n const isActive = scrapperPosX === xPosition;\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosX(xPosition);\n setActivePoint(null);\n }, [isGrabbed, setActivePoint, setScrapperPosX, xPosition]);\n\n // const strokeDetectorWidth = xScale.bandwidth ? xScale.bandwidth() : lineWidth;\n\n const render = useMemo(\n () => (\n <g>\n {isActive && !isGrabbed ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <DSPopperJS\n withoutAnimation\n withoutArrow\n customOffset={[0, 5]}\n referenceElement={referenceElement}\n showPopover\n zIndex={theme.zIndex.tooltip}\n startPlacementPreference={scrapper.tooltipPreference}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={datum} />\n </StyledTooltipContainer>\n </DSPopperJS>\n </foreignObject>\n ) : null}\n <line\n ref={setReferenceElement}\n x1={xPosition}\n strokeWidth=\"2px\"\n stroke={scrapper.color}\n y1={0}\n x2={xPosition}\n y2={innerHeight}\n strokeDasharray={(4, 4)}\n />\n </g>\n ) : null}\n <rect\n onMouseOver={handleOnMouseEnter}\n // onMouseLeave={() => setScrapperPosY('')}\n // id=\"horizontal-scrapper-zone\"\n x={xScale.bandwidth ? xPosition - xScale.bandwidth() / 2 : xPosition - rectDetector?.left}\n fill=\"transparent\"\n y={0}\n width={xScale.bandwidth?.() ?? rectDetector?.right + rectDetector?.left}\n height={innerHeight}\n />\n </g>\n ),\n [\n isActive,\n isGrabbed,\n TooltipRenderer,\n referenceElement,\n theme.zIndex.tooltip,\n scrapper.tooltipPreference,\n scrapper.color,\n datum,\n xPosition,\n innerHeight,\n handleOnMouseEnter,\n xScale,\n rectDetector,\n ],\n );\n return render;\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useState, useMemo } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles';\n\nexport const VerticalScrapperLine = React.memo(({ rectDetector, xPosition, datum }) => {\n const {\n scrapperPosX,\n setScrapperPosX,\n isGrabbed,\n xScale,\n setActivePoint,\n innerHeight,\n props: { TooltipRenderer, scrapper },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const [referenceElement, setReferenceElement] = useState<React.SVGProps<SVGLineElement> | null>();\n const isActive = scrapperPosX === xPosition;\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosX(xPosition);\n setActivePoint(null);\n }, [isGrabbed, setActivePoint, setScrapperPosX, xPosition]);\n\n // const strokeDetectorWidth = xScale.bandwidth ? xScale.bandwidth() : lineWidth;\n\n const render = useMemo(\n () => (\n <g>\n {isActive && !isGrabbed ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <DSPopperJS\n withoutAnimation\n withoutArrow\n customOffset={[0, 5]}\n referenceElement={referenceElement}\n showPopover\n zIndex={theme.zIndex.tooltip}\n startPlacementPreference={scrapper.tooltipPreference}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={datum} />\n </StyledTooltipContainer>\n </DSPopperJS>\n </foreignObject>\n ) : null}\n <line\n ref={setReferenceElement}\n x1={xPosition}\n strokeWidth=\"2px\"\n stroke={scrapper.color}\n y1={0}\n x2={xPosition}\n y2={innerHeight}\n strokeDasharray={(4, 4)}\n />\n </g>\n ) : null}\n <rect\n onMouseOver={handleOnMouseEnter}\n // onMouseLeave={() => setScrapperPosY('')}\n // id=\"horizontal-scrapper-zone\"\n x={xScale.bandwidth ? xPosition - xScale.bandwidth() / 2 : xPosition - rectDetector?.left}\n fill=\"transparent\"\n y={0}\n width={xScale.bandwidth?.() ?? rectDetector?.right + rectDetector?.left}\n height={innerHeight}\n />\n </g>\n ),\n [\n isActive,\n isGrabbed,\n TooltipRenderer,\n referenceElement,\n theme.zIndex.tooltip,\n scrapper.tooltipPreference,\n scrapper.color,\n datum,\n xPosition,\n innerHeight,\n handleOnMouseEnter,\n xScale,\n rectDetector,\n ],\n );\n return render;\n});\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,OAAOA,UAAS,YAAY,aAAa,UAAU,eAAe;AAClE,SAAS,kBAA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BAAC;AAAA,UACC,aAAa;AAAA,UAGb,GAAG,OAAO,YAAY,YAAY,OAAO,UAAU,IAAI,IAAI,YAAY,cAAc;AAAA,UACrF,MAAK;AAAA,UACL,GAAG;AAAA,UACH,OAAO,OAAO,YAAY,KAAK,cAAc,QAAQ,cAAc;AAAA,UACnE,QAAQ;AAAA,SACV;AAAA;AAAA,KACF;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,OAAO;AAAA,MACb,SAAS;AAAA,MACT,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT,CAAC;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
4
|
+
import { ChartContext } from "../../ChartContext";
|
|
5
|
+
const BlurMask = () => {
|
|
6
|
+
const {
|
|
7
|
+
xScrollbarPosition,
|
|
8
|
+
innerWidth,
|
|
9
|
+
containerRatio,
|
|
10
|
+
chartId,
|
|
11
|
+
props: { height }
|
|
12
|
+
} = useContext(ChartContext);
|
|
13
|
+
const gradient = useMemo(() => {
|
|
14
|
+
if (xScrollbarPosition === 0) {
|
|
15
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx("stop", {
|
|
18
|
+
offset: "93%",
|
|
19
|
+
style: { stopColor: "white", stopOpacity: 1 }
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ jsx("stop", {
|
|
22
|
+
offset: "100%",
|
|
23
|
+
style: { stopColor: "white", stopOpacity: 0 }
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (innerWidth * containerRatio === (xScrollbarPosition + innerWidth / containerRatio) * containerRatio) {
|
|
29
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx("stop", {
|
|
32
|
+
offset: "0%",
|
|
33
|
+
style: { stopColor: "white", stopOpacity: 0 }
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx("stop", {
|
|
36
|
+
offset: "7%",
|
|
37
|
+
style: { stopColor: "white", stopOpacity: 1 }
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("stop", {
|
|
45
|
+
offset: "0%",
|
|
46
|
+
style: { stopColor: "white", stopOpacity: 0 }
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsx("stop", {
|
|
49
|
+
offset: "7%",
|
|
50
|
+
style: { stopColor: "white", stopOpacity: 1 }
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ jsx("stop", {
|
|
53
|
+
offset: "93%",
|
|
54
|
+
style: { stopColor: "white", stopOpacity: 1 }
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ jsx("stop", {
|
|
57
|
+
offset: "100%",
|
|
58
|
+
style: { stopColor: "white", stopOpacity: 0 }
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}, [containerRatio, innerWidth, xScrollbarPosition]);
|
|
63
|
+
if (containerRatio === 1)
|
|
64
|
+
return null;
|
|
65
|
+
return /* @__PURE__ */ jsxs("defs", {
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx("linearGradient", {
|
|
68
|
+
id: `filter-fade-${chartId}`,
|
|
69
|
+
children: gradient
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ jsx("mask", {
|
|
72
|
+
id: `mask-${chartId}`,
|
|
73
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
74
|
+
x: 0,
|
|
75
|
+
width: innerWidth,
|
|
76
|
+
height,
|
|
77
|
+
fill: `url(#filter-fade-${chartId}`
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
BlurMask
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=BlurMask.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scroller/BlurMask.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\n\nexport const BlurMask = () => {\n const {\n xScrollbarPosition,\n innerWidth,\n containerRatio,\n chartId,\n props: { height },\n } = useContext(ChartContext);\n\n const gradient = useMemo(() => {\n if (xScrollbarPosition === 0) {\n return (\n <>\n <stop offset=\"93%\" style={{ stopColor: 'white', stopOpacity: 1 }} />\n <stop offset=\"100%\" style={{ stopColor: 'white', stopOpacity: 0 }} />\n </>\n );\n }\n\n if (innerWidth * containerRatio === (xScrollbarPosition + innerWidth / containerRatio) * containerRatio) {\n return (\n <>\n <stop offset=\"0%\" style={{ stopColor: 'white', stopOpacity: 0 }} />\n <stop offset=\"7%\" style={{ stopColor: 'white', stopOpacity: 1 }} />\n </>\n );\n }\n\n return (\n <>\n <stop offset=\"0%\" style={{ stopColor: 'white', stopOpacity: 0 }} />\n <stop offset=\"7%\" style={{ stopColor: 'white', stopOpacity: 1 }} />\n <stop offset=\"93%\" style={{ stopColor: 'white', stopOpacity: 1 }} />\n <stop offset=\"100%\" style={{ stopColor: 'white', stopOpacity: 0 }} />\n </>\n );\n }, [containerRatio, innerWidth, xScrollbarPosition]);\n\n if (containerRatio === 1) return null;\n return (\n <defs>\n <linearGradient id={`filter-fade-${chartId}`}>{gradient}</linearGradient>\n\n <mask id={`mask-${chartId}`}>\n <rect x={0} width={innerWidth} height={height} fill={`url(#filter-fade-${chartId}`}></rect>\n </mask>\n </defs>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,YAAY,eAAe;AAC3C,SAAS,oBAAoB;AAEtB,MAAM,WAAW,MAAM;AAC5B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,OAAO;AAAA,EAClB,IAAI,WAAW,YAAY;AAE3B,QAAM,WAAW,QAAQ,MAAM;AAC7B,QAAI,uBAAuB,GAAG;AAC5B,aACE;AAAA,QACE;AAAA,8BAAC;AAAA,YAAK,QAAO;AAAA,YAAM,OAAO,EAAE,WAAW,SAAS,aAAa,EAAE;AAAA,WAAG;AAAA,UAClE,oBAAC;AAAA,YAAK,QAAO;AAAA,YAAO,OAAO,EAAE,WAAW,SAAS,aAAa,EAAE;AAAA,WAAG;AAAA;AAAA,OACrE;AAAA,IAEJ;AAEA,QAAI,aAAa,oBAAoB,qBAAqB,aAAa,kBAAkB,gBAAgB;AACvG,aACE;AAAA,QACE;AAAA,8BAAC;AAAA,YAAK,QAAO;AAAA,YAAK,OAAO,EAAE,WAAW,SAAS,aAAa,EAAE;AAAA,WAAG;AAAA,UACjE,oBAAC;AAAA,YAAK,QAAO;AAAA,YAAK,OAAO,EAAE,WAAW,SAAS,aAAa,EAAE;AAAA,WAAG;AAAA;AAAA,OACnE;AAAA,IAEJ;AAEA,WACE;AAAA,MACE;AAAA,4BAAC;AAAA,UAAK,QAAO;AAAA,UAAK,OAAO,EAAE,WAAW,SAAS,aAAa,EAAE;AAAA,SAAG;AAAA,QACjE,oBAAC;AAAA,UAAK,QAAO;AAAA,UAAK,OAAO,EAAE,WAAW,SAAS,aAAa,EAAE;AAAA,SAAG;AAAA,QACjE,oBAAC;AAAA,UAAK,QAAO;AAAA,UAAM,OAAO,EAAE,WAAW,SAAS,aAAa,EAAE;AAAA,SAAG;AAAA,QAClE,oBAAC;AAAA,UAAK,QAAO;AAAA,UAAO,OAAO,EAAE,WAAW,SAAS,aAAa,EAAE;AAAA,SAAG;AAAA;AAAA,KACrE;AAAA,EAEJ,GAAG,CAAC,gBAAgB,YAAY,kBAAkB,CAAC;AAEnD,MAAI,mBAAmB;AAAG,WAAO;AACjC,SACE,qBAAC;AAAA,IACC;AAAA,0BAAC;AAAA,QAAe,IAAI,eAAe;AAAA,QAAY;AAAA,OAAS;AAAA,MAExD,oBAAC;AAAA,QAAK,IAAI,QAAQ;AAAA,QAChB,8BAAC;AAAA,UAAK,GAAG;AAAA,UAAG,OAAO;AAAA,UAAY;AAAA,UAAgB,MAAM,oBAAoB;AAAA,SAAW;AAAA,OACtF;AAAA;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -17,7 +17,7 @@ const ScrollBarX = () => {
|
|
|
17
17
|
isScrollbarVisible,
|
|
18
18
|
oldLastPosition
|
|
19
19
|
} = useContext(ChartContext);
|
|
20
|
-
const barWidth = useMemo(() =>
|
|
20
|
+
const barWidth = useMemo(() => innerWidth / containerRatio, [containerRatio, innerWidth]);
|
|
21
21
|
const handleMouseDown = useCallback(
|
|
22
22
|
(e) => {
|
|
23
23
|
setScrapperPosX("");
|
|
@@ -27,12 +27,9 @@ const ScrollBarX = () => {
|
|
|
27
27
|
},
|
|
28
28
|
[setIsGrabbed, setScrapperPosX, setStartPosition]
|
|
29
29
|
);
|
|
30
|
-
const handleMouseEnter = useCallback(
|
|
31
|
-
(
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
[setScrapperPosX]
|
|
35
|
-
);
|
|
30
|
+
const handleMouseEnter = useCallback(() => {
|
|
31
|
+
setScrapperPosX("");
|
|
32
|
+
}, [setScrapperPosX]);
|
|
36
33
|
const handleClickFullBar = useCallback(
|
|
37
34
|
(e) => {
|
|
38
35
|
let newPosition = 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scroller/ScrollBarX.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\n\nexport const ScrollBarX = () => {\n const {\n setIsGrabbed,\n setStartPosition,\n innerWidth,\n xScrollbarPosition,\n activePoint,\n setXScrollbarPosition,\n innerHeight,\n isGrabbed,\n containerRatio,\n setScrapperPosX,\n isScrollbarVisible,\n oldLastPosition,\n } = useContext(ChartContext);\n\n const barWidth = useMemo(() =>
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,YAAY,aAAa,eAAe;AACxD,SAAS,oBAAoB;AAEtB,MAAM,aAAa,MAAM;AAC9B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAE3B,QAAM,WAAW,QAAQ,MAAM,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\n\nexport const ScrollBarX = () => {\n const {\n setIsGrabbed,\n setStartPosition,\n innerWidth,\n xScrollbarPosition,\n activePoint,\n setXScrollbarPosition,\n innerHeight,\n isGrabbed,\n containerRatio,\n setScrapperPosX,\n isScrollbarVisible,\n oldLastPosition,\n } = useContext(ChartContext);\n\n const barWidth = useMemo(() => innerWidth / containerRatio, [containerRatio, innerWidth]);\n\n const handleMouseDown = useCallback(\n (e: React.MouseEvent) => {\n setScrapperPosX('');\n setIsGrabbed(true);\n setStartPosition(e.clientX);\n e.preventDefault();\n },\n [setIsGrabbed, setScrapperPosX, setStartPosition],\n );\n\n const handleMouseEnter: React.MouseEventHandler = useCallback(() => {\n setScrapperPosX('');\n }, [setScrapperPosX]);\n\n const handleClickFullBar: React.MouseEventHandler = useCallback(\n (e) => {\n let newPosition = 0;\n const bar = e.target as SVGGElement;\n const bounds = bar.getBoundingClientRect();\n const left = e.clientX - bounds.left;\n if (left + barWidth / 2 > innerWidth) {\n newPosition = innerWidth - barWidth;\n } else if (left - barWidth / 2 > 0) {\n newPosition = left - barWidth / 2;\n }\n\n setXScrollbarPosition(newPosition);\n oldLastPosition.current = newPosition;\n e.preventDefault();\n },\n [barWidth, innerWidth, oldLastPosition, setXScrollbarPosition],\n );\n\n const isBarVisible = useMemo(\n () => (isScrollbarVisible || activePoint) && containerRatio > 1,\n [activePoint, containerRatio, isScrollbarVisible],\n );\n\n return (\n <g\n className=\"scrollbarx\"\n transform={`translate(0,${innerHeight})`}\n style={{ visibility: isBarVisible ? 'visible' : 'hidden' }}\n onMouseEnter={handleMouseEnter}\n >\n <rect style={{ cursor: 'pointer' }} width={innerWidth} height=\"6\" fill=\"#ebecf0c5\" onClick={handleClickFullBar} />\n <g transform={`translate(${xScrollbarPosition},0)`}>\n <rect\n style={{ cursor: isGrabbed ? 'grabbing' : 'grab' }}\n width={barWidth}\n height=\"6\"\n fill=\"grey\"\n onMouseDown={handleMouseDown}\n />\n </g>\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,YAAY,aAAa,eAAe;AACxD,SAAS,oBAAoB;AAEtB,MAAM,aAAa,MAAM;AAC9B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,I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