@elliemae/ds-dataviz 3.8.0-rc.3 → 3.8.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/Pie.js +49 -0
- package/dist/cjs/graphs/Chart/Pie.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/ColorLegend.js +70 -0
- package/dist/cjs/graphs/Chart/parts/ColorLegend.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/VerticalScrapper.js +138 -0
- package/dist/cjs/graphs/Chart/parts/VerticalScrapper.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/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/ColorLegend.js +44 -0
- package/dist/esm/graphs/Chart/parts/ColorLegend.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/VerticalScrapper.js +112 -0
- package/dist/esm/graphs/Chart/parts/VerticalScrapper.js.map +7 -0
- package/package.json +8 -8
|
@@ -0,0 +1,49 @@
|
|
|
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 Pie_exports = {};
|
|
26
|
+
__export(Pie_exports, {
|
|
27
|
+
PieChart: () => PieChart
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(Pie_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_ChartContainer = require("./parts/ChartContainer");
|
|
33
|
+
var import_series = require("./series");
|
|
34
|
+
var import_ChartContext = require("./ChartContext");
|
|
35
|
+
var import_usePie = require("./config/usePie");
|
|
36
|
+
var import_ColorLegend = require("./parts/ColorLegend");
|
|
37
|
+
const PieChart = (props) => {
|
|
38
|
+
const ctx = (0, import_usePie.usePie)(props);
|
|
39
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ChartContext.PieChartContext.Provider, {
|
|
40
|
+
value: ctx,
|
|
41
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ChartContainer.ChartContainer, {
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ColorLegend.ColorLegend, {}),
|
|
44
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.Pie, {})
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=Pie.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/graphs/Chart/Pie.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { ChartContainer } from './parts/ChartContainer';\nimport { Pie } from './series';\nimport { PieChartContext } from './ChartContext';\nimport { usePie } from './config/usePie';\nimport type { DSPieT } from './react-desc-prop-types';\nimport { ColorLegend } from './parts/ColorLegend';\nexport const PieChart: React.ComponentType<DSPieT.Props> = (props) => {\n const ctx = usePie(props);\n return (\n <PieChartContext.Provider value={ctx}>\n <ChartContainer>\n <ColorLegend />\n <Pie />\n </ChartContainer>\n </PieChartContext.Provider>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,4BAA+B;AAC/B,oBAAoB;AACpB,0BAAgC;AAChC,oBAAuB;AAEvB,yBAA4B;AACrB,MAAM,WAA8C,CAAC,UAAU;AACpE,QAAM,UAAM,sBAAO,KAAK;AACxB,SACE,4CAAC,oCAAgB,UAAhB;AAAA,IAAyB,OAAO;AAAA,IAC/B,uDAAC;AAAA,MACC;AAAA,oDAAC,kCAAY;AAAA,QACb,4CAAC,qBAAI;AAAA;AAAA,KACP;AAAA,GACF;AAEJ;",
|
|
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,IACA,aAAa;AAAA,EACf,QAAI,yBAAW,gCAAY;AAE3B,QAAM,cAAU,qBAAO;AACvB,QAAM,cAAU,qBAAO;AACvB,QAAM,QAAQ,OAAO,QAAQ;AAC7B,8BAAU,MAAM;AACd,UAAM,WAAO,sBAAW,MAAM,EAC3B,SAAS,OAAO,WAAW,CAAC,cAAc,CAAC,EAC3C,WAAW,EAAE,EACb,cAAc,CAAC;AAElB,UAAM,WAAO,sBAAW,MAAM;AAE9B,QAAI,MAAM,cAAc,OAAO;AAC7B,cAAQ,IAAI,OAAO,OAAO;AAC1B,YAAM,aAAa,MAAM,iBAAiB,MAAM,aAAa,CAAC,GAAG,OAAO,GAAG,MAAM,UAAU;AAC3F,WAAK,WAAW,UAAU;AAAA,IAC5B;AAEA,QAAI,MAAM,YAAY;AACpB,UAAI,OAAO,MAAM,eAAe,UAAU;AACxC,cAAM,sBAAkB,sBAAW,MAAM,UAAU;AACnD,aAAK,WAAW,CAAC,MAAM,gBAAgB,CAAC,CAAC;AAAA,MAC3C;AACA,UAAI,OAAO,MAAM,eAAe,YAAY;AAC1C,aAAK,WAAW,MAAM,UAAU;AAAA,MAClC;AAAA,IACF;AAEA,0BAAO,QAAQ,OAAO,EAAE,KAAK,IAAI;AACjC,0BAAO,QAAQ,OAAO,EAAE,KAAK,IAAI;AAAA,EACnC,GAAG,CAAC,aAAa,OAAO,OAAO,UAAU,MAAM,YAAY,MAAM,YAAY,MAAM,CAAC;AAEpF,SACE,6CAAC;AAAA,IAAE,WAAW,eAAe;AAAA,IAC3B;AAAA,kDAAC;AAAA,QAAW,KAAK;AAAA,QACf,sDAAC;AAAA,UAAK,WAAU;AAAA,UAAa,GAAG,aAAa;AAAA,UAAG,GAAG;AAAA,UAAkB,YAAW;AAAA,UAC7E,gBAAM;AAAA,SACT;AAAA,OACF;AAAA,MACA,4CAAC;AAAA,QAAW,KAAK;AAAA,OAAS;AAAA;AAAA,GAC5B;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -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 {yAxis?.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,gBAAiC;AACjC,oBAAu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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,70 @@
|
|
|
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 ColorLegend_exports = {};
|
|
26
|
+
__export(ColorLegend_exports, {
|
|
27
|
+
ColorLegend: () => ColorLegend
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(ColorLegend_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
|
+
const ColorLegend = ({ tickSpacing = 20, tickSize = 5, tickTextOffset = 20 }) => {
|
|
35
|
+
const {
|
|
36
|
+
colorScale,
|
|
37
|
+
innerWidth,
|
|
38
|
+
props: { colorLegend }
|
|
39
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
40
|
+
if (!colorLegend)
|
|
41
|
+
return null;
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
43
|
+
transform: `translate(${innerWidth + 30},30)`,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("text", {
|
|
46
|
+
x: 35,
|
|
47
|
+
y: -25,
|
|
48
|
+
className: "axis-label",
|
|
49
|
+
textAnchor: "middle",
|
|
50
|
+
children: colorLegend.label
|
|
51
|
+
}),
|
|
52
|
+
colorScale.domain().map((domainValue, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
53
|
+
className: "tick",
|
|
54
|
+
transform: `translate(0,${i * tickSpacing})`,
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", {
|
|
57
|
+
fill: colorScale(domainValue),
|
|
58
|
+
r: 4
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("text", {
|
|
61
|
+
x: tickTextOffset,
|
|
62
|
+
dy: ".32em",
|
|
63
|
+
children: domainValue
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
}))
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=ColorLegend.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/graphs/Chart/parts/ColorLegend.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { ChartContext } from '../ChartContext';\n\nexport const ColorLegend = ({ tickSpacing = 20, tickSize = 5, tickTextOffset = 20 }) => {\n const {\n colorScale,\n innerWidth,\n props: { colorLegend },\n } = useContext(ChartContext);\n\n if (!colorLegend) return null;\n return (\n <g transform={`translate(${innerWidth + 30},30)`}>\n <text x={35} y={-25} className=\"axis-label\" textAnchor=\"middle\">\n {colorLegend.label}\n </text>\n {colorScale.domain().map((domainValue, i) => (\n <g className=\"tick\" transform={`translate(0,${i * tickSpacing})`}>\n <circle fill={colorScale(domainValue)} r={4} />\n <text x={tickTextOffset} dy=\".32em\">\n {domainValue}\n </text>\n </g>\n ))}\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkC;AAClC,0BAA6B;AAEtB,MAAM,cAAc,CAAC,EAAE,cAAc,IAAI,WAAW,GAAG,iBAAiB,GAAG,MAAM;AACtF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO,EAAE,YAAY;AAAA,EACvB,QAAI,yBAAW,gCAAY;AAE3B,MAAI,CAAC;AAAa,WAAO;AACzB,SACE,6CAAC;AAAA,IAAE,WAAW,aAAa,aAAa;AAAA,IACtC;AAAA,kDAAC;AAAA,QAAK,GAAG;AAAA,QAAI,GAAG;AAAA,QAAK,WAAU;AAAA,QAAa,YAAW;AAAA,QACpD,sBAAY;AAAA,OACf;AAAA,MACC,WAAW,OAAO,EAAE,IAAI,CAAC,aAAa,MACrC,6CAAC;AAAA,QAAE,WAAU;AAAA,QAAO,WAAW,eAAe,IAAI;AAAA,QAChD;AAAA,sDAAC;AAAA,YAAO,MAAM,WAAW,WAAW;AAAA,YAAG,GAAG;AAAA,WAAG;AAAA,UAC7C,4CAAC;AAAA,YAAK,GAAG;AAAA,YAAgB,IAAG;AAAA,YACzB;AAAA,WACH;AAAA;AAAA,OACF,CACD;AAAA;AAAA,GACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
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 Scrapper_exports = {};
|
|
26
|
+
__export(Scrapper_exports, {
|
|
27
|
+
Scrapper: () => Scrapper
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(Scrapper_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_ds_popperjs = require("@elliemae/ds-popperjs");
|
|
34
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
35
|
+
var import_ChartContext = require("../ChartContext");
|
|
36
|
+
var import_styles = require("../styles");
|
|
37
|
+
const Scrapper = () => {
|
|
38
|
+
const {
|
|
39
|
+
yScale,
|
|
40
|
+
y2Scale,
|
|
41
|
+
scrapperPosY,
|
|
42
|
+
setScrapperPosY,
|
|
43
|
+
xScale,
|
|
44
|
+
innerHeight,
|
|
45
|
+
innerWidth,
|
|
46
|
+
props: { TooltipRenderer, xAxis, data, scrapper }
|
|
47
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
48
|
+
const theme = (0, import_react.useContext)(import_ds_system.ThemeContext);
|
|
49
|
+
const [referenceElement, setReferenceElement] = (0, import_react.useState)();
|
|
50
|
+
const uniqueData = (0, import_react.useMemo)(() => {
|
|
51
|
+
const valueToPositionPerSeries = data.map(
|
|
52
|
+
(serie) => serie.data.map((datum, i) => ({
|
|
53
|
+
position: serie.scale === "y" || !serie.scale ? yScale(datum.value) : y2Scale(datum.value),
|
|
54
|
+
name: serie.name,
|
|
55
|
+
xValue: xAxis.cols[i],
|
|
56
|
+
yValue: datum.value
|
|
57
|
+
}))
|
|
58
|
+
).flat(1);
|
|
59
|
+
const postionUniqueData = {};
|
|
60
|
+
valueToPositionPerSeries.forEach((set) => {
|
|
61
|
+
if (postionUniqueData[[set.position]]) {
|
|
62
|
+
postionUniqueData[[set.position]] = [...postionUniqueData[[set.position]], { ...set }];
|
|
63
|
+
} else {
|
|
64
|
+
postionUniqueData[[set.position]] = [{ ...set }];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return postionUniqueData;
|
|
68
|
+
}, [data, xAxis.cols, y2Scale, yScale]);
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
70
|
+
children: Object.keys(uniqueData).map((key) => {
|
|
71
|
+
const yPosition = parseFloat(key);
|
|
72
|
+
const datum = uniqueData[key];
|
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
74
|
+
children: [
|
|
75
|
+
scrapperPosY === yPosition ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
76
|
+
children: [
|
|
77
|
+
TooltipRenderer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("foreignObject", {
|
|
78
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_popperjs.DSPopperJS, {
|
|
79
|
+
withoutAnimation: true,
|
|
80
|
+
withoutArrow: true,
|
|
81
|
+
customOffset: [0, 5],
|
|
82
|
+
referenceElement,
|
|
83
|
+
showPopover: true,
|
|
84
|
+
zIndex: theme.zIndex.tooltip,
|
|
85
|
+
startPlacementPreference: scrapper.tooltipPreference,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledMouseOverDetectionBox, {}),
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTooltipContainer, {
|
|
89
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipRenderer, {
|
|
90
|
+
data: datum
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
})
|
|
95
|
+
}) : null,
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", {
|
|
97
|
+
ref: setReferenceElement,
|
|
98
|
+
x1: innerWidth,
|
|
99
|
+
strokeWidth: "2px",
|
|
100
|
+
stroke: "transparent",
|
|
101
|
+
y1: yPosition,
|
|
102
|
+
x2: innerWidth,
|
|
103
|
+
y2: yPosition
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", {
|
|
106
|
+
x1: 0,
|
|
107
|
+
strokeWidth: "2px",
|
|
108
|
+
stroke: "grey",
|
|
109
|
+
strokeDasharray: (4, 4),
|
|
110
|
+
y1: yPosition,
|
|
111
|
+
x2: innerWidth,
|
|
112
|
+
y2: yPosition
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}) : null,
|
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", {
|
|
117
|
+
onMouseEnter: () => setScrapperPosY(yPosition),
|
|
118
|
+
x1: 0,
|
|
119
|
+
strokeWidth: "4px",
|
|
120
|
+
stroke: "transparent",
|
|
121
|
+
y1: yPosition,
|
|
122
|
+
x2: innerWidth,
|
|
123
|
+
y2: yPosition
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
}, key);
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=Scrapper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/graphs/Chart/parts/Scrapper.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo, useState } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ThemeContext, styled } from '@elliemae/ds-system';\nimport { ChartContext } from '../ChartContext';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../styles';\n\nexport const Scrapper = () => {\n const {\n yScale,\n y2Scale,\n scrapperPosY,\n setScrapperPosY,\n xScale,\n innerHeight,\n innerWidth,\n props: { TooltipRenderer, xAxis, data, scrapper },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const [referenceElement, setReferenceElement] = useState<React.SVGProps<SVGLineElement> | null>();\n\n const uniqueData = useMemo(() => {\n const valueToPositionPerSeries = data\n .map((serie) =>\n serie.data.map((datum, i) => ({\n position: serie.scale === 'y' || !serie.scale ? yScale(datum.value) : y2Scale(datum.value),\n name: serie.name,\n xValue: xAxis.cols[i],\n yValue: datum.value,\n })),\n )\n .flat(1);\n\n const postionUniqueData = {};\n\n valueToPositionPerSeries.forEach((set) => {\n if (postionUniqueData[[set.position]]) {\n postionUniqueData[[set.position]] = [...postionUniqueData[[set.position]], { ...set }];\n } else {\n postionUniqueData[[set.position]] = [{ ...set }];\n }\n });\n\n return postionUniqueData;\n }, [data, xAxis.cols, y2Scale, yScale]);\n\n return (\n <g>\n {Object.keys(uniqueData).map((key) => {\n const yPosition = parseFloat(key);\n const datum = uniqueData[key];\n return (\n <g key={key}>\n {scrapperPosY === yPosition ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <DSPopperJS\n withoutAnimation\n withoutArrow\n customOffset={[0, 5]}\n referenceElement={referenceElement}\n showPopover\n zIndex={theme.zIndex.tooltip}\n // placementOrderPreference=\"\"\n startPlacementPreference={scrapper.tooltipPreference}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={datum} />\n </StyledTooltipContainer>\n </DSPopperJS>\n </foreignObject>\n ) : null}\n <line\n ref={setReferenceElement}\n x1={innerWidth}\n strokeWidth=\"2px\"\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n <line\n // ref={setReferenceElement}\n x1={0}\n strokeWidth=\"2px\"\n stroke=\"grey\"\n strokeDasharray={(4, 4)}\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n ) : null}\n <line\n onMouseEnter={() => setScrapperPosY(yPosition)}\n // onMouseLeave={() => setScrapperPosY('')}\n // id=\"horizontal-scrapper-zone\"\n x1={0}\n strokeWidth=\"4px\"\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n );\n })}\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,yBAA2B;AAC3B,uBAAqC;AACrC,0BAA6B;AAC7B,oBAAoE;AAE7D,MAAM,WAAW,MAAM;AAC5B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,iBAAiB,OAAO,MAAM,SAAS;AAAA,EAClD,QAAI,yBAAW,gCAA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