@elliemae/ds-dataviz 3.8.0 → 3.9.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/config/useChart.js +67 -13
- package/dist/cjs/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +14 -8
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useScales.js +24 -11
- package/dist/cjs/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/cjs/graphs/Chart/helpers/index.js +2 -2
- package/dist/cjs/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +23 -20
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +3 -3
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +20 -30
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js +4 -9
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +28 -14
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/cjs/graphs/Chart/{series/Pie.js → parts/Labels/BottomLabel.js} +20 -12
- package/dist/cjs/graphs/Chart/parts/Labels/BottomLabel.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/Label.js +52 -0
- package/dist/cjs/graphs/Chart/parts/Labels/Label.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/LeftLabel.js +65 -0
- package/dist/cjs/graphs/Chart/parts/Labels/LeftLabel.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/RightLabel.js +67 -0
- package/dist/cjs/graphs/Chart/parts/Labels/RightLabel.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js +28 -30
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js +15 -20
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js +71 -0
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js +32 -25
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js +3 -13
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js +50 -16
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js +3 -1
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js +7 -5
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +19 -18
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +2 -2
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Bars.js +12 -8
- package/dist/cjs/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Line.js +5 -3
- package/dist/cjs/graphs/Chart/series/Line.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Points.js +9 -4
- package/dist/cjs/graphs/Chart/series/Points.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/index.js +0 -1
- package/dist/cjs/graphs/Chart/series/index.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useChart.js +68 -14
- package/dist/esm/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +14 -8
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useScales.js +25 -12
- package/dist/esm/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/index.js +2 -2
- package/dist/esm/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +24 -21
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +3 -3
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +21 -31
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js +4 -9
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +29 -15
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Labels/BottomLabel.js +28 -0
- package/dist/esm/graphs/Chart/parts/Labels/BottomLabel.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/Label.js +26 -0
- package/dist/esm/graphs/Chart/parts/Labels/Label.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/LeftLabel.js +39 -0
- package/dist/esm/graphs/Chart/parts/Labels/LeftLabel.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/RightLabel.js +41 -0
- package/dist/esm/graphs/Chart/parts/Labels/RightLabel.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js +28 -30
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js +17 -22
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js +45 -0
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js +33 -26
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js +3 -13
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js +51 -17
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js +3 -1
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js +7 -5
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +19 -18
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js +2 -2
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Bars.js +12 -8
- package/dist/esm/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Line.js +5 -3
- package/dist/esm/graphs/Chart/series/Line.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Points.js +9 -4
- package/dist/esm/graphs/Chart/series/Points.js.map +2 -2
- package/dist/esm/graphs/Chart/series/index.js +0 -1
- package/dist/esm/graphs/Chart/series/index.js.map +2 -2
- package/package.json +8 -8
- package/dist/cjs/graphs/Chart/series/Pie.js.map +0 -7
- package/dist/esm/graphs/Chart/series/Pie.js +0 -20
- package/dist/esm/graphs/Chart/series/Pie.js.map +0 -7
|
@@ -35,7 +35,7 @@ var import_styles = require("../../styles");
|
|
|
35
35
|
var import_ChartContext = require("../../ChartContext");
|
|
36
36
|
const AxisLeft = () => {
|
|
37
37
|
const {
|
|
38
|
-
props: { yAxis,
|
|
38
|
+
props: { yAxis, height },
|
|
39
39
|
innerHeight,
|
|
40
40
|
innerWidth,
|
|
41
41
|
yScale,
|
|
@@ -44,49 +44,39 @@ const AxisLeft = () => {
|
|
|
44
44
|
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
45
45
|
const ref = (0, import_react.useRef)();
|
|
46
46
|
const gridRef = (0, import_react.useRef)();
|
|
47
|
-
const ticks = yScale.ticks?.();
|
|
47
|
+
const ticks = yScale.ticks?.(yAxis.tickCount ?? height / 80);
|
|
48
48
|
(0, import_react.useEffect)(() => {
|
|
49
49
|
const axis = (0, import_d3.axisLeft)(yScale);
|
|
50
|
+
const grid = (0, import_d3.axisLeft)(yScale).tickFormat("").tickSize(yAxis?.showGrid ? -innerWidth : 0).tickSizeOuter(0);
|
|
50
51
|
if (yAxis.tickValues && ticks) {
|
|
51
52
|
const finalTicks = yAxis.overwriteTicks ? yAxis.tickValues : [...ticks, ...yAxis.tickValues];
|
|
52
53
|
axis.tickValues(finalTicks);
|
|
54
|
+
} else {
|
|
55
|
+
axis.tickValues(ticks);
|
|
56
|
+
grid.tickValues(ticks);
|
|
53
57
|
}
|
|
54
58
|
if (yAxis.tickFormat) {
|
|
55
59
|
axis.tickFormat(yAxis.tickFormat);
|
|
56
60
|
}
|
|
57
|
-
const grid = (0, import_d3.axisLeft)(yScale).tickFormat("").tickSize(yAxis?.showGrid ? -innerWidth : 0).tickSizeOuter(0);
|
|
58
61
|
(0, import_d3.select)(ref.current).call(axis);
|
|
59
62
|
(0, import_d3.select)(gridRef.current).call(grid);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
yScale
|
|
69
|
-
]);
|
|
63
|
+
if (yAxis.hideAxis) {
|
|
64
|
+
(0, import_d3.select)(ref.current).call((g) => {
|
|
65
|
+
g.selectAll(".tick").remove();
|
|
66
|
+
g.select(".domain").remove();
|
|
67
|
+
});
|
|
68
|
+
(0, import_d3.select)(gridRef.current).call((g) => g.select(".domain").remove());
|
|
69
|
+
}
|
|
70
|
+
}, [innerHeight, innerWidth, ticks, yAxis, yScale]);
|
|
70
71
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
71
72
|
children: [
|
|
72
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
73
74
|
ref: setAxisLeftWidth,
|
|
74
|
-
children:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
textAnchor: "middle",
|
|
80
|
-
dy: -15,
|
|
81
|
-
children: yAxis?.label
|
|
82
|
-
})
|
|
83
|
-
}),
|
|
84
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxis, {
|
|
85
|
-
ref,
|
|
86
|
-
color: yAxis.color,
|
|
87
|
-
className: "axis-left"
|
|
88
|
-
})
|
|
89
|
-
]
|
|
75
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxis, {
|
|
76
|
+
ref,
|
|
77
|
+
color: yAxis.color,
|
|
78
|
+
className: "axis-left"
|
|
79
|
+
})
|
|
90
80
|
}),
|
|
91
81
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledGrid, {
|
|
92
82
|
ref: gridRef
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/graphs/Chart/parts/Axis/AxisLeft.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useCallback, useEffect, useRef } from 'react';\nimport { select, axisLeft } from 'd3';\nimport { StyledAxis, StyledGrid, StyledAxisLabel } from '../../styles';\nimport { ChartContext } from '../../ChartContext';\nexport const AxisLeft = () => {\n const {\n props: { yAxis,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkE;AAClE,
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useCallback, useEffect, useRef } from 'react';\nimport { select, selectAll, axisLeft } from 'd3';\nimport { StyledAxis, StyledGrid, StyledAxisLabel } from '../../styles';\nimport { ChartContext } from '../../ChartContext';\nexport const AxisLeft = () => {\n const {\n props: { yAxis, height },\n innerHeight,\n innerWidth,\n yScale,\n internalMargin,\n setAxisLeftWidth,\n } = useContext(ChartContext);\n\n const ref = useRef();\n const gridRef = useRef();\n const ticks = yScale.ticks?.(yAxis.tickCount ?? height / 80);\n\n useEffect(() => {\n const axis = axisLeft(yScale);\n\n const grid = axisLeft(yScale)\n .tickFormat('')\n .tickSize(yAxis?.showGrid ? -innerWidth : 0)\n .tickSizeOuter(0);\n\n if (yAxis.tickValues && ticks) {\n const finalTicks = yAxis.overwriteTicks ? yAxis.tickValues : [...ticks, ...yAxis.tickValues];\n axis.tickValues(finalTicks);\n } else {\n axis.tickValues(ticks);\n grid.tickValues(ticks);\n }\n\n if (yAxis.tickFormat) {\n axis.tickFormat(yAxis.tickFormat);\n }\n\n select(ref.current).call(axis);\n\n select(gridRef.current).call(grid);\n\n if (yAxis.hideAxis) {\n select(ref.current).call((g) => {\n g.selectAll('.tick').remove();\n g.select('.domain').remove();\n });\n select(gridRef.current).call((g) => g.select('.domain').remove());\n }\n }, [innerHeight, innerWidth, ticks, yAxis, yScale]);\n return (\n <g>\n <g ref={setAxisLeftWidth}>\n <StyledAxis ref={ref} color={yAxis.color} className=\"axis-left\"></StyledAxis>\n </g>\n\n <StyledGrid ref={gridRef}></StyledGrid>\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkE;AAClE,gBAA4C;AAC5C,oBAAwD;AACxD,0BAA6B;AACtB,MAAM,WAAW,MAAM;AAC5B,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,OAAO;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,QAAM,UAAM,qBAAO;AACnB,QAAM,cAAU,qBAAO;AACvB,QAAM,QAAQ,OAAO,QAAQ,MAAM,aAAa,SAAS,EAAE;AAE3D,8BAAU,MAAM;AACd,UAAM,WAAO,oBAAS,MAAM;AAE5B,UAAM,WAAO,oBAAS,MAAM,EACzB,WAAW,EAAE,EACb,SAAS,OAAO,WAAW,CAAC,aAAa,CAAC,EAC1C,cAAc,CAAC;AAElB,QAAI,MAAM,cAAc,OAAO;AAC7B,YAAM,aAAa,MAAM,iBAAiB,MAAM,aAAa,CAAC,GAAG,OAAO,GAAG,MAAM,UAAU;AAC3F,WAAK,WAAW,UAAU;AAAA,IAC5B,OAAO;AACL,WAAK,WAAW,KAAK;AACrB,WAAK,WAAW,KAAK;AAAA,IACvB;AAEA,QAAI,MAAM,YAAY;AACpB,WAAK,WAAW,MAAM,UAAU;AAAA,IAClC;AAEA,0BAAO,IAAI,OAAO,EAAE,KAAK,IAAI;AAE7B,0BAAO,QAAQ,OAAO,EAAE,KAAK,IAAI;AAEjC,QAAI,MAAM,UAAU;AAClB,4BAAO,IAAI,OAAO,EAAE,KAAK,CAAC,MAAM;AAC9B,UAAE,UAAU,OAAO,EAAE,OAAO;AAC5B,UAAE,OAAO,SAAS,EAAE,OAAO;AAAA,MAC7B,CAAC;AACD,4BAAO,QAAQ,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,SAAS,EAAE,OAAO,CAAC;AAAA,IAClE;AAAA,EACF,GAAG,CAAC,aAAa,YAAY,OAAO,OAAO,MAAM,CAAC;AAClD,SACE,6CAAC;AAAA,IACC;AAAA,kDAAC;AAAA,QAAE,KAAK;AAAA,QACN,sDAAC;AAAA,UAAW;AAAA,UAAU,OAAO,MAAM;AAAA,UAAO,WAAU;AAAA,SAAY;AAAA,OAClE;AAAA,MAEA,4CAAC;AAAA,QAAW,KAAK;AAAA,OAAS;AAAA;AAAA,GAC5B;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,14 +35,14 @@ var import_styles = require("../../styles");
|
|
|
35
35
|
var import_ChartContext = require("../../ChartContext");
|
|
36
36
|
const AxisRight = () => {
|
|
37
37
|
const {
|
|
38
|
-
props: { y2Axis,
|
|
39
|
-
innerHeight,
|
|
38
|
+
props: { y2Axis, height },
|
|
40
39
|
innerWidth,
|
|
41
40
|
y2Scale,
|
|
42
41
|
setAxisRightWidth
|
|
43
42
|
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
44
43
|
if (!y2Axis)
|
|
45
44
|
return null;
|
|
45
|
+
const ticks = y2Scale.ticks?.(y2Axis.tickCount ?? height / 80);
|
|
46
46
|
const ref = (0, import_react.useRef)();
|
|
47
47
|
(0, import_react.useEffect)(() => {
|
|
48
48
|
const axis = (0, import_d3.axisRight)(y2Scale).tickSizeOuter(0);
|
|
@@ -53,13 +53,8 @@ const AxisRight = () => {
|
|
|
53
53
|
transform: `translate(${innerWidth},0)`,
|
|
54
54
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxis, {
|
|
55
55
|
ref,
|
|
56
|
-
color: y2Axis.color
|
|
57
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("text", {
|
|
58
|
-
className: "axis-label",
|
|
59
|
-
textAnchor: "middle",
|
|
60
|
-
transform: `translate(${-yAxisLabelOffset},${innerHeight / 2}) rotate(-90)`
|
|
61
|
-
})
|
|
56
|
+
color: y2Axis.color
|
|
62
57
|
})
|
|
63
|
-
});
|
|
58
|
+
}, ticks.toString());
|
|
64
59
|
};
|
|
65
60
|
//# sourceMappingURL=AxisRight.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/graphs/Chart/parts/Axis/AxisRight.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useEffect, useRef } from 'react';\nimport { select, axisRight } from 'd3';\nimport { StyledAxis } from '../../styles';\nimport { ChartContext } from '../../ChartContext';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useEffect, useMemo, useRef } from 'react';\nimport { select, axisRight } from 'd3';\nimport { StyledAxis, StyledAxisLabel } from '../../styles';\nimport { ChartContext } from '../../ChartContext';\nexport const AxisRight = () => {\n const {\n props: { y2Axis, height },\n innerWidth,\n y2Scale,\n setAxisRightWidth,\n } = useContext(ChartContext);\n if (!y2Axis) return null;\n\n const ticks = y2Scale.ticks?.(y2Axis.tickCount ?? height / 80);\n\n const ref = useRef();\n useEffect(() => {\n const axis = axisRight(y2Scale).tickSizeOuter(0);\n\n select(ref.current).call(axis);\n }, [innerWidth, y2Scale]);\n\n return (\n <g key={ticks.toString()} ref={setAxisRightWidth} transform={`translate(${innerWidth},0)`}>\n <StyledAxis ref={ref} color={y2Axis.color} />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA8D;AAC9D,gBAAkC;AAClC,oBAA4C;AAC5C,0BAA6B;AACtB,MAAM,YAAY,MAAM;AAC7B,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ,OAAO;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAC3B,MAAI,CAAC;AAAQ,WAAO;AAEpB,QAAM,QAAQ,QAAQ,QAAQ,OAAO,aAAa,SAAS,EAAE;AAE7D,QAAM,UAAM,qBAAO;AACnB,8BAAU,MAAM;AACd,UAAM,WAAO,qBAAU,OAAO,EAAE,cAAc,CAAC;AAE/C,0BAAO,IAAI,OAAO,EAAE,KAAK,IAAI;AAAA,EAC/B,GAAG,CAAC,YAAY,OAAO,CAAC;AAExB,SACE,4CAAC;AAAA,IAAyB,KAAK;AAAA,IAAmB,WAAW,aAAa;AAAA,IACxE,sDAAC;AAAA,MAAW;AAAA,MAAU,OAAO,OAAO;AAAA,KAAO;AAAA,KADrC,MAAM,SAAS,CAEvB;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,6 +34,7 @@ var import_styles = require("../styles");
|
|
|
34
34
|
var import_ChartContext = require("../ChartContext");
|
|
35
35
|
var import_useKeyboardNavigation = require("../config/useKeyboardNavigation");
|
|
36
36
|
var import_Legend = require("./Legend/Legend");
|
|
37
|
+
var import_Label = require("./Labels/Label");
|
|
37
38
|
const ChartContainer = ({ children }) => {
|
|
38
39
|
const {
|
|
39
40
|
props: { width, height },
|
|
@@ -83,7 +84,16 @@ const ChartContainer = ({ children }) => {
|
|
|
83
84
|
oldLastPosition.current = xScrollbarPosition;
|
|
84
85
|
setIsGrabbed(false);
|
|
85
86
|
}, [oldLastPosition, setIsGrabbed, xScrollbarPosition]);
|
|
86
|
-
const key =
|
|
87
|
+
const key = (0, import_react.useMemo)(
|
|
88
|
+
() => `translate(${internalMargin.left},${internalMargin.top},${internalMargin.right})`,
|
|
89
|
+
[internalMargin]
|
|
90
|
+
);
|
|
91
|
+
(0, import_react.useEffect)(() => {
|
|
92
|
+
containerRef?.current?.addEventListener("mousemove", handleMouseMove);
|
|
93
|
+
return () => {
|
|
94
|
+
containerRef?.current?.removeEventListener("mousemove", handleMouseMove);
|
|
95
|
+
};
|
|
96
|
+
}, [containerRef, handleMouseMove]);
|
|
87
97
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledSVGWrapper, {
|
|
88
98
|
ref: containerRef,
|
|
89
99
|
onKeyDown: onInputKeyDown,
|
|
@@ -93,26 +103,30 @@ const ChartContainer = ({ children }) => {
|
|
|
93
103
|
onFocus: handleOnFocus,
|
|
94
104
|
onMouseEnter: onMouseEnterHandler,
|
|
95
105
|
onMouseLeave: onMouseLeaveHandler,
|
|
96
|
-
onMouseMove: handleMouseMove,
|
|
97
106
|
onMouseUp: handleMouseUp,
|
|
98
107
|
onMouseDown: (e) => e.preventDefault(),
|
|
99
108
|
isGrabbed,
|
|
100
109
|
style: { width },
|
|
101
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
|
|
102
111
|
ref: svgRef,
|
|
103
112
|
width,
|
|
104
113
|
height,
|
|
105
|
-
children:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Legend.Legend, {}),
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Label.Label, {})
|
|
120
|
+
]
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
123
|
+
className: "container",
|
|
124
|
+
transform: `translate(${internalMargin.left},${internalMargin.top})`,
|
|
125
|
+
children
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
}, key)
|
|
115
129
|
})
|
|
116
|
-
}
|
|
130
|
+
});
|
|
117
131
|
};
|
|
118
132
|
//# sourceMappingURL=ChartContainer.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/parts/ChartContainer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useCallback,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo, useCallback, useEffect } from 'react';\nimport { StyledSVGWrapper } from '../styles';\n\nimport { ChartContext } from '../ChartContext';\nimport { useKeyboardNavigation } from '../config/useKeyboardNavigation';\nimport { Legend } from './Legend/Legend';\nimport { Label } from './Labels/Label';\ninterface ChartContainerT {\n children: JSX.Element | JSX.Element[] | string | string[];\n}\nexport const ChartContainer: React.ComponentType<ChartContainerT> = ({ children }) => {\n const {\n props: { width, height },\n containerRef,\n activePoint,\n internalMargin,\n setScrapperPosY,\n setScrapperPosX,\n svgRef,\n isGrabbed,\n setIsGrabbed,\n startPosition,\n innerWidth,\n setActivePoint,\n setXScrollbarPosition,\n xScrollbarPosition,\n containerRatio,\n oldLastPosition,\n setIsScrollbarVisible,\n } = useContext(ChartContext);\n\n const { onInputKeyDown, handleOnBlur, handleOnFocus } = useKeyboardNavigation();\n\n const onMouseEnterHandler = useCallback(() => {\n setIsScrollbarVisible(true);\n }, [setIsScrollbarVisible]);\n const onMouseLeaveHandler = useCallback(() => {\n setScrapperPosY('');\n setScrapperPosX('');\n setIsScrollbarVisible(false);\n setIsGrabbed(false);\n }, [setIsGrabbed, setIsScrollbarVisible, setScrapperPosX, setScrapperPosY]);\n\n const handleMouseMove = useCallback(\n (e: React.MouseEvent) => {\n if (!isGrabbed) return;\n setActivePoint('');\n const newPosition = oldLastPosition?.current + e.clientX - startPosition;\n if (newPosition < 0) setXScrollbarPosition(0);\n else if (newPosition > innerWidth - innerWidth / containerRatio)\n setXScrollbarPosition(innerWidth - innerWidth / containerRatio);\n else setXScrollbarPosition(newPosition);\n },\n [isGrabbed, setActivePoint, oldLastPosition, startPosition, setXScrollbarPosition, innerWidth, containerRatio],\n );\n const handleMouseUp = useCallback(() => {\n oldLastPosition.current = xScrollbarPosition;\n setIsGrabbed(false);\n }, [oldLastPosition, setIsGrabbed, xScrollbarPosition]);\n const key = useMemo(\n () => `translate(${internalMargin.left},${internalMargin.top},${internalMargin.right})`,\n [internalMargin],\n );\n\n useEffect(() => {\n containerRef?.current?.addEventListener('mousemove', handleMouseMove);\n // containerRef?.current?.addEventListener('wheel', handleScroll);\n\n return () => {\n containerRef?.current?.removeEventListener('mousemove', handleMouseMove);\n // containerRef?.current?.removeEventListener('wheel', handleScroll);\n };\n }, [containerRef, handleMouseMove]);\n\n return (\n <StyledSVGWrapper\n ref={containerRef}\n onKeyDown={onInputKeyDown}\n aria-hidden=\"true\"\n tabIndex={activePoint ? -1 : 0}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n // // onMouseMove={handleMouseMove}\n onMouseUp={handleMouseUp}\n onMouseDown={(e) => e.preventDefault()}\n isGrabbed={isGrabbed}\n style={{ width: width }}\n >\n <svg ref={svgRef} width={width} height={height}>\n <g key={key}>\n <g>\n <Legend />\n <Label />\n </g>\n <g className=\"container\" transform={`translate(${internalMargin.left},${internalMargin.top})`}>\n {children}\n </g>\n </g>\n </svg>\n </StyledSVGWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAmE;AACnE,oBAAiC;AAEjC,0BAA6B;AAC7B,mCAAsC;AACtC,oBAAuB;AACvB,mBAAsB;AAIf,MAAM,iBAAuD,CAAC,EAAE,SAAS,MAAM;AACpF,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,OAAO;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,QAAM,EAAE,gBAAgB,cAAc,cAAc,QAAI,oDAAsB;AAE9E,QAAM,0BAAsB,0BAAY,MAAM;AAC5C,0BAAsB,IAAI;AAAA,EAC5B,GAAG,CAAC,qBAAqB,CAAC;AAC1B,QAAM,0BAAsB,0BAAY,MAAM;AAC5C,oBAAgB,EAAE;AAClB,oBAAgB,EAAE;AAClB,0BAAsB,KAAK;AAC3B,iBAAa,KAAK;AAAA,EACpB,GAAG,CAAC,cAAc,uBAAuB,iBAAiB,eAAe,CAAC;AAE1E,QAAM,sBAAkB;AAAA,IACtB,CAAC,MAAwB;AACvB,UAAI,CAAC;AAAW;AAChB,qBAAe,EAAE;AACjB,YAAM,cAAc,iBAAiB,UAAU,EAAE,UAAU;AAC3D,UAAI,cAAc;AAAG,8BAAsB,CAAC;AAAA,eACnC,cAAc,aAAa,aAAa;AAC/C,8BAAsB,aAAa,aAAa,cAAc;AAAA;AAC3D,8BAAsB,WAAW;AAAA,IACxC;AAAA,IACA,CAAC,WAAW,gBAAgB,iBAAiB,eAAe,uBAAuB,YAAY,cAAc;AAAA,EAC/G;AACA,QAAM,oBAAgB,0BAAY,MAAM;AACtC,oBAAgB,UAAU;AAC1B,iBAAa,KAAK;AAAA,EACpB,GAAG,CAAC,iBAAiB,cAAc,kBAAkB,CAAC;AACtD,QAAM,UAAM;AAAA,IACV,MAAM,aAAa,eAAe,QAAQ,eAAe,OAAO,eAAe;AAAA,IAC/E,CAAC,cAAc;AAAA,EACjB;AAEA,8BAAU,MAAM;AACd,kBAAc,SAAS,iBAAiB,aAAa,eAAe;AAGpE,WAAO,MAAM;AACX,oBAAc,SAAS,oBAAoB,aAAa,eAAe;AAAA,IAEzE;AAAA,EACF,GAAG,CAAC,cAAc,eAAe,CAAC;AAElC,SACE,4CAAC;AAAA,IACC,KAAK;AAAA,IACL,WAAW;AAAA,IACX,eAAY;AAAA,IACZ,UAAU,cAAc,KAAK;AAAA,IAC7B,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,cAAc;AAAA,IACd,cAAc;AAAA,IAEd,WAAW;AAAA,IACX,aAAa,CAAC,MAAM,EAAE,eAAe;AAAA,IACrC;AAAA,IACA,OAAO,EAAE,MAAa;AAAA,IAEtB,sDAAC;AAAA,MAAI,KAAK;AAAA,MAAQ;AAAA,MAAc;AAAA,MAC9B,uDAAC;AAAA,QACC;AAAA,uDAAC;AAAA,YACC;AAAA,0DAAC,wBAAO;AAAA,cACR,4CAAC,sBAAM;AAAA;AAAA,WACT;AAAA,UACA,4CAAC;AAAA,YAAE,WAAU;AAAA,YAAY,WAAW,aAAa,eAAe,QAAQ,eAAe;AAAA,YACpF;AAAA,WACH;AAAA;AAAA,SAPM,GAQR;AAAA,KACF;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,25 +22,33 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var
|
|
26
|
-
__export(
|
|
27
|
-
|
|
25
|
+
var BottomLabel_exports = {};
|
|
26
|
+
__export(BottomLabel_exports, {
|
|
27
|
+
BottomLabel: () => BottomLabel
|
|
28
28
|
});
|
|
29
|
-
module.exports = __toCommonJS(
|
|
29
|
+
module.exports = __toCommonJS(BottomLabel_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
32
|
var import_react = require("react");
|
|
33
|
-
var import_ChartContext = require("
|
|
34
|
-
|
|
33
|
+
var import_ChartContext = require("../../ChartContext");
|
|
34
|
+
var import_styles = require("../../styles");
|
|
35
|
+
const BottomLabel = () => {
|
|
35
36
|
const {
|
|
37
|
+
internalMargin,
|
|
38
|
+
setBottomLabel,
|
|
36
39
|
innerHeight,
|
|
37
40
|
innerWidth,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = (0, import_react.useContext)(import_ChartContext.PieChartContext);
|
|
41
|
-
const pieData = data.reduce((acc, curr) => acc[curr.name] = curr.value, {});
|
|
41
|
+
props: { xAxis }
|
|
42
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
42
43
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
43
|
-
|
|
44
|
+
ref: setBottomLabel,
|
|
45
|
+
transform: `translate(${innerWidth / 2 + internalMargin.left},${innerHeight + internalMargin.top})`,
|
|
46
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxisLabel, {
|
|
47
|
+
className: "axis-label",
|
|
48
|
+
textAnchor: "middle",
|
|
49
|
+
dy: 35,
|
|
50
|
+
children: xAxis?.label
|
|
51
|
+
})
|
|
44
52
|
});
|
|
45
53
|
};
|
|
46
|
-
//# sourceMappingURL=
|
|
54
|
+
//# sourceMappingURL=BottomLabel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/graphs/Chart/parts/Labels/BottomLabel.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledAxisLabel } from '../../styles';\n\nexport const BottomLabel = () => {\n const {\n internalMargin,\n setBottomLabel,\n // leftLegend,\n innerHeight,\n innerWidth,\n props: { xAxis },\n } = useContext(ChartContext);\n\n return (\n <g\n ref={setBottomLabel}\n transform={`translate(${innerWidth / 2 + internalMargin.left},${innerHeight + internalMargin.top})`}\n >\n <StyledAxisLabel className=\"axis-label\" textAnchor=\"middle\" dy={35}>\n {xAxis?.label}\n </StyledAxisLabel>\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA2C;AAC3C,0BAA6B;AAC7B,oBAAgC;AAEzB,MAAM,cAAc,MAAM;AAC/B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM;AAAA,EACjB,QAAI,yBAAW,gCAAY;AAE3B,SACE,4CAAC;AAAA,IACC,KAAK;AAAA,IACL,WAAW,aAAa,aAAa,IAAI,eAAe,QAAQ,cAAc,eAAe;AAAA,IAE7F,sDAAC;AAAA,MAAgB,WAAU;AAAA,MAAa,YAAW;AAAA,MAAS,IAAI;AAAA,MAC7D,iBAAO;AAAA,KACV;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var Label_exports = {};
|
|
26
|
+
__export(Label_exports, {
|
|
27
|
+
Label: () => Label
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(Label_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_ChartContext = require("../../ChartContext");
|
|
34
|
+
var import_RightLabel = require("./RightLabel");
|
|
35
|
+
var import_LeftLabel = require("./LeftLabel");
|
|
36
|
+
var import_BottomLabel = require("./BottomLabel");
|
|
37
|
+
const Label = () => {
|
|
38
|
+
const {
|
|
39
|
+
props: { xAxis, yAxis, y2Axis }
|
|
40
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
41
|
+
return (0, import_react.useMemo)(
|
|
42
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
43
|
+
children: [
|
|
44
|
+
y2Axis?.label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_RightLabel.RightLabel, {}) : "",
|
|
45
|
+
yAxis?.label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LeftLabel.LeftLabel, {}) : "",
|
|
46
|
+
xAxis?.label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BottomLabel.BottomLabel, {}) : ""
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
[xAxis?.label, y2Axis?.label, yAxis?.label]
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/graphs/Chart/parts/Labels/Label.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\n\nimport { ChartContext } from '../../ChartContext';\nimport { RightLabel } from './RightLabel';\nimport { LeftLabel } from './LeftLabel';\nimport { BottomLabel } from './BottomLabel';\n\nexport const Label = () => {\n const {\n props: { xAxis, yAxis, y2Axis },\n } = useContext(ChartContext);\n\n return useMemo(\n () => (\n <g>\n {y2Axis?.label ? <RightLabel /> : ''}\n {yAxis?.label ? <LeftLabel /> : ''}\n {xAxis?.label ? <BottomLabel /> : ''}\n </g>\n ),\n [xAxis?.label, y2Axis?.label, yAxis?.label],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA2C;AAE3C,0BAA6B;AAC7B,wBAA2B;AAC3B,uBAA0B;AAC1B,yBAA4B;AAErB,MAAM,QAAQ,MAAM;AACzB,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,OAAO,OAAO;AAAA,EAChC,QAAI,yBAAW,gCAAY;AAE3B,aAAO;AAAA,IACL,MACE,6CAAC;AAAA,MACE;AAAA,gBAAQ,QAAQ,4CAAC,gCAAW,IAAK;AAAA,QACjC,OAAO,QAAQ,4CAAC,8BAAU,IAAK;AAAA,QAC/B,OAAO,QAAQ,4CAAC,kCAAY,IAAK;AAAA;AAAA,KACpC;AAAA,IAEF,CAAC,OAAO,OAAO,QAAQ,OAAO,OAAO,KAAK;AAAA,EAC5C;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var LeftLabel_exports = {};
|
|
26
|
+
__export(LeftLabel_exports, {
|
|
27
|
+
LeftLabel: () => LeftLabel
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(LeftLabel_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_ChartContext = require("../../ChartContext");
|
|
34
|
+
var import_styles = require("../../styles");
|
|
35
|
+
const LeftLabel = () => {
|
|
36
|
+
const {
|
|
37
|
+
innerHeight,
|
|
38
|
+
internalMargin,
|
|
39
|
+
setLeftLabel,
|
|
40
|
+
leftLegend,
|
|
41
|
+
props: { yAxis }
|
|
42
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
43
|
+
const leftMargin = (0, import_react.useMemo)(
|
|
44
|
+
() => leftLegend?.getBoundingClientRect().width ? leftLegend?.getBoundingClientRect().width + 15 : 8,
|
|
45
|
+
[leftLegend]
|
|
46
|
+
);
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
48
|
+
ref: setLeftLabel,
|
|
49
|
+
transform: `translate(${leftMargin},${innerHeight / 2 + internalMargin.top}) rotate(-90)`,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
52
|
+
height: "30",
|
|
53
|
+
width: "1",
|
|
54
|
+
fill: "transparent"
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxisLabel, {
|
|
57
|
+
className: "axis-label",
|
|
58
|
+
textAnchor: "middle",
|
|
59
|
+
dy: 15,
|
|
60
|
+
children: yAxis?.label
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=LeftLabel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/graphs/Chart/parts/Labels/LeftLabel.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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 leftLegend,\n props: { yAxis },\n } = useContext(ChartContext);\n\n const leftMargin = useMemo(\n () => (leftLegend?.getBoundingClientRect().width ? leftLegend?.getBoundingClientRect().width + 15 : 8),\n [leftLegend],\n );\n return (\n <g ref={setLeftLabel} transform={`translate(${leftMargin},${innerHeight / 2 + internalMargin.top}) rotate(-90)`}>\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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA2C;AAC3C,0BAA6B;AAC7B,oBAAgC;AAEzB,MAAM,YAAY,MAAM;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM;AAAA,EACjB,QAAI,yBAAW,gCAAY;AAE3B,QAAM,iBAAa;AAAA,IACjB,MAAO,YAAY,sBAAsB,EAAE,QAAQ,YAAY,sBAAsB,EAAE,QAAQ,KAAK;AAAA,IACpG,CAAC,UAAU;AAAA,EACb;AACA,SACE,6CAAC;AAAA,IAAE,KAAK;AAAA,IAAc,WAAW,aAAa,cAAc,cAAc,IAAI,eAAe;AAAA,IAC3F;AAAA,kDAAC;AAAA,QAAK,QAAO;AAAA,QAAK,OAAM;AAAA,QAAI,MAAK;AAAA,OAAc;AAAA,MAC/C,4CAAC;AAAA,QAAgB,WAAU;AAAA,QAAa,YAAW;AAAA,QAAS,IAAI;AAAA,QAC7D,iBAAO;AAAA,OACV;AAAA;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var RightLabel_exports = {};
|
|
26
|
+
__export(RightLabel_exports, {
|
|
27
|
+
RightLabel: () => RightLabel
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(RightLabel_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_ChartContext = require("../../ChartContext");
|
|
34
|
+
var import_styles = require("../../styles");
|
|
35
|
+
const RightLabel = () => {
|
|
36
|
+
const {
|
|
37
|
+
colorScale,
|
|
38
|
+
innerWidth,
|
|
39
|
+
innerHeight,
|
|
40
|
+
setInnerWidth,
|
|
41
|
+
internalMargin,
|
|
42
|
+
axisRightWidth,
|
|
43
|
+
setRightLabel,
|
|
44
|
+
props: { margin, y2Axis }
|
|
45
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
47
|
+
ref: setRightLabel,
|
|
48
|
+
transform: `translate(${innerWidth + internalMargin.left + axisRightWidth?.getBoundingClientRect().width},${innerHeight / 2 + internalMargin.top}) `,
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
51
|
+
width: "20",
|
|
52
|
+
height: 1,
|
|
53
|
+
fill: "transparent"
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
56
|
+
transform: " rotate(90)",
|
|
57
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxisLabel, {
|
|
58
|
+
className: "axis-label",
|
|
59
|
+
textAnchor: "middle",
|
|
60
|
+
dy: "-15",
|
|
61
|
+
children: y2Axis?.label
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=RightLabel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/graphs/Chart/parts/Labels/RightLabel.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useEffect, useRef, useState } from 'react';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledAxisLabel } from '../../styles';\n\nexport const RightLabel = () => {\n const {\n colorScale,\n innerWidth,\n innerHeight,\n setInnerWidth,\n internalMargin,\n axisRightWidth,\n setRightLabel,\n props: { margin, y2Axis },\n } = useContext(ChartContext);\n\n return (\n <g\n ref={setRightLabel}\n transform={`translate(${innerWidth + internalMargin.left + axisRightWidth?.getBoundingClientRect().width},${\n innerHeight / 2 + internalMargin.top\n }) `}\n >\n <rect width=\"20\" height={1} fill=\"transparent\" />\n <g transform=\" rotate(90)\">\n <StyledAxisLabel className=\"axis-label\" textAnchor=\"middle\" dy=\"-15\">\n {y2Axis?.label}\n </StyledAxisLabel>\n </g>\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA+D;AAC/D,0BAA6B;AAC7B,oBAAgC;AAEzB,MAAM,aAAa,MAAM;AAC9B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,QAAQ,OAAO;AAAA,EAC1B,QAAI,yBAAW,gCAAY;AAE3B,SACE,6CAAC;AAAA,IACC,KAAK;AAAA,IACL,WAAW,aAAa,aAAa,eAAe,OAAO,gBAAgB,sBAAsB,EAAE,SACjG,cAAc,IAAI,eAAe;AAAA,IAGnC;AAAA,kDAAC;AAAA,QAAK,OAAM;AAAA,QAAK,QAAQ;AAAA,QAAG,MAAK;AAAA,OAAc;AAAA,MAC/C,4CAAC;AAAA,QAAE,WAAU;AAAA,QACX,sDAAC;AAAA,UAAgB,WAAU;AAAA,UAAa,YAAW;AAAA,UAAS,IAAG;AAAA,UAC5D,kBAAQ;AAAA,SACX;AAAA,OACF;AAAA;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -32,43 +32,53 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
32
32
|
var import_react = require("react");
|
|
33
33
|
var import_d3 = require("d3");
|
|
34
34
|
var import_ChartContext = require("../../ChartContext");
|
|
35
|
+
var import_LegendItem = require("./LegendItem");
|
|
35
36
|
const BottomLegend = () => {
|
|
36
|
-
const {
|
|
37
|
-
colorScale,
|
|
38
|
-
innerWidth,
|
|
39
|
-
innerHeight,
|
|
40
|
-
internalMargin,
|
|
41
|
-
setBottomLegend,
|
|
42
|
-
props: { height }
|
|
43
|
-
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
37
|
+
const { colorScale, axisBottomHeight, innerWidth, innerHeight, bottomLabel, internalMargin, setBottomLegend } = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
44
38
|
const ref = (0, import_react.useRef)(null);
|
|
45
39
|
const firstRender = (0, import_react.useRef)(true);
|
|
46
40
|
const [xTransform, setXTransform] = (0, import_react.useState)(innerWidth / 2);
|
|
47
41
|
(0, import_react.useEffect)(() => {
|
|
48
42
|
if (ref.current && firstRender.current) {
|
|
49
43
|
const cells = (0, import_d3.selectAll)(".cell");
|
|
50
|
-
const padding =
|
|
44
|
+
const padding = 30;
|
|
51
45
|
let offset = 0;
|
|
46
|
+
let verticalOffset = 0;
|
|
52
47
|
cells.each((d, i) => {
|
|
53
48
|
if (cells._groups[0][i - 1]) {
|
|
54
49
|
const lastCell = (0, import_d3.select)(cells._groups[0][i - 1]);
|
|
55
50
|
const d3sel = (0, import_d3.select)(cells._groups[0][i]);
|
|
56
51
|
const { width } = lastCell.node().getBBox();
|
|
57
|
-
offset
|
|
58
|
-
|
|
52
|
+
if (offset + width + padding > innerWidth - innerWidth / 3) {
|
|
53
|
+
offset = 0;
|
|
54
|
+
verticalOffset += 20;
|
|
55
|
+
} else {
|
|
56
|
+
offset += width + padding;
|
|
57
|
+
}
|
|
58
|
+
d3sel.attr("transform", `translate(${offset}, ${verticalOffset})`);
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
const bounds = ref.current.getBoundingClientRect();
|
|
62
62
|
setXTransform((prev) => prev - bounds.width / 2);
|
|
63
63
|
firstRender.current = false;
|
|
64
64
|
}
|
|
65
|
-
}, []);
|
|
66
|
-
const
|
|
65
|
+
}, [innerWidth]);
|
|
66
|
+
const margin = (0, import_react.useMemo)(() => {
|
|
67
|
+
let counter = 0;
|
|
68
|
+
if (bottomLabel) {
|
|
69
|
+
counter += bottomLabel?.getBoundingClientRect().height + 25;
|
|
70
|
+
}
|
|
71
|
+
if (axisBottomHeight) {
|
|
72
|
+
counter += axisBottomHeight?.getBoundingClientRect().height;
|
|
73
|
+
}
|
|
74
|
+
return counter;
|
|
75
|
+
}, [bottomLabel, axisBottomHeight]);
|
|
76
|
+
return (0, import_react.useMemo)(
|
|
67
77
|
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
68
78
|
ref: setBottomLegend,
|
|
69
79
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
70
80
|
ref,
|
|
71
|
-
transform: `translate(${xTransform + internalMargin.left}, ${
|
|
81
|
+
transform: `translate(${xTransform + internalMargin.left}, ${innerHeight + internalMargin.top + margin})`,
|
|
72
82
|
className: "bottom-legend",
|
|
73
83
|
children: [
|
|
74
84
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
@@ -76,25 +86,13 @@ const BottomLegend = () => {
|
|
|
76
86
|
width: 1,
|
|
77
87
|
fill: "transparent"
|
|
78
88
|
}),
|
|
79
|
-
colorScale.domain().map((domainValue, i) => /* @__PURE__ */ (0, import_jsx_runtime.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", {
|
|
83
|
-
fill: colorScale(domainValue),
|
|
84
|
-
r: 4
|
|
85
|
-
}),
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("text", {
|
|
87
|
-
x: 10,
|
|
88
|
-
dy: ".32em",
|
|
89
|
-
children: domainValue
|
|
90
|
-
})
|
|
91
|
-
]
|
|
92
|
-
}))
|
|
89
|
+
colorScale.domain().map((domainValue, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LegendItem.LegendItem, {
|
|
90
|
+
domainValue
|
|
91
|
+
}, domainValue))
|
|
93
92
|
]
|
|
94
93
|
})
|
|
95
94
|
}),
|
|
96
|
-
[colorScale,
|
|
95
|
+
[colorScale, innerHeight, internalMargin.left, internalMargin.top, margin, setBottomLegend, xTransform]
|
|
97
96
|
);
|
|
98
|
-
return render;
|
|
99
97
|
};
|
|
100
98
|
//# sourceMappingURL=BottomLegend.js.map
|