impaktapps-design 0.2.993-alpha.236 → 0.2.993-alpha.237
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 +33 -17
- package/dist/impaktapps-design.es.js.map +1 -1
- package/dist/impaktapps-design.umd.js +23 -23
- package/dist/impaktapps-design.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/component/AreaGraph/DrawAreaGraph.tsx +27 -20
- package/src/component/StackBarLineGraph/DrawStackBarLineGraph.tsx +10 -7
|
@@ -22161,7 +22161,8 @@ LinearGradient.propTypes = {
|
|
|
22161
22161
|
children: _pt.node,
|
|
22162
22162
|
vertical: _pt.bool
|
|
22163
22163
|
};
|
|
22164
|
-
const PX_PER_CHAR$1 =
|
|
22164
|
+
const PX_PER_CHAR$1 = 7;
|
|
22165
|
+
const LABEL_ROTATION$1 = Math.sin(40 * Math.PI / 180);
|
|
22165
22166
|
const DrawAreaGraph = ({
|
|
22166
22167
|
width: width2,
|
|
22167
22168
|
height: height2,
|
|
@@ -22187,10 +22188,9 @@ const DrawAreaGraph = ({
|
|
|
22187
22188
|
const legendLabels = (_g = areaValue.main) == null ? void 0 : _g.legendLabels;
|
|
22188
22189
|
const colorMap = (_i = (_h = areaValue.style) == null ? void 0 : _h.areaStyle) == null ? void 0 : _i.colorMap;
|
|
22189
22190
|
const defaultColour = (_k = (_j = theme.myTheme.palette) == null ? void 0 : _j.primary) == null ? void 0 : _k.main;
|
|
22190
|
-
const
|
|
22191
|
-
const isSmallScreen = useMediaQuery(muiTheme.breakpoints.down("sm"));
|
|
22191
|
+
const isSmallScreen = width2 < 600;
|
|
22192
22192
|
const longestLabelLength = useMemo(() => Math.max(...chartData.map((d2) => String(d2[xAxisValue]).length)), [chartData, xAxisValue]);
|
|
22193
|
-
const dynamicBottomMargin = longestLabelLength * PX_PER_CHAR$1;
|
|
22193
|
+
const dynamicBottomMargin = Math.ceil(longestLabelLength * PX_PER_CHAR$1 * LABEL_ROTATION$1);
|
|
22194
22194
|
const margin2 = {
|
|
22195
22195
|
...marginProp,
|
|
22196
22196
|
bottom: isSmallScreen ? Math.max(marginProp.bottom, dynamicBottomMargin) : marginProp.bottom
|
|
@@ -22286,18 +22286,26 @@ const DrawAreaGraph = ({
|
|
|
22286
22286
|
tooltipTop: yScale(tooltipPoint[labelsArray[0]] || 0)
|
|
22287
22287
|
});
|
|
22288
22288
|
};
|
|
22289
|
-
const tickLabelProps = () => isSmallScreen ? {
|
|
22289
|
+
const tickLabelProps = useCallback(() => isSmallScreen ? {
|
|
22290
22290
|
fill: "#6B7280",
|
|
22291
|
-
fontSize:
|
|
22291
|
+
fontSize: 12,
|
|
22292
22292
|
fontWeight: 600,
|
|
22293
22293
|
textAnchor: "end",
|
|
22294
|
-
angle: -40
|
|
22294
|
+
angle: -40,
|
|
22295
|
+
dx: "-0.2em",
|
|
22296
|
+
dy: "0.1em",
|
|
22297
|
+
style: {
|
|
22298
|
+
transition: "transform 0.2s ease"
|
|
22299
|
+
}
|
|
22295
22300
|
} : {
|
|
22296
22301
|
fill: "#6B7280",
|
|
22297
|
-
fontSize:
|
|
22298
|
-
fontWeight:
|
|
22299
|
-
textAnchor: "middle"
|
|
22300
|
-
|
|
22302
|
+
fontSize: 12,
|
|
22303
|
+
fontWeight: 500,
|
|
22304
|
+
textAnchor: "middle",
|
|
22305
|
+
style: {
|
|
22306
|
+
transition: "transform 0.2s ease"
|
|
22307
|
+
}
|
|
22308
|
+
}, [isSmallScreen]);
|
|
22301
22309
|
return /* @__PURE__ */ jsxs("div", {
|
|
22302
22310
|
style: {
|
|
22303
22311
|
position: "relative"
|
|
@@ -22506,7 +22514,8 @@ const AreaGraph = ({
|
|
|
22506
22514
|
});
|
|
22507
22515
|
};
|
|
22508
22516
|
const GROWTH_RATE_KEY = "growthRate";
|
|
22509
|
-
const PX_PER_CHAR =
|
|
22517
|
+
const PX_PER_CHAR = 7;
|
|
22518
|
+
const LABEL_ROTATION = Math.sin(40 * Math.PI / 180);
|
|
22510
22519
|
const DrawStackBarLineGraph = ({
|
|
22511
22520
|
width: width2,
|
|
22512
22521
|
height: height2,
|
|
@@ -22532,10 +22541,9 @@ const DrawStackBarLineGraph = ({
|
|
|
22532
22541
|
const yAxisTickCount = (_i = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _i.yAxisTickCount;
|
|
22533
22542
|
const disableLeftLabel = (_j = stackBarLineValue.main) == null ? void 0 : _j.disableLeftLabel;
|
|
22534
22543
|
const trendColor = (_k = colorMap == null ? void 0 : colorMap[GROWTH_RATE_KEY]) != null ? _k : "#E24B4A";
|
|
22535
|
-
const
|
|
22536
|
-
const isSmallScreen = useMediaQuery(muiTheme.breakpoints.down("sm"));
|
|
22544
|
+
const isSmallScreen = width2 < 600;
|
|
22537
22545
|
const longestLabelLength = useMemo(() => Math.max(...chartData.map((d2) => String(d2[xAxisValue]).length)), [chartData, xAxisValue]);
|
|
22538
|
-
const dynamicBottomMargin = longestLabelLength * PX_PER_CHAR;
|
|
22546
|
+
const dynamicBottomMargin = Math.ceil(longestLabelLength * PX_PER_CHAR * LABEL_ROTATION);
|
|
22539
22547
|
const margin2 = {
|
|
22540
22548
|
...marginProp,
|
|
22541
22549
|
bottom: isSmallScreen ? Math.max(marginProp.bottom, dynamicBottomMargin) : marginProp.bottom
|
|
@@ -22602,12 +22610,20 @@ const DrawStackBarLineGraph = ({
|
|
|
22602
22610
|
fontSize: 12,
|
|
22603
22611
|
fontWeight: 500,
|
|
22604
22612
|
textAnchor: "end",
|
|
22605
|
-
angle: -40
|
|
22613
|
+
angle: -40,
|
|
22614
|
+
dx: "-0.2em",
|
|
22615
|
+
dy: "0.1em",
|
|
22616
|
+
style: {
|
|
22617
|
+
transition: "transform 0.2s ease"
|
|
22618
|
+
}
|
|
22606
22619
|
} : {
|
|
22607
22620
|
fill: "#6B7280",
|
|
22608
22621
|
fontSize: 12,
|
|
22609
22622
|
fontWeight: 500,
|
|
22610
|
-
textAnchor: "middle"
|
|
22623
|
+
textAnchor: "middle",
|
|
22624
|
+
style: {
|
|
22625
|
+
transition: "transform 0.2s ease"
|
|
22626
|
+
}
|
|
22611
22627
|
}, [isSmallScreen]);
|
|
22612
22628
|
return /* @__PURE__ */ jsxs("div", {
|
|
22613
22629
|
style: {
|