@elliemae/ds-dataviz 3.6.0-next.3
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 +61 -0
- package/dist/cjs/graphs/Chart/Chart.js.map +7 -0
- package/dist/cjs/graphs/Chart/ChartContext.js +67 -0
- package/dist/cjs/graphs/Chart/ChartContext.js.map +7 -0
- package/dist/cjs/graphs/Chart/Pie.js +49 -0
- package/dist/cjs/graphs/Chart/Pie.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useChart.js +109 -0
- package/dist/cjs/graphs/Chart/config/useChart.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +119 -0
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useScales.js +107 -0
- package/dist/cjs/graphs/Chart/config/useScales.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/index.js +83 -0
- package/dist/cjs/graphs/Chart/helpers/index.js.map +7 -0
- package/dist/cjs/graphs/Chart/index.js +26 -0
- package/dist/cjs/graphs/Chart/index.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js +83 -0
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/AxisBottom.js +86 -0
- package/dist/cjs/graphs/Chart/parts/AxisBottom.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/AxisLeft.js +79 -0
- package/dist/cjs/graphs/Chart/parts/AxisLeft.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/AxisRight.js +63 -0
- package/dist/cjs/graphs/Chart/parts/AxisRight.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +78 -0
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/ColorLegend.js +70 -0
- package/dist/cjs/graphs/Chart/parts/ColorLegend.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js +116 -0
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Scrapper.js +130 -0
- package/dist/cjs/graphs/Chart/parts/Scrapper.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +82 -0
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/VerticalScrapper.js +138 -0
- package/dist/cjs/graphs/Chart/parts/VerticalScrapper.js.map +7 -0
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js +57 -0
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Area.js +73 -0
- package/dist/cjs/graphs/Chart/series/Area.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Bars.js +68 -0
- package/dist/cjs/graphs/Chart/series/Bars.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Line.js +70 -0
- package/dist/cjs/graphs/Chart/series/Line.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Pie.js +46 -0
- package/dist/cjs/graphs/Chart/series/Pie.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Point.js +67 -0
- package/dist/cjs/graphs/Chart/series/Point.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Points.js +84 -0
- package/dist/cjs/graphs/Chart/series/Points.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Rect.js +78 -0
- package/dist/cjs/graphs/Chart/series/Rect.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/StackedBar.js +66 -0
- package/dist/cjs/graphs/Chart/series/StackedBar.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/index.js +32 -0
- package/dist/cjs/graphs/Chart/series/index.js.map +7 -0
- package/dist/cjs/graphs/Chart/styles.js +123 -0
- package/dist/cjs/graphs/Chart/styles.js.map +7 -0
- package/dist/cjs/graphs/constants.js +37 -0
- package/dist/cjs/graphs/constants.js.map +7 -0
- package/dist/cjs/graphs/index.js +27 -0
- package/dist/cjs/graphs/index.js.map +7 -0
- package/dist/cjs/index.js +33 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/graphs/Chart/Chart.js +35 -0
- package/dist/esm/graphs/Chart/Chart.js.map +7 -0
- package/dist/esm/graphs/Chart/ChartContext.js +41 -0
- package/dist/esm/graphs/Chart/ChartContext.js.map +7 -0
- package/dist/esm/graphs/Chart/Pie.js +23 -0
- package/dist/esm/graphs/Chart/Pie.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useChart.js +83 -0
- package/dist/esm/graphs/Chart/config/useChart.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +93 -0
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useScales.js +81 -0
- package/dist/esm/graphs/Chart/config/useScales.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/index.js +57 -0
- package/dist/esm/graphs/Chart/helpers/index.js.map +7 -0
- package/dist/esm/graphs/Chart/index.js +3 -0
- package/dist/esm/graphs/Chart/index.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/ActivePoint.js +57 -0
- package/dist/esm/graphs/Chart/parts/ActivePoint.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/AxisBottom.js +60 -0
- package/dist/esm/graphs/Chart/parts/AxisBottom.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/AxisLeft.js +53 -0
- package/dist/esm/graphs/Chart/parts/AxisLeft.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/AxisRight.js +37 -0
- package/dist/esm/graphs/Chart/parts/AxisRight.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +52 -0
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/ColorLegend.js +44 -0
- package/dist/esm/graphs/Chart/parts/ColorLegend.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js +90 -0
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Scrapper.js +104 -0
- package/dist/esm/graphs/Chart/parts/Scrapper.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js +56 -0
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/VerticalScrapper.js +112 -0
- package/dist/esm/graphs/Chart/parts/VerticalScrapper.js.map +7 -0
- package/dist/esm/graphs/Chart/react-desc-prop-types.js +31 -0
- package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Area.js +47 -0
- package/dist/esm/graphs/Chart/series/Area.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Bars.js +42 -0
- package/dist/esm/graphs/Chart/series/Bars.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Line.js +44 -0
- package/dist/esm/graphs/Chart/series/Line.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Pie.js +20 -0
- package/dist/esm/graphs/Chart/series/Pie.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Point.js +41 -0
- package/dist/esm/graphs/Chart/series/Point.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Points.js +58 -0
- package/dist/esm/graphs/Chart/series/Points.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Rect.js +52 -0
- package/dist/esm/graphs/Chart/series/Rect.js.map +7 -0
- package/dist/esm/graphs/Chart/series/StackedBar.js +40 -0
- package/dist/esm/graphs/Chart/series/StackedBar.js.map +7 -0
- package/dist/esm/graphs/Chart/series/index.js +9 -0
- package/dist/esm/graphs/Chart/series/index.js.map +7 -0
- package/dist/esm/graphs/Chart/styles.js +97 -0
- package/dist/esm/graphs/Chart/styles.js.map +7 -0
- package/dist/esm/graphs/constants.js +11 -0
- package/dist/esm/graphs/constants.js.map +7 -0
- package/dist/esm/graphs/index.js +4 -0
- package/dist/esm/graphs/index.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/package.json +76 -0
|
@@ -0,0 +1,83 @@
|
|
|
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 helpers_exports = {};
|
|
26
|
+
__export(helpers_exports, {
|
|
27
|
+
getSeriesValuesAt: () => getSeriesValuesAt,
|
|
28
|
+
getStackedData: () => getStackedData,
|
|
29
|
+
getStackedIndex: () => getStackedIndex,
|
|
30
|
+
stackData: () => stackData
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_d3 = require("d3");
|
|
35
|
+
const getStackedIndex = (groups, serie) => {
|
|
36
|
+
for (let i = 0; i < groups.length; i += 1) {
|
|
37
|
+
for (let j = 0; j < groups[i].length; j += 1) {
|
|
38
|
+
if (groups[i][j] === serie)
|
|
39
|
+
return i;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return -1;
|
|
43
|
+
};
|
|
44
|
+
const getStackedData = (stackedData, serie) => {
|
|
45
|
+
for (let i = 0; i < stackedData?.length; i += 1) {
|
|
46
|
+
const data = stackedData[i].find((d) => d.key === serie.name);
|
|
47
|
+
if (data)
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
};
|
|
52
|
+
const stackData = (groupsStacked, series) => {
|
|
53
|
+
const aux = [];
|
|
54
|
+
if (!groupsStacked)
|
|
55
|
+
return [];
|
|
56
|
+
groupsStacked?.forEach((g) => {
|
|
57
|
+
const seriesStacked = series.filter((serie) => g.includes(serie.name));
|
|
58
|
+
const keys = seriesStacked.map((serie) => serie.name);
|
|
59
|
+
const stackData2 = [];
|
|
60
|
+
seriesStacked.forEach((serie) => {
|
|
61
|
+
serie.data.forEach((d, i) => {
|
|
62
|
+
if (typeof stackData2[i] === "object") {
|
|
63
|
+
stackData2[i][serie.name] = typeof d === "number" ? d : d.y;
|
|
64
|
+
}
|
|
65
|
+
stackData2[i] = { ...stackData2[i], [serie.name]: typeof d === "number" ? d : d.y };
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
aux.push((0, import_d3.stack)().keys(keys)(stackData2));
|
|
69
|
+
});
|
|
70
|
+
return aux;
|
|
71
|
+
};
|
|
72
|
+
const getSeriesValuesAt = (data, point) => {
|
|
73
|
+
const seriesValuesAtPoint = {};
|
|
74
|
+
data.forEach((serie) => {
|
|
75
|
+
serie.data.forEach((datum) => {
|
|
76
|
+
if (datum.value === point) {
|
|
77
|
+
seriesValuesAtPoint[serie.name] = seriesValuesAtPoint[serie.name] ? [...seriesValuesAtPoint[serie.name], point] : [point];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
return seriesValuesAtPoint;
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/graphs/Chart/helpers/index.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { stack } from 'd3';\nimport { values } from 'lodash';\n\nexport const getStackedIndex = (groups: string[][], serie: string) => {\n for (let i = 0; i < groups.length; i += 1) {\n for (let j = 0; j < groups[i].length; j += 1) {\n if (groups[i][j] === serie) return i;\n }\n }\n return -1;\n};\n\nexport const getStackedData = (stackedData, serie) => {\n for (let i = 0; i < stackedData?.length; i += 1) {\n const data = stackedData[i].find((d) => d.key === serie.name);\n if (data) return data;\n }\n return false;\n};\n\nexport const stackData = (groupsStacked, series) => {\n const aux = [];\n if (!groupsStacked) return [];\n groupsStacked?.forEach((g) => {\n const seriesStacked = series.filter((serie) => g.includes(serie.name));\n const keys = seriesStacked.map((serie) => serie.name);\n const stackData: Array<{ [key: string]: number }> = [];\n seriesStacked.forEach((serie) => {\n serie.data.forEach((d, i) => {\n if (typeof stackData[i] === 'object') {\n stackData[i][serie.name] = typeof d === 'number' ? d : d.y;\n }\n stackData[i] = { ...stackData[i], [serie.name]: typeof d === 'number' ? d : d.y };\n });\n });\n\n aux.push(stack().keys(keys)(stackData));\n });\n return aux;\n};\n\nexport const getSeriesValuesAt = (data, point) => {\n const seriesValuesAtPoint = {};\n data.forEach((serie) => {\n serie.data.forEach((datum) => {\n if (datum.value === point) {\n seriesValuesAtPoint[serie.name] = seriesValuesAtPoint[serie.name]\n ? [...seriesValuesAtPoint[serie.name], point]\n : [point];\n }\n });\n });\n return seriesValuesAtPoint;\n};\n", "import * as React from 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AI,SAAK,iBAAM,EAAE,KAAK,IAAI,EAAEA,UAAS,CAAC;AAAA,EACxC,CAAC;AACD,SAAO;AACT;AAEO,MAAM,oBAAoB,CAAC,MAAM,UAAU;AAChD,QAAM,sBAAsB,CAAC;AAC7B,OAAK,QAAQ,CAAC,UAAU;AACtB,UAAM,KAAK,QAAQ,CAAC,UAAU;AAC5B,UAAI,MAAM,UAAU,OAAO;AACzB,4BAAoB,MAAM,QAAQ,oBAAoB,MAAM,QACxD,CAAC,GAAG,oBAAoB,MAAM,OAAO,KAAK,IAC1C,CAAC,KAAK;AAAA,MACZ;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;",
|
|
6
|
+
"names": ["stackData"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
19
|
+
mod
|
|
20
|
+
));
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var Chart_exports = {};
|
|
23
|
+
module.exports = __toCommonJS(Chart_exports);
|
|
24
|
+
var React = __toESM(require("react"));
|
|
25
|
+
__reExport(Chart_exports, require("./Chart"), module.exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/graphs/Chart/index.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './Chart';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAAc,oBAAd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 ActivePoint_exports = {};
|
|
26
|
+
__export(ActivePoint_exports, {
|
|
27
|
+
ActivePoint: () => ActivePoint
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(ActivePoint_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_series = require("../series");
|
|
35
|
+
var import_helpers = require("../helpers");
|
|
36
|
+
const ActivePoint = () => {
|
|
37
|
+
const {
|
|
38
|
+
props: { data, groups },
|
|
39
|
+
activePoint,
|
|
40
|
+
activeSerie
|
|
41
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
42
|
+
const lastActiveSerie = (0, import_react.useRef)(null);
|
|
43
|
+
const activeItem = (0, import_react.useMemo)(() => {
|
|
44
|
+
let item = null;
|
|
45
|
+
if (!activePoint && !activeSerie && lastActiveSerie.current) {
|
|
46
|
+
item = lastActiveSerie.current;
|
|
47
|
+
}
|
|
48
|
+
if (activeSerie) {
|
|
49
|
+
item = data.find((serie) => serie.key === activeSerie);
|
|
50
|
+
lastActiveSerie.current = item;
|
|
51
|
+
} else if (activePoint) {
|
|
52
|
+
item = data.find((serie) => serie.data.some((value) => activePoint === value.key));
|
|
53
|
+
lastActiveSerie.current = item;
|
|
54
|
+
} else if (!lastActiveSerie.current) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (item.type === "bar" && groups && (0, import_helpers.getStackedIndex)(groups, item.name) > -1) {
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.StackedBar, {
|
|
59
|
+
serie: item
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (item.type === "bar") {
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.Bars, {
|
|
64
|
+
serie: item
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (item.type === "point") {
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.Points, {
|
|
69
|
+
serie: item
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (item.type === "line") {
|
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.Line, {
|
|
74
|
+
serie: item
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}, [activePoint, activeSerie, data, groups]);
|
|
78
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
79
|
+
className: "redraw",
|
|
80
|
+
children: activeItem
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=ActivePoint.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/graphs/Chart/parts/ActivePoint.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo, useRef } from 'react';\nimport { ChartContext } from '../ChartContext';\nimport { Line, Points, Bars, StackedBar } from '../series';\nimport { getStackedIndex } from '../helpers';\n\nexport const ActivePoint = () => {\n const {\n props: { data, groups },\n activePoint,\n activeSerie,\n } = useContext(ChartContext);\n\n const lastActiveSerie = useRef(null);\n const activeItem = useMemo(() => {\n let item = null;\n if (!activePoint && !activeSerie && lastActiveSerie.current) {\n item = lastActiveSerie.current;\n }\n if (activeSerie) {\n item = data.find((serie) => serie.key === activeSerie);\n lastActiveSerie.current = item;\n } else if (activePoint) {\n item = data.find((serie) => serie.data.some((value) => activePoint === value.key));\n lastActiveSerie.current = item;\n } else if (!lastActiveSerie.current) {\n return;\n }\n\n if (item.type === 'bar' && groups && getStackedIndex(groups, item.name) > -1) {\n return <StackedBar serie={item} />;\n }\n if (item.type === 'bar') {\n return <Bars serie={item} />;\n }\n if (item.type === 'point') {\n return <Points serie={item} />;\n }\n if (item.type === 'line') {\n return <Line serie={item} />;\n }\n }, [activePoint, activeSerie, data, groups]);\n\n return <g className=\"redraw\">{activeItem}</g>;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAGA,mBAAmD;AACnD,0BAA6B;AAC7B,oBAA+C;AAC/C,qBAAgC;AAEzB,MAAM,cAAc,MAAM;AAC/B,QAAM;AAAA,IACJ,OAAO,EAAE,MAAM,OAAO;AAAA,IACtB;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,QAAM,sBAAkB,qBAAO,IAAI;AACnC,QAAM,iBAAa,sBAAQ,MAAM;AAC/B,QAAI,OAAO;AACX,QAAI,CAAC,eAAe,CAAC,eAAe,gBAAgB,SAAS;AAC3D,aAAO,gBAAgB;AAAA,IACzB;AACA,QAAI,aAAa;AACf,aAAO,KAAK,KAAK,CAAC,UAAU,MAAM,QAAQ,WAAW;AACrD,sBAAgB,UAAU;AAAA,IAC5B,WAAW,aAAa;AACtB,aAAO,KAAK,KAAK,CAAC,UAAU,MAAM,KAAK,KAAK,CAAC,UAAU,gBAAgB,MAAM,GAAG,CAAC;AACjF,sBAAgB,UAAU;AAAA,IAC5B,WAAW,CAAC,gBAAgB,SAAS;AACnC;AAAA,IACF;AAEA,QAAI,KAAK,SAAS,SAAS,cAAU,gCAAgB,QAAQ,KAAK,IAAI,IAAI,IAAI;AAC5E,aAAO,4CAAC;AAAA,QAAW,OAAO;AAAA,OAAM;AAAA,IAClC;AACA,QAAI,KAAK,SAAS,OAAO;AACvB,aAAO,4CAAC;AAAA,QAAK,OAAO;AAAA,OAAM;AAAA,IAC5B;AACA,QAAI,KAAK,SAAS,SAAS;AACzB,aAAO,4CAAC;AAAA,QAAO,OAAO;AAAA,OAAM;AAAA,IAC9B;AACA,QAAI,KAAK,SAAS,QAAQ;AACxB,aAAO,4CAAC;AAAA,QAAK,OAAO;AAAA,OAAM;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,aAAa,aAAa,MAAM,MAAM,CAAC;AAE3C,SAAO,4CAAC;AAAA,IAAE,WAAU;AAAA,IAAU;AAAA,GAAW;AAC3C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
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 AxisBottom_exports = {};
|
|
26
|
+
__export(AxisBottom_exports, {
|
|
27
|
+
AxisBottom: () => AxisBottom
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(AxisBottom_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_d3 = require("d3");
|
|
34
|
+
var import_styles = require("../styles");
|
|
35
|
+
var import_ChartContext = require("../ChartContext");
|
|
36
|
+
const AxisBottom = () => {
|
|
37
|
+
const {
|
|
38
|
+
props: { xAxis, xAxisLabelOffset = 50, xAxisLabel },
|
|
39
|
+
innerHeight,
|
|
40
|
+
innerWidth,
|
|
41
|
+
xScale,
|
|
42
|
+
tickOffset = 3
|
|
43
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
44
|
+
const axisRef = (0, import_react.useRef)();
|
|
45
|
+
const gridRef = (0, import_react.useRef)();
|
|
46
|
+
const ticks = xScale.ticks?.();
|
|
47
|
+
(0, import_react.useEffect)(() => {
|
|
48
|
+
const grid = (0, import_d3.axisBottom)(xScale).tickSize(xAxis?.showGrid ? -innerHeight : 0).tickFormat("").tickSizeOuter(0);
|
|
49
|
+
const axis = (0, import_d3.axisBottom)(xScale);
|
|
50
|
+
if (xAxis.tickValues && ticks) {
|
|
51
|
+
console.log(ticks, "ticks");
|
|
52
|
+
const finalTicks = xAxis.overwriteTicks ? xAxis.tickValues : [...ticks, ...xAxis.tickValues];
|
|
53
|
+
axis.tickValues(finalTicks);
|
|
54
|
+
}
|
|
55
|
+
if (xAxis.tickFormat) {
|
|
56
|
+
if (typeof xAxis.tickFormat === "string") {
|
|
57
|
+
const formatGenerator = (0, import_d3.timeFormat)(xAxis.tickFormat);
|
|
58
|
+
axis.tickFormat((d) => formatGenerator(d));
|
|
59
|
+
}
|
|
60
|
+
if (typeof xAxis.tickFormat === "function") {
|
|
61
|
+
axis.tickFormat(xAxis.tickFormat);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
(0, import_d3.select)(gridRef.current).call(grid);
|
|
65
|
+
(0, import_d3.select)(axisRef.current).call(axis);
|
|
66
|
+
}, [innerHeight, ticks, xAxis?.showGrid, xAxis.tickFormat, xAxis.tickValues, xScale]);
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
68
|
+
transform: `translate(0,${innerHeight})`,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxis, {
|
|
71
|
+
ref: axisRef,
|
|
72
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("text", {
|
|
73
|
+
className: "axis-label",
|
|
74
|
+
x: innerWidth / 2,
|
|
75
|
+
y: xAxisLabelOffset,
|
|
76
|
+
textAnchor: "middle",
|
|
77
|
+
children: xAxis.label
|
|
78
|
+
})
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledGrid, {
|
|
81
|
+
ref: gridRef
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=AxisBottom.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/graphs/Chart/parts/AxisBottom.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useEffect, useRef } from 'react';\nimport { select, axisBottom, timeFormat } from 'd3';\nimport { StyledAxis, StyledGrid } from '../styles';\nimport { ChartContext } from '../ChartContext';\n\nexport const AxisBottom = () => {\n const {\n props: { xAxis, xAxisLabelOffset = 50, xAxisLabel },\n innerHeight,\n innerWidth,\n xScale,\n tickOffset = 3,\n } = useContext(ChartContext);\n\n const axisRef = useRef();\n const gridRef = useRef();\n const ticks = xScale.ticks?.();\n useEffect(() => {\n const grid = axisBottom(xScale)\n .tickSize(xAxis?.showGrid ? -innerHeight : 0)\n .tickFormat('')\n .tickSizeOuter(0);\n\n const axis = axisBottom(xScale);\n\n if (xAxis.tickValues && ticks) {\n console.log(ticks, 'ticks');\n const finalTicks = xAxis.overwriteTicks ? xAxis.tickValues : [...ticks, ...xAxis.tickValues];\n axis.tickValues(finalTicks);\n }\n\n if (xAxis.tickFormat) {\n if (typeof xAxis.tickFormat === 'string') {\n const formatGenerator = timeFormat(xAxis.tickFormat);\n axis.tickFormat((d) => formatGenerator(d));\n }\n if (typeof xAxis.tickFormat === 'function') {\n axis.tickFormat(xAxis.tickFormat);\n }\n }\n\n select(gridRef.current).call(grid);\n select(axisRef.current).call(axis);\n }, [innerHeight, ticks, xAxis?.showGrid, xAxis.tickFormat, xAxis.tickValues, xScale]);\n\n return (\n <g transform={`translate(0,${innerHeight})`}>\n <StyledAxis ref={axisRef}>\n <text className=\"axis-label\" x={innerWidth / 2} y={xAxisLabelOffset} textAnchor=\"middle\">\n {xAxis.label}\n </text>\n </StyledAxis>\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,mBAAqD;AACrD,gBAA+C;AAC/C,oBAAuC;AACvC,0BAA6B;AAEtB,MAAM,aAAa,MAAM;AAC9B,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,mBAAmB,IAAI,WAAW;AAAA,IAClD;AAAA,IACA;AAAA,IACA;AAAA,I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
|
|
@@ -0,0 +1,79 @@
|
|
|
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 AxisLeft_exports = {};
|
|
26
|
+
__export(AxisLeft_exports, {
|
|
27
|
+
AxisLeft: () => AxisLeft
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(AxisLeft_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_d3 = require("d3");
|
|
34
|
+
var import_styles = require("../styles");
|
|
35
|
+
var import_ChartContext = require("../ChartContext");
|
|
36
|
+
const AxisLeft = () => {
|
|
37
|
+
const {
|
|
38
|
+
props: { yAxis, yAxisLabelOffset = 45, yAxisLabel },
|
|
39
|
+
innerHeight,
|
|
40
|
+
innerWidth,
|
|
41
|
+
yScale
|
|
42
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
43
|
+
const ref = (0, import_react.useRef)();
|
|
44
|
+
const gridRef = (0, import_react.useRef)();
|
|
45
|
+
const ticks = yScale.ticks?.();
|
|
46
|
+
(0, import_react.useEffect)(() => {
|
|
47
|
+
const axis = (0, import_d3.axisLeft)(yScale);
|
|
48
|
+
if (yAxis.tickValues && ticks) {
|
|
49
|
+
console.log(ticks, "ticks");
|
|
50
|
+
const finalTicks = yAxis.overwriteTicks ? yAxis.tickValues : [...ticks, ...yAxis.tickValues];
|
|
51
|
+
axis.tickValues(finalTicks);
|
|
52
|
+
}
|
|
53
|
+
if (yAxis.tickFormat) {
|
|
54
|
+
axis.tickFormat(yAxis.tickFormat);
|
|
55
|
+
}
|
|
56
|
+
const grid = (0, import_d3.axisLeft)(yScale).tickFormat("").tickSize(yAxis?.showGrid ? -innerWidth : 0).tickSizeOuter(0);
|
|
57
|
+
(0, import_d3.select)(ref.current).call(axis);
|
|
58
|
+
(0, import_d3.select)(gridRef.current).call(grid);
|
|
59
|
+
}, [innerWidth, ticks, yAxis.overwriteTicks, yAxis?.showGrid, yAxis.tickFormat, yAxis.tickValues, yScale]);
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxis, {
|
|
63
|
+
ref,
|
|
64
|
+
color: yAxis.color,
|
|
65
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("text", {
|
|
66
|
+
className: "axis-label",
|
|
67
|
+
textAnchor: "middle",
|
|
68
|
+
transform: `translate(${-yAxisLabelOffset},${innerHeight / 2}) rotate(-90)`,
|
|
69
|
+
children: yAxis?.label
|
|
70
|
+
})
|
|
71
|
+
}),
|
|
72
|
+
" ",
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledGrid, {
|
|
74
|
+
ref: gridRef
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=AxisLeft.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/graphs/Chart/parts/AxisLeft.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useEffect, useRef } from 'react';\nimport { select, axisLeft } from 'd3';\nimport { StyledAxis, StyledGrid } from '../styles';\nimport { ChartContext } from '../ChartContext';\n\nexport const AxisLeft = () => {\n const {\n props: { yAxis, yAxisLabelOffset = 45, yAxisLabel },\n innerHeight,\n innerWidth,\n yScale,\n } = useContext(ChartContext);\n\n const ref = useRef();\n const gridRef = useRef();\n const ticks = yScale.ticks?.();\n\n useEffect(() => {\n const axis = axisLeft(yScale);\n\n if (yAxis.tickValues && ticks) {\n console.log(ticks, 'ticks');\n const finalTicks = yAxis.overwriteTicks ? yAxis.tickValues : [...ticks, ...yAxis.tickValues];\n axis.tickValues(finalTicks);\n }\n\n if (yAxis.tickFormat) {\n axis.tickFormat(yAxis.tickFormat);\n }\n\n const grid = axisLeft(yScale)\n .tickFormat('')\n .tickSize(yAxis?.showGrid ? -innerWidth : 0)\n .tickSizeOuter(0);\n\n select(ref.current).call(axis);\n select(gridRef.current).call(grid);\n }, [innerWidth, ticks, yAxis.overwriteTicks, yAxis?.showGrid, yAxis.tickFormat, yAxis.tickValues, yScale]);\n return (\n <g>\n <StyledAxis ref={ref} color={yAxis.color}>\n <text\n className=\"axis-label\"\n textAnchor=\"middle\"\n transform={`translate(${-yAxisLabelOffset},${innerHeight / 2}) rotate(-90)`}\n >\n {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AA,UACX,WAAW,aAAa,CAAC,oBAAoB,cAAc;AAAA,UAE1D,iBAAO;AAAA,SACV;AAAA,OACF;AAAA,MAAc;AAAA,MACd,4CAAC;AAAA,QAAW,KAAK;AAAA,OAAS;AAAA;AAAA,GAC5B;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 AxisRight_exports = {};
|
|
26
|
+
__export(AxisRight_exports, {
|
|
27
|
+
AxisRight: () => AxisRight
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(AxisRight_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_d3 = require("d3");
|
|
34
|
+
var import_styles = require("../styles");
|
|
35
|
+
var import_ChartContext = require("../ChartContext");
|
|
36
|
+
const AxisRight = () => {
|
|
37
|
+
const {
|
|
38
|
+
props: { y2Axis, yAxisLabelOffset = 45, y2AxisLabel },
|
|
39
|
+
innerHeight,
|
|
40
|
+
innerWidth,
|
|
41
|
+
y2Scale
|
|
42
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
43
|
+
if (!y2Axis)
|
|
44
|
+
return null;
|
|
45
|
+
const ref = (0, import_react.useRef)();
|
|
46
|
+
(0, import_react.useEffect)(() => {
|
|
47
|
+
const axis = (0, import_d3.axisRight)(y2Scale).tickSizeOuter(0);
|
|
48
|
+
(0, import_d3.select)(ref.current).call(axis);
|
|
49
|
+
}, [innerWidth, y2Scale]);
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
51
|
+
transform: `translate(${innerWidth},0)`,
|
|
52
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxis, {
|
|
53
|
+
ref,
|
|
54
|
+
color: y2Axis.color,
|
|
55
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("text", {
|
|
56
|
+
className: "axis-label",
|
|
57
|
+
textAnchor: "middle",
|
|
58
|
+
transform: `translate(${-yAxisLabelOffset},${innerHeight / 2}) rotate(-90)`
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=AxisRight.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/graphs/Chart/parts/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';\n\nexport const AxisRight = () => {\n const {\n props: { y2Axis, yAxisLabelOffset = 45, y2AxisLabel },\n innerHeight,\n innerWidth,\n y2Scale,\n } = useContext(ChartContext);\n\n if (!y2Axis) return null;\n const ref = useRef();\n useEffect(() => {\n const axis = axisRight(y2Scale).tickSizeOuter(0);\n\n select(ref.current).call(axis);\n }, [innerWidth, y2Scale]);\n return (\n <g transform={`translate(${innerWidth},0)`}>\n <StyledAxis ref={ref} color={y2Axis.color}>\n <text\n className=\"axis-label\"\n textAnchor=\"middle\"\n transform={`translate(${-yAxisLabelOffset},${innerHeight / 2}) rotate(-90)`}\n >\n {/* {y2Axis?.label} */}\n </text>\n </StyledAxis>\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAqD;AACrD,gBAAkC;AAClC,oBAA2B;AAC3B,0BAA6B;AAEtB,MAAM,YAAY,MAAM;AAC7B,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ,mBAAmB,IAAI,YAAY;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,MAAI,CAAC;AAAQ,WAAO;AACpB,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;AACxB,SACE,4CAAC;AAAA,IAAE,WAAW,aAAa;AAAA,IACzB,sDAAC;AAAA,MAAW;AAAA,MAAU,OAAO,OAAO;AAAA,MAClC,sDAAC;AAAA,QACC,WAAU;AAAA,QACV,YAAW;AAAA,QACX,WAAW,aAAa,CAAC,oBAAoB,cAAc;AAAA,OAG7D;AAAA,KACF;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 ChartContainer_exports = {};
|
|
26
|
+
__export(ChartContainer_exports, {
|
|
27
|
+
ChartContainer: () => ChartContainer
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(ChartContainer_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_styles = require("../styles");
|
|
34
|
+
var import_ChartContext = require("../ChartContext");
|
|
35
|
+
var import_useKeyboardNavigation = require("../config/useKeyboardNavigation");
|
|
36
|
+
const ChartContainer = ({ children }) => {
|
|
37
|
+
const {
|
|
38
|
+
props: { width, height, margin, responsive },
|
|
39
|
+
containerRef,
|
|
40
|
+
activePoint,
|
|
41
|
+
setScrapperPosY,
|
|
42
|
+
setScrapperPosX,
|
|
43
|
+
svgRef
|
|
44
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
45
|
+
const dimensions = (0, import_react.useMemo)(
|
|
46
|
+
() => responsive ? {
|
|
47
|
+
viewBox: `0 0 ${width} ${height}`
|
|
48
|
+
} : {
|
|
49
|
+
width,
|
|
50
|
+
height
|
|
51
|
+
},
|
|
52
|
+
[height, responsive, width]
|
|
53
|
+
);
|
|
54
|
+
const { onInputKeyDown, handleOnBlur, handleOnFocus } = (0, import_useKeyboardNavigation.useKeyboardNavigation)();
|
|
55
|
+
const onMouseLeaveHandler = (0, import_react.useCallback)(() => {
|
|
56
|
+
setScrapperPosY("");
|
|
57
|
+
setScrapperPosX("");
|
|
58
|
+
}, [setScrapperPosX, setScrapperPosY]);
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledSVGWrapper, {
|
|
60
|
+
ref: containerRef,
|
|
61
|
+
onKeyDown: onInputKeyDown,
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
tabIndex: activePoint ? -1 : 0,
|
|
64
|
+
onBlur: handleOnBlur,
|
|
65
|
+
onFocus: handleOnFocus,
|
|
66
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
67
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
|
|
68
|
+
ref: svgRef,
|
|
69
|
+
...dimensions,
|
|
70
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
71
|
+
className: "container",
|
|
72
|
+
transform: `translate(${margin.left},${margin.top})`,
|
|
73
|
+
children
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=ChartContainer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/graphs/Chart/parts/ChartContainer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useCallback, useMemo } from 'react';\nimport { StyledSVGWrapper } from '../styles';\n\nimport { ChartContext } from '../ChartContext';\nimport { useKeyboardNavigation } from '../config/useKeyboardNavigation';\ninterface ChartContainerT {\n children: JSX.Element | JSX.Element[] | string | string[];\n}\nexport const ChartContainer: React.ComponentType<ChartContainerT> = ({ children }) => {\n const {\n props: { width, height, margin, responsive },\n containerRef,\n activePoint,\n setScrapperPosY,\n setScrapperPosX,\n svgRef,\n } = useContext(ChartContext);\n\n const dimensions = useMemo(\n () =>\n responsive\n ? {\n viewBox: `0 0 ${width} ${height}`,\n }\n : {\n width,\n height,\n },\n [height, responsive, width],\n );\n const { onInputKeyDown, handleOnBlur, handleOnFocus } = useKeyboardNavigation();\n\n const onMouseLeaveHandler = useCallback(() => {\n setScrapperPosY('');\n setScrapperPosX('');\n }, [setScrapperPosX, setScrapperPosY]);\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 // onMouseDown={(e) => e.preventDefault()}\n onMouseLeave={onMouseLeaveHandler}\n >\n <svg ref={svgRef} {...dimensions}>\n <g className=\"container\" transform={`translate(${margin.left},${margin.top})`}>\n {children}\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,mBAAwD;AACxD,oBAAiC;AAEjC,0BAA6B;AAC7B,mCAAsC;AAI/B,MAAM,iBAAuD,CAAC,EAAE,SAAS,MAAM;AACpF,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,QAAQ,QAAQ,WAAW;AAAA,IAC3C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,QAAM,iBAAa;AAAA,IACjB,MACE,aACI;AAAA,MACE,SAAS,OAAO,SAAS;AAAA,IAC3B,IACA;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,IACN,CAAC,QAAQ,YAAY,KAAK;AAAA,EAC5B;AACA,QAAM,EAAE,gBAAgB,cAAc,cAAc,QAAI,oDAAsB;AAE9E,QAAM,0BAAsB,0BAAY,MAAM;AAC5C,oBAAgB,EAAE;AAClB,oBAAgB,EAAE;AAAA,EACpB,GAAG,CAAC,iBAAiB,eAAe,CAAC;AAErC,SACE,4CAAC;AAAA,IACC,KAAK;AAAA,IACL,WAAW;AAAA,IACX,eAAY;AAAA,IACZ,UAAU,cAAc,KAAK;AAAA,IAC7B,QAAQ;AAAA,IACR,SAAS;AAAA,IAET,cAAc;AAAA,IAEd,sDAAC;AAAA,MAAI,KAAK;AAAA,MAAS,GAAG;AAAA,MACpB,sDAAC;AAAA,QAAE,WAAU;AAAA,QAAY,WAAW,aAAa,OAAO,QAAQ,OAAO;AAAA,QACpE;AAAA,OACH;AAAA,KACF;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|