@elliemae/ds-dataviz 3.8.1 → 3.9.0-next.1
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.map +2 -2
- package/dist/cjs/graphs/Chart/ChartContext.js +3 -1
- package/dist/cjs/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useChart.js +86 -33
- package/dist/cjs/graphs/Chart/config/useChart.js.map +3 -3
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js +103 -0
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +25 -15
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useScales.js +43 -17
- package/dist/cjs/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/cjs/graphs/Chart/helpers/index.js +9 -13
- package/dist/cjs/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js +1 -1
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +17 -25
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +3 -3
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +33 -38
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js +6 -11
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +65 -16
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js +17 -68
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.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 +61 -0
- package/dist/cjs/graphs/Chart/parts/Labels/LeftLabel.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/RightLabel.js +65 -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 +14 -19
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js +100 -0
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js +31 -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 +39 -17
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +29 -28
- 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/Scroller/ScrollableContainerX.js +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +57 -41
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js +1 -12
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Bars.js +29 -27
- package/dist/cjs/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js +85 -0
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js +77 -0
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Line.js +23 -19
- package/dist/cjs/graphs/Chart/series/Line.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Point.js +88 -18
- package/dist/cjs/graphs/Chart/series/Point.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Points.js +23 -27
- package/dist/cjs/graphs/Chart/series/Points.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Rect.js +105 -8
- package/dist/cjs/graphs/Chart/series/Rect.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/StackedBar.js +23 -30
- package/dist/cjs/graphs/Chart/series/StackedBar.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/cjs/graphs/Chart/styles.js +5 -20
- package/dist/cjs/graphs/Chart/styles.js.map +2 -2
- package/dist/cjs/graphs/constants.js +20 -0
- package/dist/cjs/graphs/constants.js.map +2 -2
- package/dist/esm/graphs/Chart/Chart.js.map +2 -2
- package/dist/esm/graphs/Chart/ChartContext.js +3 -1
- package/dist/esm/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useChart.js +87 -34
- package/dist/esm/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useInternalMargins.js +77 -0
- package/dist/esm/graphs/Chart/config/useInternalMargins.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +26 -16
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useScales.js +44 -18
- package/dist/esm/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/index.js +10 -14
- package/dist/esm/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ActivePoint.js +1 -1
- package/dist/esm/graphs/Chart/parts/ActivePoint.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +18 -26
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +3 -3
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +34 -39
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js +6 -11
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +66 -17
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js +18 -69
- package/dist/esm/graphs/Chart/parts/FocusableRegion.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 +35 -0
- package/dist/esm/graphs/Chart/parts/Labels/LeftLabel.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/RightLabel.js +39 -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 +16 -21
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js +74 -0
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js +32 -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 +39 -17
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +29 -28
- 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/Scroller/ScrollableContainerX.js +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js +58 -42
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/esm/graphs/Chart/react-desc-prop-types.js +1 -12
- package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Bars.js +30 -28
- package/dist/esm/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalBars.js +59 -0
- package/dist/esm/graphs/Chart/series/HorizontalBars.js.map +7 -0
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js +51 -0
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Line.js +25 -21
- package/dist/esm/graphs/Chart/series/Line.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Point.js +89 -19
- package/dist/esm/graphs/Chart/series/Point.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Points.js +24 -28
- package/dist/esm/graphs/Chart/series/Points.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Rect.js +106 -9
- package/dist/esm/graphs/Chart/series/Rect.js.map +2 -2
- package/dist/esm/graphs/Chart/series/StackedBar.js +24 -31
- package/dist/esm/graphs/Chart/series/StackedBar.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/dist/esm/graphs/Chart/styles.js +5 -20
- package/dist/esm/graphs/Chart/styles.js.map +2 -2
- package/dist/esm/graphs/constants.js +20 -0
- package/dist/esm/graphs/constants.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
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useContext } from "react";
|
|
4
4
|
import { Point } from "./Point";
|
|
5
5
|
import { ChartContext } from "../ChartContext";
|
|
6
|
-
import {
|
|
6
|
+
import { getStackedData } from "../helpers";
|
|
7
7
|
const Points = ({ serie }) => {
|
|
8
8
|
const {
|
|
9
9
|
colorScale,
|
|
10
10
|
xScale,
|
|
11
11
|
y2Scale,
|
|
12
12
|
yScale,
|
|
13
|
+
getXValue,
|
|
14
|
+
getYValue,
|
|
13
15
|
stackedData,
|
|
14
|
-
props: {
|
|
16
|
+
props: { types }
|
|
15
17
|
} = useContext(ChartContext);
|
|
16
18
|
const finalYScale = serie.scale === "y2" ? y2Scale : yScale;
|
|
17
19
|
const opacity = useMemo(() => types === "scatter" ? 0.8 : 1, [serie.type]);
|
|
@@ -19,36 +21,30 @@ const Points = ({ serie }) => {
|
|
|
19
21
|
() => /* @__PURE__ */ jsx("g", {
|
|
20
22
|
fill: colorScale(serie.name),
|
|
21
23
|
children: serie.data.map((point, i) => {
|
|
22
|
-
const { pointRadius } = serie;
|
|
23
|
-
const
|
|
24
|
-
const
|
|
24
|
+
const { pointRadius, pointStyle } = serie;
|
|
25
|
+
const serieWithStackedValues = getStackedData(stackedData, serie);
|
|
26
|
+
const deltaY = serieWithStackedValues ? serieWithStackedValues[i][0] : 0;
|
|
27
|
+
const x = getXValue(point);
|
|
28
|
+
const y = getYValue(point);
|
|
25
29
|
const xPosition = xScale(x);
|
|
26
|
-
const yPosition = finalYScale(y);
|
|
27
|
-
return /* @__PURE__ */
|
|
30
|
+
const yPosition = finalYScale(y + deltaY);
|
|
31
|
+
return /* @__PURE__ */ jsx("g", {
|
|
28
32
|
transform: `translate(${xPosition},${yPosition})`,
|
|
29
|
-
children:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
height: pointRadius * 2,
|
|
41
|
-
pointRadius,
|
|
42
|
-
style: { transform: `translate(-${pointRadius}px, -${pointRadius}px)` },
|
|
43
|
-
content: /* @__PURE__ */ jsx(TooltipRenderer, {
|
|
44
|
-
data: [{ name: serie.name, yValue: y, xValue: x }]
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
]
|
|
33
|
+
children: /* @__PURE__ */ jsx(Point, {
|
|
34
|
+
pointRadius,
|
|
35
|
+
id: point.key,
|
|
36
|
+
opacity,
|
|
37
|
+
x: xPosition + (xScale.bandwidth?.() ?? 0) / 2,
|
|
38
|
+
y: yPosition,
|
|
39
|
+
xValue: x,
|
|
40
|
+
yValue: y,
|
|
41
|
+
pointStyle,
|
|
42
|
+
name: serie.name
|
|
43
|
+
})
|
|
48
44
|
}, `${point.key}-p`);
|
|
49
45
|
})
|
|
50
46
|
}),
|
|
51
|
-
[
|
|
47
|
+
[colorScale, finalYScale, getXValue, getYValue, opacity, serie, stackedData, xScale]
|
|
52
48
|
);
|
|
53
49
|
return render;
|
|
54
50
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/Points.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useMemo, useContext } from 'react';\nimport { Point } from './Point';\nimport { ChartContext } from '../ChartContext';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,aAAa;AACtB,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useMemo, useContext } from 'react';\nimport { Point } from './Point';\nimport { ChartContext } from '../ChartContext';\nimport { getStackedData } from '../helpers';\n\nexport const Points = ({ serie }) => {\n const {\n colorScale,\n xScale,\n y2Scale,\n yScale,\n getXValue,\n getYValue,\n stackedData,\n props: { types },\n } = useContext(ChartContext);\n const finalYScale = serie.scale === 'y2' ? y2Scale : yScale;\n\n const opacity = useMemo(() => (types === 'scatter' ? 0.8 : 1), [serie.type]);\n const render = useMemo(\n () => (\n <g fill={colorScale(serie.name)}>\n {serie.data.map((point, i) => {\n const { pointRadius, pointStyle } = serie;\n // we need to recalculate the height with stacked data if is an AREA STACKED ELEMENT\n const serieWithStackedValues = getStackedData(stackedData, serie);\n const deltaY = serieWithStackedValues ? serieWithStackedValues[i][0] : 0;\n const x = getXValue(point);\n const y = getYValue(point);\n const xPosition = xScale(x);\n const yPosition = finalYScale(y + deltaY);\n\n return (\n <g key={`${point.key}-p`} transform={`translate(${xPosition},${yPosition})`}>\n <Point\n pointRadius={pointRadius}\n id={point.key}\n opacity={opacity}\n x={xPosition + (xScale.bandwidth?.() ?? 0) / 2}\n y={yPosition}\n xValue={x}\n yValue={y}\n pointStyle={pointStyle}\n name={serie.name}\n />\n </g>\n );\n })}\n </g>\n ),\n [colorScale, finalYScale, getXValue, getYValue, opacity, serie, stackedData, xScale],\n );\n return render;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAExB,MAAM,SAAS,CAAC,EAAE,MAAM,MAAM;AACnC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM;AAAA,EACjB,IAAI,WAAW,YAAY;AAC3B,QAAM,cAAc,MAAM,UAAU,OAAO,UAAU;AAErD,QAAM,UAAU,QAAQ,MAAO,UAAU,YAAY,MAAM,GAAI,CAAC,MAAM,IAAI,CAAC;AAC3E,QAAM,SAAS;AAAA,IACb,MACE,oBAAC;AAAA,MAAE,MAAM,WAAW,MAAM,IAAI;AAAA,MAC3B,gBAAM,KAAK,IAAI,CAAC,OAAO,MAAM;AAC5B,cAAM,EAAE,aAAa,WAAW,IAAI;AAEpC,cAAM,yBAAyB,eAAe,aAAa,KAAK;AAChE,cAAM,SAAS,yBAAyB,uBAAuB,GAAG,KAAK;AACvE,cAAM,IAAI,UAAU,KAAK;AACzB,cAAM,IAAI,UAAU,KAAK;AACzB,cAAM,YAAY,OAAO,CAAC;AAC1B,cAAM,YAAY,YAAY,IAAI,MAAM;AAExC,eACE,oBAAC;AAAA,UAAyB,WAAW,aAAa,aAAa;AAAA,UAC7D,8BAAC;AAAA,YACC;AAAA,YACA,IAAI,MAAM;AAAA,YACV;AAAA,YACA,GAAG,aAAa,OAAO,YAAY,KAAK,KAAK;AAAA,YAC7C,GAAG;AAAA,YACH,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR;AAAA,YACA,MAAM,MAAM;AAAA,WACd;AAAA,WAXM,GAAG,MAAM,OAYjB;AAAA,MAEJ,CAAC;AAAA,KACH;AAAA,IAEF,CAAC,YAAY,aAAa,WAAW,WAAW,SAAS,OAAO,aAAa,MAAM;AAAA,EACrF;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,18 +1,115 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useContext } from "react";
|
|
4
|
-
import { StyledMark } from "../styles";
|
|
5
4
|
import { ChartContext } from "../ChartContext";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { FOCUS_RING } from "../../constants";
|
|
6
|
+
import { FocusableRegion } from "../parts/FocusableRegion";
|
|
7
|
+
const Rect = ({ name, width, height, isNegative = false, x = null, y = null, id, xValue, yValue }) => {
|
|
8
|
+
const {
|
|
9
|
+
activePoint,
|
|
10
|
+
isGrabbed,
|
|
11
|
+
chartId,
|
|
12
|
+
isHorizontal,
|
|
13
|
+
innerWidth,
|
|
14
|
+
yScale,
|
|
15
|
+
innerHeight,
|
|
16
|
+
props: { TooltipRenderer }
|
|
17
|
+
} = useContext(ChartContext);
|
|
18
|
+
const isFocused = activePoint?.key === id;
|
|
19
|
+
const animation = useMemo(() => {
|
|
20
|
+
if (isGrabbed)
|
|
21
|
+
return null;
|
|
22
|
+
if (isHorizontal)
|
|
23
|
+
return /* @__PURE__ */ jsx("animate", {
|
|
24
|
+
attributeName: "x",
|
|
25
|
+
from: -innerWidth,
|
|
26
|
+
to: x,
|
|
27
|
+
dur: "0.4s",
|
|
28
|
+
fill: "both"
|
|
29
|
+
});
|
|
30
|
+
if (isNegative)
|
|
31
|
+
return /* @__PURE__ */ jsx("animate", {
|
|
32
|
+
attributeName: "y",
|
|
33
|
+
from: yScale(0),
|
|
34
|
+
to: -y,
|
|
35
|
+
dur: "0.40s",
|
|
36
|
+
fill: "both"
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ jsx("animate", {
|
|
39
|
+
attributeName: "y",
|
|
40
|
+
from: -innerHeight - y,
|
|
41
|
+
to: -y,
|
|
42
|
+
dur: "0.40s",
|
|
43
|
+
fill: "both"
|
|
44
|
+
});
|
|
45
|
+
}, [innerHeight, innerWidth, isGrabbed, isHorizontal, isNegative, x, y, yScale]);
|
|
46
|
+
const clipPathSign = useMemo(() => {
|
|
47
|
+
if (isHorizontal)
|
|
48
|
+
return "";
|
|
49
|
+
if (isNegative)
|
|
50
|
+
return `url(#rects-negative-${chartId})`;
|
|
51
|
+
return `url(#rects-positive-${chartId})`;
|
|
52
|
+
}, [chartId, isHorizontal, isNegative]);
|
|
53
|
+
const transform = useMemo(() => {
|
|
54
|
+
if (isHorizontal)
|
|
55
|
+
return ``;
|
|
56
|
+
return `scale(1,-1) translate(0,${-height})`;
|
|
57
|
+
}, [height, isHorizontal]);
|
|
9
58
|
return useMemo(
|
|
10
|
-
() => /* @__PURE__ */ jsx(
|
|
59
|
+
() => /* @__PURE__ */ jsx("g", {
|
|
60
|
+
clipPath: clipPathSign,
|
|
61
|
+
children: /* @__PURE__ */ jsxs("g", {
|
|
62
|
+
id: isFocused ? `data-focused-${chartId}` : "",
|
|
63
|
+
transform,
|
|
64
|
+
children: [
|
|
65
|
+
isFocused ? /* @__PURE__ */ jsx("rect", {
|
|
66
|
+
x: (isHorizontal ? x : 0) - FOCUS_RING.STROKE_WIDTH,
|
|
67
|
+
y: (!isHorizontal ? -y : 0) - FOCUS_RING.STROKE_WIDTH,
|
|
68
|
+
width: width + FOCUS_RING.OFFSET,
|
|
69
|
+
height: height + FOCUS_RING.OFFSET,
|
|
70
|
+
fill: "none",
|
|
71
|
+
rx: "1",
|
|
72
|
+
ry: "1",
|
|
73
|
+
stroke: FOCUS_RING.COLOR,
|
|
74
|
+
strokeWidth: FOCUS_RING.STROKE_WIDTH
|
|
75
|
+
}) : null,
|
|
76
|
+
/* @__PURE__ */ jsx("rect", {
|
|
77
|
+
width,
|
|
78
|
+
height,
|
|
79
|
+
y: -y,
|
|
80
|
+
x
|
|
81
|
+
}),
|
|
82
|
+
activePoint?.key === id && TooltipRenderer ? /* @__PURE__ */ jsx(FocusableRegion, {
|
|
83
|
+
id,
|
|
84
|
+
y,
|
|
85
|
+
x,
|
|
86
|
+
width,
|
|
87
|
+
height,
|
|
88
|
+
transform,
|
|
89
|
+
content: /* @__PURE__ */ jsx(TooltipRenderer, {
|
|
90
|
+
data: [{ name, yValue, xValue }]
|
|
91
|
+
})
|
|
92
|
+
}) : ""
|
|
93
|
+
]
|
|
94
|
+
})
|
|
95
|
+
}),
|
|
96
|
+
[
|
|
97
|
+
clipPathSign,
|
|
98
|
+
isFocused,
|
|
99
|
+
chartId,
|
|
100
|
+
transform,
|
|
101
|
+
isHorizontal,
|
|
102
|
+
x,
|
|
103
|
+
y,
|
|
11
104
|
width,
|
|
12
105
|
height,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
106
|
+
activePoint?.key,
|
|
107
|
+
id,
|
|
108
|
+
TooltipRenderer,
|
|
109
|
+
name,
|
|
110
|
+
yValue,
|
|
111
|
+
xValue
|
|
112
|
+
]
|
|
16
113
|
);
|
|
17
114
|
};
|
|
18
115
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/Rect.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useContext } from 'react';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,kBAAkB;AAC3B,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useContext } from 'react';\nimport { ChartContext } from '../ChartContext';\nimport { FOCUS_RING } from '../../constants';\nimport { FocusableRegion } from '../parts/FocusableRegion';\nexport const Rect = ({ name, width, height, isNegative = false, x = null, y = null, id, xValue, yValue }) => {\n const {\n activePoint,\n isGrabbed,\n chartId,\n isHorizontal,\n innerWidth,\n yScale,\n innerHeight,\n props: { TooltipRenderer },\n } = useContext(ChartContext);\n\n const isFocused = activePoint?.key === id;\n\n const animation = useMemo(() => {\n if (isGrabbed) return null;\n if (isHorizontal) return <animate attributeName=\"x\" from={-innerWidth} to={x} dur=\"0.4s\" fill=\"both\" />;\n if (isNegative) return <animate attributeName=\"y\" from={yScale(0)} to={-y} dur=\"0.40s\" fill=\"both\" />;\n return <animate attributeName=\"y\" from={-innerHeight - y} to={-y} dur=\"0.40s\" fill=\"both\" />;\n }, [innerHeight, innerWidth, isGrabbed, isHorizontal, isNegative, x, y, yScale]);\n\n const clipPathSign = useMemo(() => {\n // @todo horizontal clip paths\n if (isHorizontal) return '';\n if (isNegative) return `url(#rects-negative-${chartId})`;\n return `url(#rects-positive-${chartId})`;\n }, [chartId, isHorizontal, isNegative]);\n\n const transform = useMemo(() => {\n if (isHorizontal) return ``;\n return `scale(1,-1) translate(0,${-height})`;\n }, [height, isHorizontal]);\n return useMemo(\n () => (\n <g clipPath={clipPathSign}>\n <g id={isFocused ? `data-focused-${chartId}` : ''} transform={transform}>\n {isFocused ? (\n <rect\n x={(isHorizontal ? x : 0) - FOCUS_RING.STROKE_WIDTH}\n y={(!isHorizontal ? -y : 0) - FOCUS_RING.STROKE_WIDTH}\n width={width + FOCUS_RING.OFFSET}\n height={height + FOCUS_RING.OFFSET}\n fill=\"none\"\n rx=\"1\"\n ry=\"1\"\n stroke={FOCUS_RING.COLOR}\n strokeWidth={FOCUS_RING.STROKE_WIDTH}\n ></rect>\n ) : null}\n <rect width={width} height={height} y={-y} x={x}>\n {/* {animation} */}\n </rect>\n {activePoint?.key === id && TooltipRenderer ? (\n <FocusableRegion\n id={id}\n y={y}\n x={x}\n width={width}\n height={height}\n transform={transform}\n content={<TooltipRenderer data={[{ name, yValue, xValue }]} />}\n />\n ) : (\n ''\n )}\n </g>\n </g>\n ),\n [\n clipPathSign,\n isFocused,\n chartId,\n transform,\n isHorizontal,\n x,\n y,\n width,\n height,\n // animation,\n activePoint?.key,\n id,\n TooltipRenderer,\n name,\n yValue,\n xValue,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AACzB,MAAM,OAAO,CAAC,EAAE,MAAM,OAAO,QAAQ,aAAa,OAAO,IAAI,MAAM,IAAI,MAAM,IAAI,QAAQ,OAAO,MAAM;AAC3G,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,gBAAgB;AAAA,EAC3B,IAAI,WAAW,YAAY;AAE3B,QAAM,YAAY,aAAa,QAAQ;AAEvC,QAAM,YAAY,QAAQ,MAAM;AAC9B,QAAI;AAAW,aAAO;AACtB,QAAI;AAAc,aAAO,oBAAC;AAAA,QAAQ,eAAc;AAAA,QAAI,MAAM,CAAC;AAAA,QAAY,IAAI;AAAA,QAAG,KAAI;AAAA,QAAO,MAAK;AAAA,OAAO;AACrG,QAAI;AAAY,aAAO,oBAAC;AAAA,QAAQ,eAAc;AAAA,QAAI,MAAM,OAAO,CAAC;AAAA,QAAG,IAAI,CAAC;AAAA,QAAG,KAAI;AAAA,QAAQ,MAAK;AAAA,OAAO;AACnG,WAAO,oBAAC;AAAA,MAAQ,eAAc;AAAA,MAAI,MAAM,CAAC,cAAc;AAAA,MAAG,IAAI,CAAC;AAAA,MAAG,KAAI;AAAA,MAAQ,MAAK;AAAA,KAAO;AAAA,EAC5F,GAAG,CAAC,aAAa,YAAY,WAAW,cAAc,YAAY,GAAG,GAAG,MAAM,CAAC;AAE/E,QAAM,eAAe,QAAQ,MAAM;AAEjC,QAAI;AAAc,aAAO;AACzB,QAAI;AAAY,aAAO,uBAAuB;AAC9C,WAAO,uBAAuB;AAAA,EAChC,GAAG,CAAC,SAAS,cAAc,UAAU,CAAC;AAEtC,QAAM,YAAY,QAAQ,MAAM;AAC9B,QAAI;AAAc,aAAO;AACzB,WAAO,2BAA2B,CAAC;AAAA,EACrC,GAAG,CAAC,QAAQ,YAAY,CAAC;AACzB,SAAO;AAAA,IACL,MACE,oBAAC;AAAA,MAAE,UAAU;AAAA,MACX,+BAAC;AAAA,QAAE,IAAI,YAAY,gBAAgB,YAAY;AAAA,QAAI;AAAA,QAChD;AAAA,sBACC,oBAAC;AAAA,YACC,IAAI,eAAe,IAAI,KAAK,WAAW;AAAA,YACvC,IAAI,CAAC,eAAe,CAAC,IAAI,KAAK,WAAW;AAAA,YACzC,OAAO,QAAQ,WAAW;AAAA,YAC1B,QAAQ,SAAS,WAAW;AAAA,YAC5B,MAAK;AAAA,YACL,IAAG;AAAA,YACH,IAAG;AAAA,YACH,QAAQ,WAAW;AAAA,YACnB,aAAa,WAAW;AAAA,WACzB,IACC;AAAA,UACJ,oBAAC;AAAA,YAAK;AAAA,YAAc;AAAA,YAAgB,GAAG,CAAC;AAAA,YAAG;AAAA,WAE3C;AAAA,UACC,aAAa,QAAQ,MAAM,kBAC1B,oBAAC;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAS,oBAAC;AAAA,cAAgB,MAAM,CAAC,EAAE,MAAM,QAAQ,OAAO,CAAC;AAAA,aAAG;AAAA,WAC9D,IAEA;AAAA;AAAA,OAEJ;AAAA,KACF;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,51 +1,44 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext } from "react";
|
|
4
4
|
import { Rect } from "./Rect";
|
|
5
5
|
import { ChartContext } from "../ChartContext";
|
|
6
6
|
import { getStackedData, getStackedIndex } from "../helpers";
|
|
7
|
-
import { FocusableRegion } from "../parts/FocusableRegion";
|
|
8
7
|
const StackedBar = ({ serie }) => {
|
|
9
8
|
const {
|
|
10
|
-
props: {
|
|
9
|
+
props: { groups },
|
|
11
10
|
xScale,
|
|
12
11
|
yScale,
|
|
13
12
|
stackedData,
|
|
14
13
|
subGroupScale,
|
|
15
|
-
colorScale
|
|
14
|
+
colorScale,
|
|
15
|
+
chartId,
|
|
16
|
+
getXValue
|
|
16
17
|
} = useContext(ChartContext);
|
|
17
|
-
const isHorizontal = !!yScale.bandwidth;
|
|
18
18
|
const serieWithStackedValues = getStackedData(stackedData, serie);
|
|
19
19
|
const stackIndex = getStackedIndex(groups, serie.name);
|
|
20
20
|
return /* @__PURE__ */ jsx("g", {
|
|
21
|
+
clipPath: `url(#rect-focus-ring-${chartId})`,
|
|
21
22
|
children: serieWithStackedValues.map((sequence, i) => {
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
23
|
+
const isFloorStack = sequence[0] === 0;
|
|
24
|
+
const xValue = getXValue(serie.data[i]);
|
|
25
|
+
const yValue = sequence[0] - sequence[1];
|
|
26
|
+
const width = subGroupScale?.bandwidth();
|
|
27
|
+
const height = yScale(sequence[0]) - yScale(sequence[1]) - (!isFloorStack ? 1 : 0);
|
|
28
|
+
const transformX = xScale(xValue) + subGroupScale(`stacked-data-${stackIndex}`);
|
|
29
|
+
const transformY = yScale(sequence[1]);
|
|
30
|
+
return /* @__PURE__ */ jsx("g", {
|
|
29
31
|
fill: colorScale(serie.name),
|
|
30
|
-
transform: `translate(${transformX},
|
|
31
|
-
children:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
TooltipRenderer && /* @__PURE__ */ jsx(FocusableRegion, {
|
|
41
|
-
id: serie.data[i].key,
|
|
42
|
-
width,
|
|
43
|
-
height,
|
|
44
|
-
content: /* @__PURE__ */ jsx(TooltipRenderer, {
|
|
45
|
-
data: [{ name: serie.name, yValue, xValue }]
|
|
46
|
-
})
|
|
47
|
-
})
|
|
48
|
-
]
|
|
32
|
+
transform: `translate(${transformX},0)`,
|
|
33
|
+
children: /* @__PURE__ */ jsx(Rect, {
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
xValue,
|
|
37
|
+
yValue,
|
|
38
|
+
y: transformY,
|
|
39
|
+
id: serie.data[i].key,
|
|
40
|
+
name: serie.name
|
|
41
|
+
})
|
|
49
42
|
}, serie.data[i].key);
|
|
50
43
|
})
|
|
51
44
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/StackedBar.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useContext } from 'react';\n\nimport { Rect } from './Rect';\nimport { ChartContext } from '../ChartContext';\nimport { getStackedData, getStackedIndex } from '../helpers';\n\nexport const StackedBar = ({ serie }) => {\n const {\n props: { groups },\n xScale,\n yScale,\n stackedData,\n subGroupScale,\n colorScale,\n chartId,\n getXValue,\n } = useContext(ChartContext);\n\n const serieWithStackedValues = getStackedData(stackedData, serie);\n const stackIndex = getStackedIndex(groups, serie.name);\n return (\n <g clipPath={`url(#rect-focus-ring-${chartId})`}>\n {serieWithStackedValues.map((sequence, i) => {\n const isFloorStack = sequence[0] === 0;\n\n const xValue = getXValue(serie.data[i]);\n const yValue = sequence[0] - sequence[1];\n const width = subGroupScale?.bandwidth();\n const height = yScale(sequence[0]) - yScale(sequence[1]) - (!isFloorStack ? 1 : 0);\n const transformX = xScale(xValue) + subGroupScale(`stacked-data-${stackIndex}`);\n const transformY = yScale(sequence[1]);\n\n return (\n <g key={serie.data[i].key} fill={colorScale(serie.name)} transform={`translate(${transformX},0)`}>\n <Rect\n width={width}\n height={height}\n xValue={xValue}\n yValue={yValue}\n y={transformY}\n id={serie.data[i].key}\n name={serie.name}\n />\n </g>\n );\n })}\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,kBAAkB;AAElC,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB,uBAAuB;AAEzC,MAAM,aAAa,CAAC,EAAE,MAAM,MAAM;AACvC,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAE3B,QAAM,yBAAyB,eAAe,aAAa,KAAK;AAChE,QAAM,aAAa,gBAAgB,QAAQ,MAAM,IAAI;AACrD,SACE,oBAAC;AAAA,IAAE,UAAU,wBAAwB;AAAA,IAClC,iCAAuB,IAAI,CAAC,UAAU,MAAM;AAC3C,YAAM,eAAe,SAAS,OAAO;AAErC,YAAM,SAAS,UAAU,MAAM,KAAK,EAAE;AACtC,YAAM,SAAS,SAAS,KAAK,SAAS;AACtC,YAAM,QAAQ,eAAe,UAAU;AACvC,YAAM,SAAS,OAAO,SAAS,EAAE,IAAI,OAAO,SAAS,EAAE,KAAK,CAAC,eAAe,IAAI;AAChF,YAAM,aAAa,OAAO,MAAM,IAAI,cAAc,gBAAgB,YAAY;AAC9E,YAAM,aAAa,OAAO,SAAS,EAAE;AAErC,aACE,oBAAC;AAAA,QAA0B,MAAM,WAAW,MAAM,IAAI;AAAA,QAAG,WAAW,aAAa;AAAA,QAC/E,8BAAC;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,GAAG;AAAA,UACH,IAAI,MAAM,KAAK,GAAG;AAAA,UAClB,MAAM,MAAM;AAAA,SACd;AAAA,SATM,MAAM,KAAK,GAAG,GAUtB;AAAA,IAEJ,CAAC;AAAA,GACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './Rect';\nexport * from './Bars';\nexport * from './StackedBar';\nexport * from './Points';\nexport * from './Line';\nexport * from './Area';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './Rect';\nexport * from './Bars';\nexport * from './StackedBar';\nexport * from './Points';\nexport * from './Line';\nexport * from './Area';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,6 +10,10 @@ const StyledSVGWrapper = styled.div`
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
cursor: ${({ isGrabbed }) => isGrabbed ? "grabbing" : "default"};
|
|
13
|
+
|
|
14
|
+
.domain {
|
|
15
|
+
stroke-width: 2px;
|
|
16
|
+
}
|
|
13
17
|
`;
|
|
14
18
|
const StyledAxis = styled("g")`
|
|
15
19
|
text {
|
|
@@ -43,9 +47,6 @@ const borderCircle = css`
|
|
|
43
47
|
stroke: #c64252;
|
|
44
48
|
stroke-width: 2;
|
|
45
49
|
`;
|
|
46
|
-
const StyledMark = styled("rect")`
|
|
47
|
-
${({ isFocused }) => isFocused ? borderCircle : ""};
|
|
48
|
-
`;
|
|
49
50
|
const StyleFocusableRegion = styled("div")`
|
|
50
51
|
width: ${({ s }) => s * 2}px;
|
|
51
52
|
height: ${({ s }) => s * 2}px;
|
|
@@ -63,23 +64,9 @@ const StyledArea = styled("path")`
|
|
|
63
64
|
stroke-linejoin: round;
|
|
64
65
|
opacity: 0.8;
|
|
65
66
|
`;
|
|
66
|
-
const StyledPoint = styled("circle")`
|
|
67
|
-
//opacity: ${({ isFocused }) => isFocused ? 1 : 0};
|
|
68
|
-
${({ isFocused }) => isFocused ? borderCircle : ""};
|
|
69
|
-
`;
|
|
70
67
|
const StyledTooltipContainer = styled.div`
|
|
71
|
-
|
|
72
|
-
min-width: ${({ theme }) => theme.space.l};
|
|
73
|
-
max-width: 250px;
|
|
74
|
-
min-height: 30px;
|
|
75
|
-
display: grid;
|
|
76
|
-
align-items: center;
|
|
77
|
-
padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};
|
|
78
|
-
position: relative;
|
|
68
|
+
max-width: 350px;
|
|
79
69
|
background-color: white;
|
|
80
|
-
border-radius: 2px;
|
|
81
|
-
font-size: 13px;
|
|
82
|
-
color: ${({ theme }) => theme.colors.neutral[600]};
|
|
83
70
|
`;
|
|
84
71
|
const StyledMouseOverDetectionBox = styled.div`
|
|
85
72
|
position: absolute;
|
|
@@ -96,9 +83,7 @@ export {
|
|
|
96
83
|
StyledAxisLabel,
|
|
97
84
|
StyledGrid,
|
|
98
85
|
StyledLine,
|
|
99
|
-
StyledMark,
|
|
100
86
|
StyledMouseOverDetectionBox,
|
|
101
|
-
StyledPoint,
|
|
102
87
|
StyledSVGWrapper,
|
|
103
88
|
StyledTooltipContainer
|
|
104
89
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/graphs/Chart/styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css } from '@elliemae/ds-system';\nimport { COLOR_PALLET } from './helpers/colorPallet';\nexport const StyledSVGWrapper = styled.div`\n :focus {\n outline: none;\n }\n :focus-within {\n outline: none;\n }\n\n cursor: ${({ isGrabbed }) => (isGrabbed ? 'grabbing' : 'default')};\n`;\n\nexport const StyledAxis = styled('g')`\n text {\n fill: #635f5d;\n }\n\n text.axis-label {\n /* font-size: 2.5em; */\n }\n\n .tick text {\n ${({ color }) => (color ? `fill: ${COLOR_PALLET[color] ?? color}` : '')}\n }\n .tick line {\n ${({ color }) => (color ? `stroke: ${COLOR_PALLET[color] ?? color}` : '')}\n }\n line {\n stroke: #c0c0bb;\n }\n`;\n\nexport const StyledAxisLabel = styled('text')`\n font-size: 13px;\n font-weight: 600;\n`;\n\nexport const StyledGrid = styled('g')`\n line {\n stroke: #c0c0bb;\n }\n`;\n\nconst borderCircle = css`\n stroke: #c64252;\n stroke-width: 2;\n`;\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,WAAW;AAC5B,SAAS,oBAAoB;AACtB,MAAM,mBAAmB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAQ3B,CAAC,EAAE,UAAU,MAAO,YAAY,aAAa;AAAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css } from '@elliemae/ds-system';\nimport { COLOR_PALLET } from './helpers/colorPallet';\nexport const StyledSVGWrapper = styled.div`\n :focus {\n outline: none;\n }\n :focus-within {\n outline: none;\n }\n\n cursor: ${({ isGrabbed }) => (isGrabbed ? 'grabbing' : 'default')};\n\n .domain {\n stroke-width: 2px;\n }\n`;\n\nexport const StyledAxis = styled('g')`\n text {\n fill: #635f5d;\n }\n\n text.axis-label {\n /* font-size: 2.5em; */\n }\n\n .tick text {\n ${({ color }) => (color ? `fill: ${COLOR_PALLET[color] ?? color}` : '')}\n }\n .tick line {\n ${({ color }) => (color ? `stroke: ${COLOR_PALLET[color] ?? color}` : '')}\n }\n line {\n stroke: #c0c0bb;\n }\n`;\n\nexport const StyledAxisLabel = styled('text')`\n font-size: 13px;\n font-weight: 600;\n`;\n\nexport const StyledGrid = styled('g')`\n line {\n stroke: #c0c0bb;\n }\n`;\n\nconst borderCircle = css`\n stroke: #c64252;\n stroke-width: 2;\n`;\n\nexport const StyleFocusableRegion = styled('div')<{ s: number }>`\n width: ${({ s }) => s * 2 ?? '1'}px;\n height: ${({ s }) => s * 2 ?? '1'}px;\n :focus {\n outline: none;\n }\n`;\n\nexport const StyledLine = styled('path')`\n fill: none;\n stroke-width: ${({ isActiveLine }) => (isActiveLine ? 5 : 3)};\n stroke-linejoin: round;\n`;\nexport const StyledArea = styled('path')`\n stroke-width: ${({ isActiveLine }) => (isActiveLine ? 5 : 3)};\n stroke-linejoin: round;\n opacity: 0.8;\n`;\n\nexport const StyledTooltipContainer = styled.div`\n max-width: 350px;\n background-color: white;\n`;\n\nexport const StyledMouseOverDetectionBox = styled.div`\n position: absolute;\n top: -15px;\n right: -15px;\n width: calc(100% + 30px);\n height: calc(100% + 30px);\n z-index: -1;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,WAAW;AAC5B,SAAS,oBAAoB;AACtB,MAAM,mBAAmB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAQ3B,CAAC,EAAE,UAAU,MAAO,YAAY,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAOlD,MAAM,aAAa,OAAO,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAU9B,CAAC,EAAE,MAAM,MAAO,QAAQ,SAAS,aAAa,UAAU,UAAU;AAAA;AAAA;AAAA,MAGlE,CAAC,EAAE,MAAM,MAAO,QAAQ,WAAW,aAAa,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAOnE,MAAM,kBAAkB,OAAO,MAAM;AAAA;AAAA;AAAA;AAKrC,MAAM,aAAa,OAAO,GAAG;AAAA;AAAA;AAAA;AAAA;AAMpC,MAAM,eAAe;AAAA;AAAA;AAAA;AAKd,MAAM,uBAAuB,OAAO,KAAK;AAAA,WACrC,CAAC,EAAE,EAAE,MAAM,IAAI;AAAA,YACd,CAAC,EAAE,EAAE,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAMpB,MAAM,aAAa,OAAO,MAAM;AAAA;AAAA,kBAErB,CAAC,EAAE,aAAa,MAAO,eAAe,IAAI;AAAA;AAAA;AAGrD,MAAM,aAAa,OAAO,MAAM;AAAA,kBACrB,CAAC,EAAE,aAAa,MAAO,eAAe,IAAI;AAAA;AAAA;AAAA;AAKrD,MAAM,yBAAyB,OAAO;AAAA;AAAA;AAAA;AAKtC,MAAM,8BAA8B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,27 @@ const TICK_FORMATS = {
|
|
|
5
5
|
KSEPARATOR: (v) => format(",")(v),
|
|
6
6
|
TIME: (userFormat) => (v) => timeFormat(userFormat)(v)
|
|
7
7
|
};
|
|
8
|
+
const FOCUS_RING = {
|
|
9
|
+
COLOR: "#335cad",
|
|
10
|
+
STROKE_WIDTH: 2,
|
|
11
|
+
OFFSET: 4
|
|
12
|
+
};
|
|
13
|
+
const SCRAPPER = {
|
|
14
|
+
TYPE_HORIZONTAL: "horizontal",
|
|
15
|
+
TYPE_VERTICAL: "vertical"
|
|
16
|
+
};
|
|
17
|
+
const LINE = {
|
|
18
|
+
POINT_STYLE: {
|
|
19
|
+
CIRCLE: "CIRCLE",
|
|
20
|
+
SQUARE: "SQUARE",
|
|
21
|
+
DIAMOND: "DIAMOND"
|
|
22
|
+
},
|
|
23
|
+
DEFAULT_POINT_RADIUS: 4
|
|
24
|
+
};
|
|
8
25
|
export {
|
|
26
|
+
FOCUS_RING,
|
|
27
|
+
LINE,
|
|
28
|
+
SCRAPPER,
|
|
9
29
|
TICK_FORMATS
|
|
10
30
|
};
|
|
11
31
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/graphs/constants.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { format, timeFormat } from 'd3';\n\nexport const TICK_FORMATS = {\n MILLIONS: (v) => format('.2s')(v).replace('G', 'B'),\n KSEPARATOR: (v) => format(',')(v),\n TIME: (userFormat: string) => (v) => timeFormat(userFormat)(v),\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,kBAAkB;AAE5B,MAAM,eAAe;AAAA,EAC1B,UAAU,CAAC,MAAM,OAAO,KAAK,EAAE,CAAC,EAAE,QAAQ,KAAK,GAAG;AAAA,EAClD,YAAY,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC;AAAA,EAChC,MAAM,CAAC,eAAuB,CAAC,MAAM,WAAW,UAAU,EAAE,CAAC;AAC/D;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { format, timeFormat } from 'd3';\n\nexport const TICK_FORMATS = {\n MILLIONS: (v) => format('.2s')(v).replace('G', 'B'),\n KSEPARATOR: (v) => format(',')(v),\n TIME: (userFormat: string) => (v) => timeFormat(userFormat)(v),\n};\n\nexport const FOCUS_RING = {\n COLOR: '#335cad',\n STROKE_WIDTH: 2,\n OFFSET: 4,\n};\n\nexport const SCRAPPER = {\n TYPE_HORIZONTAL: 'horizontal',\n TYPE_VERTICAL: 'vertical',\n};\n\nexport const LINE = {\n POINT_STYLE: {\n CIRCLE: 'CIRCLE',\n SQUARE: 'SQUARE',\n DIAMOND: 'DIAMOND',\n },\n DEFAULT_POINT_RADIUS: 4,\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,kBAAkB;AAE5B,MAAM,eAAe;AAAA,EAC1B,UAAU,CAAC,MAAM,OAAO,KAAK,EAAE,CAAC,EAAE,QAAQ,KAAK,GAAG;AAAA,EAClD,YAAY,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC;AAAA,EAChC,MAAM,CAAC,eAAuB,CAAC,MAAM,WAAW,UAAU,EAAE,CAAC;AAC/D;AAEO,MAAM,aAAa;AAAA,EACxB,OAAO;AAAA,EACP,cAAc;AAAA,EACd,QAAQ;AACV;AAEO,MAAM,WAAW;AAAA,EACtB,iBAAiB;AAAA,EACjB,eAAe;AACjB;AAEO,MAAM,OAAO;AAAA,EAClB,aAAa;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,sBAAsB;AACxB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-dataviz",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0-next.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - DataViz",
|
|
6
6
|
"files": [
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"indent": 4
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@elliemae/ds-grid": "3.
|
|
39
|
-
"@elliemae/ds-icon": "3.
|
|
40
|
-
"@elliemae/ds-icons": "3.
|
|
41
|
-
"@elliemae/ds-popperjs": "3.
|
|
42
|
-
"@elliemae/ds-system": "3.
|
|
43
|
-
"@elliemae/ds-tooltip": "3.
|
|
44
|
-
"@elliemae/ds-utilities": "3.
|
|
38
|
+
"@elliemae/ds-grid": "3.9.0-next.1",
|
|
39
|
+
"@elliemae/ds-icon": "3.9.0-next.1",
|
|
40
|
+
"@elliemae/ds-icons": "3.9.0-next.1",
|
|
41
|
+
"@elliemae/ds-popperjs": "3.9.0-next.1",
|
|
42
|
+
"@elliemae/ds-system": "3.9.0-next.1",
|
|
43
|
+
"@elliemae/ds-tooltip": "3.9.0-next.1",
|
|
44
|
+
"@elliemae/ds-utilities": "3.9.0-next.1",
|
|
45
45
|
"d3": "~7.4.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/graphs/Chart/series/Pie.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { pie } from 'd3';\nimport { PieChartContext } from '../ChartContext';\n\nexport const Pie = () => {\n const {\n innerHeight,\n innerWidth,\n colorScale,\n props: { data },\n } = useContext(PieChartContext);\n\n const pieData = data.reduce((acc, curr) => (acc[curr.name] = curr.value), {});\n\n return <g transform={`translate(${innerWidth / 2},${innerHeight / 2}`}></g>;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkC;AAElC,0BAAgC;AAEzB,MAAM,MAAM,MAAM;AACvB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,KAAK;AAAA,EAChB,QAAI,yBAAW,mCAAe;AAE9B,QAAM,UAAU,KAAK,OAAO,CAAC,KAAK,SAAU,IAAI,KAAK,QAAQ,KAAK,OAAQ,CAAC,CAAC;AAE5E,SAAO,4CAAC;AAAA,IAAE,WAAW,aAAa,aAAa,KAAK,cAAc;AAAA,GAAK;AACzE;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
import { PieChartContext } from "../ChartContext";
|
|
5
|
-
const Pie = () => {
|
|
6
|
-
const {
|
|
7
|
-
innerHeight,
|
|
8
|
-
innerWidth,
|
|
9
|
-
colorScale,
|
|
10
|
-
props: { data }
|
|
11
|
-
} = useContext(PieChartContext);
|
|
12
|
-
const pieData = data.reduce((acc, curr) => acc[curr.name] = curr.value, {});
|
|
13
|
-
return /* @__PURE__ */ jsx("g", {
|
|
14
|
-
transform: `translate(${innerWidth / 2},${innerHeight / 2}`
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
Pie
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=Pie.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/Pie.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { pie } from 'd3';\nimport { PieChartContext } from '../ChartContext';\n\nexport const Pie = () => {\n const {\n innerHeight,\n innerWidth,\n colorScale,\n props: { data },\n } = useContext(PieChartContext);\n\n const pieData = data.reduce((acc, curr) => (acc[curr.name] = curr.value), {});\n\n return <g transform={`translate(${innerWidth / 2},${innerHeight / 2}`}></g>;\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAElC,SAAS,uBAAuB;AAEzB,MAAM,MAAM,MAAM;AACvB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,KAAK;AAAA,EAChB,IAAI,WAAW,eAAe;AAE9B,QAAM,UAAU,KAAK,OAAO,CAAC,KAAK,SAAU,IAAI,KAAK,QAAQ,KAAK,OAAQ,CAAC,CAAC;AAE5E,SAAO,oBAAC;AAAA,IAAE,WAAW,aAAa,aAAa,KAAK,cAAc;AAAA,GAAK;AACzE;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|