impaktapps-design 0.2.993-alpha.241 → 0.2.993-alpha.243
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 +48 -44
- package/dist/impaktapps-design.es.js.map +1 -1
- package/dist/impaktapps-design.umd.js +24 -24
- package/dist/impaktapps-design.umd.js.map +1 -1
- package/dist/src/component/StackBarLineGraph/DrawStackBarLineGraph.d.ts +1 -12
- package/dist/src/component/StackBarLineGraph/StackBarLineGraph.d.ts +2 -4
- package/dist/src/component/StackBarLineGraph/interface.d.ts +47 -0
- package/package.json +1 -1
- package/src/component/StackBarLineGraph/DrawStackBarLineGraph.tsx +14 -17
- package/src/component/StackBarLineGraph/StackBarLineGraph.tsx +2 -1
- package/src/component/StackBarLineGraph/interface.ts +41 -0
- package/src/utils/finalDataProvider.ts +6 -5
|
@@ -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, _x, _y, _z, _A, _B, _C;
|
|
19150
19150
|
switch (type2) {
|
|
19151
19151
|
case "BarGraph":
|
|
19152
19152
|
case "StackBarGraph":
|
|
@@ -19173,8 +19173,8 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19173
19173
|
...(_c = value.style) == null ? void 0 : _c.labelStyle
|
|
19174
19174
|
},
|
|
19175
19175
|
barStyle: {
|
|
19176
|
-
...value.style,
|
|
19177
|
-
colorMap: (
|
|
19176
|
+
...(_d = value.style) == null ? void 0 : _d.barStyle,
|
|
19177
|
+
colorMap: (_e = value.style) == null ? void 0 : _e.colorMap
|
|
19178
19178
|
}
|
|
19179
19179
|
}
|
|
19180
19180
|
};
|
|
@@ -19186,7 +19186,7 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19186
19186
|
outerRadius: 117,
|
|
19187
19187
|
innerRadius: 63,
|
|
19188
19188
|
...value.main,
|
|
19189
|
-
data: ((
|
|
19189
|
+
data: ((_f = value.main.data) == null ? void 0 : _f.length) > 0 ? value.main.data : [{ label: "No Data", value: 100 }],
|
|
19190
19190
|
legend: {
|
|
19191
19191
|
direction: "column",
|
|
19192
19192
|
...value.main.legend
|
|
@@ -19195,11 +19195,11 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19195
19195
|
style: {
|
|
19196
19196
|
containerStyle: {
|
|
19197
19197
|
height: "300",
|
|
19198
|
-
...(
|
|
19198
|
+
...(_g = value.style) == null ? void 0 : _g.containerStyle
|
|
19199
19199
|
},
|
|
19200
19200
|
pieStyle: {
|
|
19201
|
-
...value.style,
|
|
19202
|
-
colorMap: (
|
|
19201
|
+
...(_h = value.style) == null ? void 0 : _h.pieStyle,
|
|
19202
|
+
colorMap: (_i = value.style) == null ? void 0 : _i.colorMap
|
|
19203
19203
|
}
|
|
19204
19204
|
}
|
|
19205
19205
|
};
|
|
@@ -19209,7 +19209,7 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19209
19209
|
legendAvailable: true,
|
|
19210
19210
|
xAxisValue: "label",
|
|
19211
19211
|
...value.main,
|
|
19212
|
-
data: ((
|
|
19212
|
+
data: ((_j = value.main.data) == null ? void 0 : _j.length) ? value.main.data : [{ "No Data": 0 }],
|
|
19213
19213
|
legend: {
|
|
19214
19214
|
direction: "row",
|
|
19215
19215
|
...value.main.legend
|
|
@@ -19219,14 +19219,14 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19219
19219
|
containerStyle: {
|
|
19220
19220
|
background: theme.myTheme.palette.background.default,
|
|
19221
19221
|
height: "300",
|
|
19222
|
-
...(
|
|
19222
|
+
...(_k = value.style) == null ? void 0 : _k.containerStyle
|
|
19223
19223
|
},
|
|
19224
19224
|
labelStyle: {
|
|
19225
|
-
...(
|
|
19225
|
+
...(_l = value.style) == null ? void 0 : _l.labelStyle
|
|
19226
19226
|
},
|
|
19227
19227
|
lineStyle: {
|
|
19228
|
-
...value.style,
|
|
19229
|
-
colorMap: (
|
|
19228
|
+
...(_m = value.style) == null ? void 0 : _m.lineStyle,
|
|
19229
|
+
colorMap: (_n = value.style) == null ? void 0 : _n.colorMap
|
|
19230
19230
|
}
|
|
19231
19231
|
}
|
|
19232
19232
|
};
|
|
@@ -19234,11 +19234,11 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19234
19234
|
return {
|
|
19235
19235
|
main: {
|
|
19236
19236
|
legendAvailable: true,
|
|
19237
|
-
xAxisValue: ((
|
|
19238
|
-
xAxisType: ((
|
|
19237
|
+
xAxisValue: ((_o = value.main) == null ? void 0 : _o.xAxisValue) || "label",
|
|
19238
|
+
xAxisType: ((_p = value.main) == null ? void 0 : _p.xAxisType) || "date",
|
|
19239
19239
|
...value.main,
|
|
19240
|
-
xAxisFormatType: ((
|
|
19241
|
-
data: ((
|
|
19240
|
+
xAxisFormatType: ((_q = value.main) == null ? void 0 : _q.xAxisSchemaFormat) || ((_r = value.main) == null ? void 0 : _r.xAxisFormatType) || "Date and Month",
|
|
19241
|
+
data: ((_s = value.main.data) == null ? void 0 : _s.length) ? value.main.data : [{ label: "", total: 0 }],
|
|
19242
19242
|
legend: {
|
|
19243
19243
|
direction: "row",
|
|
19244
19244
|
...value.main.legend
|
|
@@ -19248,14 +19248,14 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19248
19248
|
containerStyle: {
|
|
19249
19249
|
background: theme.myTheme.palette.background.default,
|
|
19250
19250
|
height: "300",
|
|
19251
|
-
...(
|
|
19251
|
+
...(_t5 = value.style) == null ? void 0 : _t5.containerStyle
|
|
19252
19252
|
},
|
|
19253
19253
|
labelStyle: {
|
|
19254
|
-
...(
|
|
19254
|
+
...(_u = value.style) == null ? void 0 : _u.labelStyle
|
|
19255
19255
|
},
|
|
19256
19256
|
areaStyle: {
|
|
19257
|
-
...value.style,
|
|
19258
|
-
colorMap: (
|
|
19257
|
+
...(_v = value.style) == null ? void 0 : _v.areaStyle,
|
|
19258
|
+
colorMap: (_w = value.style) == null ? void 0 : _w.colorMap
|
|
19259
19259
|
}
|
|
19260
19260
|
}
|
|
19261
19261
|
};
|
|
@@ -19263,9 +19263,9 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19263
19263
|
return {
|
|
19264
19264
|
main: {
|
|
19265
19265
|
legendAvailable: true,
|
|
19266
|
-
xAxisValue: ((
|
|
19266
|
+
xAxisValue: ((_x = value.main) == null ? void 0 : _x.xAxisValue) || "label",
|
|
19267
19267
|
...value.main,
|
|
19268
|
-
data: ((
|
|
19268
|
+
data: ((_y = value.main.data) == null ? void 0 : _y.length) ? value.main.data : [{}],
|
|
19269
19269
|
legend: {
|
|
19270
19270
|
direction: "row",
|
|
19271
19271
|
...value.main.legend
|
|
@@ -19275,13 +19275,14 @@ const finalDataProvider = (type2, value, theme) => {
|
|
|
19275
19275
|
containerStyle: {
|
|
19276
19276
|
background: theme.myTheme.palette.background.default,
|
|
19277
19277
|
height: "300",
|
|
19278
|
-
...(
|
|
19278
|
+
...(_z = value.style) == null ? void 0 : _z.containerStyle
|
|
19279
19279
|
},
|
|
19280
19280
|
labelStyle: {
|
|
19281
|
-
...(
|
|
19281
|
+
...(_A = value.style) == null ? void 0 : _A.labelStyle
|
|
19282
19282
|
},
|
|
19283
19283
|
stackBarLineStyle: {
|
|
19284
|
-
...value.style
|
|
19284
|
+
...(_B = value.style) == null ? void 0 : _B.stackBarLineStyle,
|
|
19285
|
+
colorMap: (_C = value.style) == null ? void 0 : _C.colorMap
|
|
19285
19286
|
}
|
|
19286
19287
|
}
|
|
19287
19288
|
};
|
|
@@ -22513,7 +22514,6 @@ const AreaGraph = ({
|
|
|
22513
22514
|
}), GraphRender]
|
|
22514
22515
|
});
|
|
22515
22516
|
};
|
|
22516
|
-
const GROWTH_RATE_KEY = "growthRate";
|
|
22517
22517
|
const PX_PER_CHAR = 9;
|
|
22518
22518
|
const LABEL_ROTATION = Math.sin(40 * Math.PI / 180);
|
|
22519
22519
|
const DrawStackBarLineGraph = ({
|
|
@@ -22523,7 +22523,7 @@ const DrawStackBarLineGraph = ({
|
|
|
22523
22523
|
stackBarLineValue,
|
|
22524
22524
|
theme
|
|
22525
22525
|
}) => {
|
|
22526
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
22526
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
22527
22527
|
const {
|
|
22528
22528
|
tooltipData,
|
|
22529
22529
|
tooltipLeft,
|
|
@@ -22533,14 +22533,16 @@ const DrawStackBarLineGraph = ({
|
|
|
22533
22533
|
hideTooltip
|
|
22534
22534
|
} = useTooltip();
|
|
22535
22535
|
const [hoveredCategory, setHoveredCategory] = useState(null);
|
|
22536
|
-
const chartData = (_a = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _a.data;
|
|
22537
|
-
const xAxisValue = (
|
|
22538
|
-
const legendLabels = (
|
|
22539
|
-
const
|
|
22540
|
-
const
|
|
22541
|
-
const
|
|
22542
|
-
const
|
|
22543
|
-
const
|
|
22536
|
+
const chartData = (_b = (_a = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _a.data) != null ? _b : [];
|
|
22537
|
+
const xAxisValue = (_c = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _c.xAxisValue;
|
|
22538
|
+
const legendLabels = (_d = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _d.legendLabels;
|
|
22539
|
+
const growthRateKey = ((_e = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _e.growthRateKey) || "growthRate";
|
|
22540
|
+
const colorMap = (_g = (_f = stackBarLineValue == null ? void 0 : stackBarLineValue.style) == null ? void 0 : _f.stackBarLineStyle) == null ? void 0 : _g.colorMap;
|
|
22541
|
+
const defaultColour = (_j = (_i = (_h = theme == null ? void 0 : theme.myTheme) == null ? void 0 : _h.palette) == null ? void 0 : _i.primary) == null ? void 0 : _j.main;
|
|
22542
|
+
const yAxisTickCount = (_k = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _k.yAxisTickCount;
|
|
22543
|
+
const disableLeftLabel = (_l = stackBarLineValue.main) == null ? void 0 : _l.disableLeftLabel;
|
|
22544
|
+
const tooltipUnit = (_m = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _m.tooltipUnit;
|
|
22545
|
+
const trendColor = (_n = colorMap == null ? void 0 : colorMap[growthRateKey]) != null ? _n : "#E24B4A";
|
|
22544
22546
|
const isSmallScreen = width2 < 600;
|
|
22545
22547
|
const longestLabelLength = useMemo(() => Math.max(...chartData.map((d2) => String(d2[xAxisValue]).length)), [chartData, xAxisValue]);
|
|
22546
22548
|
const dynamicBottomMargin = Math.ceil(longestLabelLength * PX_PER_CHAR * LABEL_ROTATION);
|
|
@@ -22553,7 +22555,7 @@ const DrawStackBarLineGraph = ({
|
|
|
22553
22555
|
return [];
|
|
22554
22556
|
return Object.keys(chartData[0]).filter((k2) => k2 !== xAxisValue);
|
|
22555
22557
|
}, [chartData, xAxisValue]);
|
|
22556
|
-
const barKeys = useMemo(() => labelsArray.filter((k2) => k2 !==
|
|
22558
|
+
const barKeys = useMemo(() => labelsArray.filter((k2) => k2 !== growthRateKey), [labelsArray]);
|
|
22557
22559
|
const barData = useMemo(() => chartData.map((row) => {
|
|
22558
22560
|
const stripped = {
|
|
22559
22561
|
[xAxisValue]: row[xAxisValue]
|
|
@@ -22577,9 +22579,11 @@ const DrawStackBarLineGraph = ({
|
|
|
22577
22579
|
nice: true
|
|
22578
22580
|
}), [innerHeight, maxStacked]);
|
|
22579
22581
|
const trendScale = useMemo(() => {
|
|
22580
|
-
const vals = chartData.map((d2) => Number(d2[
|
|
22582
|
+
const vals = chartData.map((d2) => Number(d2[growthRateKey]) || 0);
|
|
22583
|
+
const min2 = Math.min(...vals);
|
|
22584
|
+
const max2 = Math.max(...vals);
|
|
22581
22585
|
return createLinearScale({
|
|
22582
|
-
domain: [
|
|
22586
|
+
domain: min2 === max2 ? [min2 - 1, max2 + 1] : [min2, max2],
|
|
22583
22587
|
range: [innerHeight, 0],
|
|
22584
22588
|
nice: true
|
|
22585
22589
|
});
|
|
@@ -22589,11 +22593,11 @@ const DrawStackBarLineGraph = ({
|
|
|
22589
22593
|
return ((_a2 = categoryScale(cat)) != null ? _a2 : 0) + categoryScale.bandwidth() / 2;
|
|
22590
22594
|
}, [categoryScale]);
|
|
22591
22595
|
const getLineX = useCallback((d2) => getBarCentreX(d2[xAxisValue]), [getBarCentreX, xAxisValue]);
|
|
22592
|
-
const getLineY = useCallback((d2) => trendScale(Number(d2[
|
|
22596
|
+
const getLineY = useCallback((d2) => trendScale(Number(d2[growthRateKey]) || 0), [trendScale]);
|
|
22593
22597
|
const handleColumnEnter = useCallback((_e2, cat) => {
|
|
22594
22598
|
const full = chartData.find((d2) => d2[xAxisValue] === cat);
|
|
22595
22599
|
const dotX = getBarCentreX(cat) + margin2.left;
|
|
22596
|
-
const dotY = trendScale(Number(full[
|
|
22600
|
+
const dotY = trendScale(Number(full[growthRateKey]) || 0) + margin2.top;
|
|
22597
22601
|
setHoveredCategory(cat);
|
|
22598
22602
|
showTooltip({
|
|
22599
22603
|
tooltipData: full,
|
|
@@ -22738,7 +22742,7 @@ const DrawStackBarLineGraph = ({
|
|
|
22738
22742
|
textAnchor: "end",
|
|
22739
22743
|
dy: "0.33em"
|
|
22740
22744
|
}),
|
|
22741
|
-
label: !disableLeftLabel ? (
|
|
22745
|
+
label: !disableLeftLabel ? (_o = stackBarLineValue.main) == null ? void 0 : _o.leftLabel : void 0,
|
|
22742
22746
|
labelProps: {
|
|
22743
22747
|
fill: "#6B7280",
|
|
22744
22748
|
fontSize: 11,
|
|
@@ -22750,7 +22754,7 @@ const DrawStackBarLineGraph = ({
|
|
|
22750
22754
|
scale: trendScale,
|
|
22751
22755
|
numTicks: 5,
|
|
22752
22756
|
stroke: "#9CA3AF",
|
|
22753
|
-
label: (
|
|
22757
|
+
label: (_p = stackBarLineValue.main) == null ? void 0 : _p.rightLabel,
|
|
22754
22758
|
tickStroke: "transparent",
|
|
22755
22759
|
tickLabelProps: () => ({
|
|
22756
22760
|
fill: "#6B7280",
|
|
@@ -22768,7 +22772,7 @@ const DrawStackBarLineGraph = ({
|
|
|
22768
22772
|
top: innerHeight,
|
|
22769
22773
|
scale: categoryScale,
|
|
22770
22774
|
stroke: "#9CA3AF",
|
|
22771
|
-
label: (
|
|
22775
|
+
label: (_q = stackBarLineValue.main) == null ? void 0 : _q.bottomLabel,
|
|
22772
22776
|
tickStroke: "transparent",
|
|
22773
22777
|
tickLabelProps
|
|
22774
22778
|
})]
|
|
@@ -22829,7 +22833,7 @@ const DrawStackBarLineGraph = ({
|
|
|
22829
22833
|
color: "#454444",
|
|
22830
22834
|
fontWeight: 600
|
|
22831
22835
|
},
|
|
22832
|
-
children: [tooltipData[key],
|
|
22836
|
+
children: [tooltipData[key], tooltipUnit]
|
|
22833
22837
|
})]
|
|
22834
22838
|
}, key);
|
|
22835
22839
|
})
|