impaktapps-design 0.2.993-alpha.232 → 0.2.993-alpha.234
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/impaktapps-design.es.js +15 -16
- package/dist/impaktapps-design.es.js.map +1 -1
- package/dist/impaktapps-design.umd.js +1 -1
- package/dist/impaktapps-design.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/component/StackBarLineGraph/DrawStackBarLineGraph.tsx +13 -13
- package/src/utils/finalDataProvider.ts +1 -2
|
@@ -19146,7 +19146,7 @@ ParentSize$1.propTypes = {
|
|
|
19146
19146
|
children: _pt.func.isRequired
|
|
19147
19147
|
};
|
|
19148
19148
|
const finalDataProvider = (type2, value, theme) => {
|
|
19149
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t5, _u, _v, _w
|
|
19149
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t5, _u, _v, _w;
|
|
19150
19150
|
switch (type2) {
|
|
19151
19151
|
case "BarGraph":
|
|
19152
19152
|
case "StackBarGraph":
|
|
@@ -19281,8 +19281,7 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19281
19281
|
...(_w = value.style) == null ? void 0 : _w.labelStyle
|
|
19282
19282
|
},
|
|
19283
19283
|
stackBarLineStyle: {
|
|
19284
|
-
...value.style
|
|
19285
|
-
colorMap: (_x = value.style) == null ? void 0 : _x.colorMap
|
|
19284
|
+
...value.style
|
|
19286
19285
|
}
|
|
19287
19286
|
}
|
|
19288
19287
|
};
|
|
@@ -22504,7 +22503,7 @@ const AreaGraph = ({
|
|
|
22504
22503
|
}), GraphRender]
|
|
22505
22504
|
});
|
|
22506
22505
|
};
|
|
22507
|
-
const
|
|
22506
|
+
const GROWTH_RATE_KEY = "growthRate";
|
|
22508
22507
|
const DrawStackBarLineGraph = ({
|
|
22509
22508
|
width: width2,
|
|
22510
22509
|
height: height2,
|
|
@@ -22530,13 +22529,13 @@ const DrawStackBarLineGraph = ({
|
|
|
22530
22529
|
const yAxisTickCount = (_i = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _i.yAxisTickCount;
|
|
22531
22530
|
const disableLeftLabel = (_j = stackBarLineValue.main) == null ? void 0 : _j.disableLeftLabel;
|
|
22532
22531
|
const xAxisLabelMinWidth = ((_k = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _k.xAxisLabelMinWidth) || 56;
|
|
22533
|
-
const trendColor = (_l = colorMap == null ? void 0 : colorMap[
|
|
22532
|
+
const trendColor = (_l = colorMap == null ? void 0 : colorMap[GROWTH_RATE_KEY]) != null ? _l : "#E24B4A";
|
|
22534
22533
|
const labelsArray = useMemo(() => {
|
|
22535
22534
|
if (!chartData.length)
|
|
22536
22535
|
return [];
|
|
22537
22536
|
return Object.keys(chartData[0]).filter((k2) => k2 !== xAxisValue);
|
|
22538
22537
|
}, [chartData, xAxisValue]);
|
|
22539
|
-
const barKeys = useMemo(() => labelsArray.filter((k2) => k2 !==
|
|
22538
|
+
const barKeys = useMemo(() => labelsArray.filter((k2) => k2 !== GROWTH_RATE_KEY), [labelsArray]);
|
|
22540
22539
|
const barData = useMemo(() => chartData.map((row) => {
|
|
22541
22540
|
const stripped = {
|
|
22542
22541
|
[xAxisValue]: row[xAxisValue]
|
|
@@ -22560,7 +22559,7 @@ const DrawStackBarLineGraph = ({
|
|
|
22560
22559
|
nice: true
|
|
22561
22560
|
}), [innerHeight, maxStacked]);
|
|
22562
22561
|
const trendScale = useMemo(() => {
|
|
22563
|
-
const vals = chartData.map((d2) => Number(d2[
|
|
22562
|
+
const vals = chartData.map((d2) => Number(d2[GROWTH_RATE_KEY]) || 0);
|
|
22564
22563
|
return createLinearScale({
|
|
22565
22564
|
domain: [Math.min(...vals), Math.max(...vals)],
|
|
22566
22565
|
range: [innerHeight, 0],
|
|
@@ -22572,11 +22571,11 @@ const DrawStackBarLineGraph = ({
|
|
|
22572
22571
|
return ((_a2 = categoryScale(cat)) != null ? _a2 : 0) + categoryScale.bandwidth() / 2;
|
|
22573
22572
|
}, [categoryScale]);
|
|
22574
22573
|
const getLineX = useCallback((d2) => getBarCentreX(d2[xAxisValue]), [getBarCentreX, xAxisValue]);
|
|
22575
|
-
const getLineY = useCallback((d2) => trendScale(Number(d2[
|
|
22574
|
+
const getLineY = useCallback((d2) => trendScale(Number(d2[GROWTH_RATE_KEY]) || 0), [trendScale]);
|
|
22576
22575
|
const handleColumnEnter = useCallback((_e2, cat) => {
|
|
22577
22576
|
const full = chartData.find((d2) => d2[xAxisValue] === cat);
|
|
22578
22577
|
const dotX = getBarCentreX(cat) + margin2.left;
|
|
22579
|
-
const dotY = trendScale(Number(full[
|
|
22578
|
+
const dotY = trendScale(Number(full[GROWTH_RATE_KEY]) || 0) + margin2.top;
|
|
22580
22579
|
setHoveredCategory(cat);
|
|
22581
22580
|
showTooltip({
|
|
22582
22581
|
tooltipData: full,
|
|
@@ -22614,16 +22613,16 @@ const DrawStackBarLineGraph = ({
|
|
|
22614
22613
|
const topStackIndex = barStacks.length - 1;
|
|
22615
22614
|
return barStacks.map((barStack, stackIdx) => barStack.bars.map((bar) => {
|
|
22616
22615
|
const isTop = stackIdx === topStackIndex;
|
|
22617
|
-
const
|
|
22616
|
+
const borderRadius2 = 6;
|
|
22618
22617
|
return isTop ? /* @__PURE__ */ jsx$1("path", {
|
|
22619
22618
|
d: `
|
|
22620
|
-
M ${bar.x +
|
|
22621
|
-
h ${bar.width - 2 *
|
|
22622
|
-
q ${
|
|
22623
|
-
v ${bar.height -
|
|
22619
|
+
M ${bar.x + borderRadius2},${bar.y}
|
|
22620
|
+
h ${bar.width - 2 * borderRadius2}
|
|
22621
|
+
q ${borderRadius2},0 ${borderRadius2},${borderRadius2}
|
|
22622
|
+
v ${bar.height - borderRadius2}
|
|
22624
22623
|
h ${-bar.width}
|
|
22625
|
-
v ${-(bar.height -
|
|
22626
|
-
q 0,${-
|
|
22624
|
+
v ${-(bar.height - borderRadius2)}
|
|
22625
|
+
q 0,${-borderRadius2} ${borderRadius2},${-borderRadius2}
|
|
22627
22626
|
z
|
|
22628
22627
|
`,
|
|
22629
22628
|
fill: bar.color,
|