impaktapps-design 0.2.993-graph.2 → 0.2.994-offset.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/impaktapps-design.es.js +28 -84
- package/dist/impaktapps-design.es.js.map +1 -1
- package/dist/impaktapps-design.umd.js +8 -8
- package/dist/impaktapps-design.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/component/BarGraph/DrawBarGraph.tsx +16 -16
- package/src/component/BarGraph/DrawHorizontalBarGraph.tsx +16 -16
- package/src/component/BottomAxis.tsx +12 -12
- package/src/component/LeftAxis.tsx +12 -12
- package/src/component/LineGraph/DrawLineGraph.tsx +12 -12
|
@@ -8135,17 +8135,8 @@ const LeftAxis = ({
|
|
|
8135
8135
|
yScale,
|
|
8136
8136
|
parentWidth
|
|
8137
8137
|
}) => {
|
|
8138
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t5;
|
|
8139
|
-
const baseCharacterWidth = 7;
|
|
8138
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t5, _u, _v, _w;
|
|
8140
8139
|
const isBandScale = typeof yScale.bandwidth === "function";
|
|
8141
|
-
let ticksArray = [];
|
|
8142
|
-
if (isBandScale) {
|
|
8143
|
-
ticksArray = yScale.domain();
|
|
8144
|
-
} else {
|
|
8145
|
-
ticksArray = yScale.ticks();
|
|
8146
|
-
}
|
|
8147
|
-
const maxLength = Math.max(...ticksArray.map((label) => String(label || "").length));
|
|
8148
|
-
const calculatedOffset = maxLength * baseCharacterWidth + 10;
|
|
8149
8140
|
return /* @__PURE__ */ jsx(AxisLeft, {
|
|
8150
8141
|
numTicks: isBandScale ? yScale.domain().length : (_a = value.main) == null ? void 0 : _a.numTicks,
|
|
8151
8142
|
scale: yScale,
|
|
@@ -8154,14 +8145,14 @@ const LeftAxis = ({
|
|
|
8154
8145
|
tickStroke: ((_d = (_c = value.style) == null ? void 0 : _c.labelStyle) == null ? void 0 : _d.tickColor) !== void 0 ? (_f = (_e = value.style) == null ? void 0 : _e.labelStyle) == null ? void 0 : _f.tickColor : "none",
|
|
8155
8146
|
strokeWidth: (_h = (_g = value.style) == null ? void 0 : _g.labelStyle) == null ? void 0 : _h.rightAxisWidth,
|
|
8156
8147
|
hideTicks: (_i = value.main) == null ? void 0 : _i.hideLeftTicks,
|
|
8157
|
-
labelOffset:
|
|
8148
|
+
labelOffset: ((_l = (_k = (_j = value == null ? void 0 : value.style) == null ? void 0 : _j.labelStyle) == null ? void 0 : _k.margin) == null ? void 0 : _l.left) - 10 || ((_n = (_m = value.style) == null ? void 0 : _m.labelStyle) == null ? void 0 : _n.leftLabelOffset),
|
|
8158
8149
|
labelProps: {
|
|
8159
|
-
fill: (
|
|
8160
|
-
fontSize: (
|
|
8161
|
-
fontWeight: (
|
|
8162
|
-
fontFamily: (
|
|
8150
|
+
fill: (_p = (_o = value.style) == null ? void 0 : _o.labelStyle) == null ? void 0 : _p.labelColor,
|
|
8151
|
+
fontSize: (_r = (_q = value.style) == null ? void 0 : _q.labelStyle) == null ? void 0 : _r.fontSize,
|
|
8152
|
+
fontWeight: (_t5 = (_s = value.style) == null ? void 0 : _s.labelStyle) == null ? void 0 : _t5.fontWeight,
|
|
8153
|
+
fontFamily: (_v = (_u = value.style) == null ? void 0 : _u.labelStyle) == null ? void 0 : _v.fontWeight
|
|
8163
8154
|
},
|
|
8164
|
-
hideAxisLine: (
|
|
8155
|
+
hideAxisLine: (_w = value.main) == null ? void 0 : _w.hideLeftAxisLine,
|
|
8165
8156
|
tickLabelProps: (e3) => {
|
|
8166
8157
|
var _a2, _b2;
|
|
8167
8158
|
return {
|
|
@@ -8181,17 +8172,8 @@ const BottomAxis = ({
|
|
|
8181
8172
|
parentWidth,
|
|
8182
8173
|
left: left2
|
|
8183
8174
|
}) => {
|
|
8184
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
8185
|
-
const baseCharacterWidth = 5;
|
|
8175
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
8186
8176
|
const isBandScale = typeof xScale.bandwidth === "function";
|
|
8187
|
-
let ticksArray = [];
|
|
8188
|
-
if (isBandScale) {
|
|
8189
|
-
ticksArray = xScale.domain();
|
|
8190
|
-
} else {
|
|
8191
|
-
ticksArray = xScale.ticks();
|
|
8192
|
-
}
|
|
8193
|
-
const maxLength = Math.max(...ticksArray.map((label) => String(label || "").length));
|
|
8194
|
-
const calculatedOffset = maxLength * baseCharacterWidth + 10;
|
|
8195
8177
|
return /* @__PURE__ */ jsx(AxisBottom, {
|
|
8196
8178
|
numTicks: isBandScale ? xScale.domain().length : (_a = value.main) == null ? void 0 : _a.numTicks,
|
|
8197
8179
|
top: yMax,
|
|
@@ -8201,9 +8183,9 @@ const BottomAxis = ({
|
|
|
8201
8183
|
strokeWidth: (_f = (_e = value.style) == null ? void 0 : _e.labelStyle) == null ? void 0 : _f.bottomAxisWidth,
|
|
8202
8184
|
scale: xScale,
|
|
8203
8185
|
stroke: (_h = (_g = value.style) == null ? void 0 : _g.labelStyle) == null ? void 0 : _h.tickColor,
|
|
8204
|
-
labelOffset:
|
|
8205
|
-
label: (
|
|
8206
|
-
tickStroke: (
|
|
8186
|
+
labelOffset: ((_i = value.main) == null ? void 0 : _i.bottomAxisAngle) ? 145 : (_k = (_j = value.style) == null ? void 0 : _j.labelStyle) == null ? void 0 : _k.bottomLabelOffset,
|
|
8187
|
+
label: (_l = value.main) == null ? void 0 : _l.bottomLabel,
|
|
8188
|
+
tickStroke: (_n = (_m = value.style) == null ? void 0 : _m.labelStyle) == null ? void 0 : _n.tickColor,
|
|
8207
8189
|
tickLabelProps: () => {
|
|
8208
8190
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
8209
8191
|
return {
|
|
@@ -9729,7 +9711,7 @@ function DrawBarGraph({
|
|
|
9729
9711
|
margin: margin2 = defaultMargin$1,
|
|
9730
9712
|
value
|
|
9731
9713
|
}) {
|
|
9732
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m
|
|
9714
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
9733
9715
|
const data = (_a = value.main) == null ? void 0 : _a.data;
|
|
9734
9716
|
const keys2 = Object.keys(data[0]).filter((d2) => d2 !== value.main.xAxisValue);
|
|
9735
9717
|
const [hoveredBar, setHoveredBar] = useState({
|
|
@@ -9760,18 +9742,6 @@ function DrawBarGraph({
|
|
|
9760
9742
|
domain: keys2,
|
|
9761
9743
|
range: value.style.barStyle.colorRange
|
|
9762
9744
|
});
|
|
9763
|
-
const baseCharacterWidth = 7;
|
|
9764
|
-
let ticksArray = [];
|
|
9765
|
-
ticksArray = tempScale.ticks();
|
|
9766
|
-
const maxLength = Math.max(...ticksArray.map((label) => String(label || "").length));
|
|
9767
|
-
const calculatedOffset = maxLength * baseCharacterWidth + 10;
|
|
9768
|
-
const baseCharacterWidthBottom = 5;
|
|
9769
|
-
let ticksArrayBottom = [];
|
|
9770
|
-
ticksArrayBottom = dateScale.domain();
|
|
9771
|
-
const maxLengthBottom = Math.max(...ticksArrayBottom.map((label) => String(label || "").length));
|
|
9772
|
-
const calculatedOffsetBottom = maxLengthBottom * baseCharacterWidthBottom + 10;
|
|
9773
|
-
margin2.left = calculatedOffset + 20;
|
|
9774
|
-
margin2.bottom = ((_c = value.main) == null ? void 0 : _c.bottomAxisAngle) ? calculatedOffsetBottom + 40 : margin2.bottom;
|
|
9775
9745
|
const xMax = width2 - margin2.left - margin2.right;
|
|
9776
9746
|
const yMax = height2 - margin2.top - margin2.bottom;
|
|
9777
9747
|
dateScale.rangeRound([0, xMax]);
|
|
@@ -9824,7 +9794,7 @@ function DrawBarGraph({
|
|
|
9824
9794
|
return date2 == null ? void 0 : date2.bars.reduce((totalWidth, bar) => totalWidth + Math.min(bar.width, 15), 0);
|
|
9825
9795
|
}
|
|
9826
9796
|
return width2 < 10 ? null : /* @__PURE__ */ jsxs("div", {
|
|
9827
|
-
children: [((
|
|
9797
|
+
children: [((_c = value == null ? void 0 : value.main) == null ? void 0 : _c.legendAvailable) && keys2.length > 1 && /* @__PURE__ */ jsx(Legend, {
|
|
9828
9798
|
dataKeyArray: keys2,
|
|
9829
9799
|
colorRange: value.style.barStyle.colorRange,
|
|
9830
9800
|
value,
|
|
@@ -9857,16 +9827,16 @@ function DrawBarGraph({
|
|
|
9857
9827
|
style: {
|
|
9858
9828
|
display: hoveredBar.date ? "block" : "none"
|
|
9859
9829
|
},
|
|
9860
|
-
x: value.main.type === "StackBarGraph" ? ((
|
|
9861
|
-
width: value.main.type !== "StackBarGraph" ? calcWidthofBar(hoveredBar == null ? void 0 : hoveredBar.date) : Math.min((
|
|
9830
|
+
x: value.main.type === "StackBarGraph" ? ((_d = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _d.bars[hoveredBar.city].x) - (Math.min((_e = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _e.bars[0].width, 15) - ((_f = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _f.bars[0].width)) / 2 : ((_g = hoveredBar.date) == null ? void 0 : _g.x0) - (Math.min((_h = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _h.bars[0].width, 15) - ((_i = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _i.bars[0].width)) || 0,
|
|
9831
|
+
width: value.main.type !== "StackBarGraph" ? calcWidthofBar(hoveredBar == null ? void 0 : hoveredBar.date) : Math.min((_j = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _j.bars[0].width, 15),
|
|
9862
9832
|
height: yMax,
|
|
9863
|
-
fill: (
|
|
9833
|
+
fill: (_l = (_k = value.style) == null ? void 0 : _k.barStyle) == null ? void 0 : _l.hoverBackgroundColor,
|
|
9864
9834
|
opacity: 1
|
|
9865
9835
|
}), /* @__PURE__ */ jsx(LeftAxis, {
|
|
9866
9836
|
value,
|
|
9867
9837
|
yScale: tempScale,
|
|
9868
9838
|
parentWidth: width2
|
|
9869
|
-
}), ((
|
|
9839
|
+
}), ((_m = value == null ? void 0 : value.main) == null ? void 0 : _m.type) === "StackBarGraph" ? /* @__PURE__ */ jsx(BarStack, {
|
|
9870
9840
|
data,
|
|
9871
9841
|
keys: keys2,
|
|
9872
9842
|
x: getDate,
|
|
@@ -20770,20 +20740,6 @@ const DrawGraph = ({
|
|
|
20770
20740
|
const yScale = createLinearScale({
|
|
20771
20741
|
domain: [0, Math.max(...data.flatMap((d2) => arr.map((key) => d2[key])))]
|
|
20772
20742
|
});
|
|
20773
|
-
const ticksArray = yScale.ticks();
|
|
20774
|
-
const baseCharacterWidth = 7;
|
|
20775
|
-
const maxLength = Math.max(...ticksArray.map((label) => {
|
|
20776
|
-
return String(label || "").length;
|
|
20777
|
-
}));
|
|
20778
|
-
const calculatedOffset = maxLength * baseCharacterWidth + 10;
|
|
20779
|
-
const ticksArrayBottom = xScale.domain();
|
|
20780
|
-
const baseCharacterWidthBottom = 4;
|
|
20781
|
-
const maxLengthBottom = Math.max(...ticksArrayBottom.map((label) => {
|
|
20782
|
-
return String(label || "").length;
|
|
20783
|
-
}));
|
|
20784
|
-
const calculatedOffsetBottom = maxLengthBottom * baseCharacterWidthBottom + 10;
|
|
20785
|
-
margin2.left = calculatedOffset + 20;
|
|
20786
|
-
margin2.bottom = ((_b = value.main) == null ? void 0 : _b.bottomAxisAngle) ? calculatedOffsetBottom + 35 : margin2.bottom;
|
|
20787
20743
|
const xMax = width2 - margin2.left - margin2.right;
|
|
20788
20744
|
const yMax = height2 - margin2.top - margin2.bottom;
|
|
20789
20745
|
yScale.range([yMax + 40, 40]);
|
|
@@ -20809,10 +20765,10 @@ const DrawGraph = ({
|
|
|
20809
20765
|
orientation: "left",
|
|
20810
20766
|
hideAxisLine: value.main.hideLeftAxisLine,
|
|
20811
20767
|
label: value.main.leftLabel,
|
|
20812
|
-
labelOffset:
|
|
20768
|
+
labelOffset: margin2.left - 10 || ((_c = (_b = value.style) == null ? void 0 : _b.labelStyle) == null ? void 0 : _c.leftLabelOffset) || 20,
|
|
20813
20769
|
labelProps: {
|
|
20814
|
-
fill: ((
|
|
20815
|
-
fontSize: ((
|
|
20770
|
+
fill: ((_e = (_d = value.style) == null ? void 0 : _d.labelStyle) == null ? void 0 : _e.labelColor) || "black",
|
|
20771
|
+
fontSize: ((_g = (_f = value.style) == null ? void 0 : _f.labelStyle) == null ? void 0 : _g.fontSize) || "12px",
|
|
20816
20772
|
fontWeight: "normal"
|
|
20817
20773
|
},
|
|
20818
20774
|
tickLabelProps: (e3) => {
|
|
@@ -20829,8 +20785,8 @@ const DrawGraph = ({
|
|
|
20829
20785
|
hideAxisLine: value.main.hideBottomAxisLine,
|
|
20830
20786
|
label: value.main.bottomLabel,
|
|
20831
20787
|
labelProps: {
|
|
20832
|
-
fill: ((
|
|
20833
|
-
fontSize: ((
|
|
20788
|
+
fill: ((_i = (_h = value.style) == null ? void 0 : _h.labelStyle) == null ? void 0 : _i.labelColor) || "black",
|
|
20789
|
+
fontSize: ((_k = (_j = value.style) == null ? void 0 : _j.labelStyle) == null ? void 0 : _k.fontSize) || "12px",
|
|
20834
20790
|
fontWeight: "normal"
|
|
20835
20791
|
},
|
|
20836
20792
|
tickLabelProps: (e3) => {
|
|
@@ -20843,7 +20799,7 @@ const DrawGraph = ({
|
|
|
20843
20799
|
};
|
|
20844
20800
|
},
|
|
20845
20801
|
tickStroke: "black",
|
|
20846
|
-
labelOffset:
|
|
20802
|
+
labelOffset: ((_l = value.main) == null ? void 0 : _l.bottomAxisAngle) ? 145 : ((_n = (_m = value.style) == null ? void 0 : _m.labelStyle) == null ? void 0 : _n.bottomLabelOffset) || 20
|
|
20847
20803
|
}), /* @__PURE__ */ jsx(Grid, {
|
|
20848
20804
|
stroke: "black",
|
|
20849
20805
|
lineStyle: {
|
|
@@ -20957,7 +20913,7 @@ var DrawHorizontalBarGraph = ({
|
|
|
20957
20913
|
margin: margin2,
|
|
20958
20914
|
barValue
|
|
20959
20915
|
}) => {
|
|
20960
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l
|
|
20916
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
20961
20917
|
const [hoveredBar, setHoveredBar] = useState({
|
|
20962
20918
|
date: null,
|
|
20963
20919
|
city: null
|
|
@@ -20988,18 +20944,6 @@ var DrawHorizontalBarGraph = ({
|
|
|
20988
20944
|
domain: keys2,
|
|
20989
20945
|
range: barValue.style.barStyle.colorRange
|
|
20990
20946
|
});
|
|
20991
|
-
const baseCharacterWidth = 7;
|
|
20992
|
-
let ticksArray = [];
|
|
20993
|
-
ticksArray = dateScale.domain();
|
|
20994
|
-
const maxLength = Math.max(...ticksArray.map((label) => String(label || "").length));
|
|
20995
|
-
const calculatedOffset = maxLength * baseCharacterWidth + 10;
|
|
20996
|
-
const baseCharacterWidthBottom = 5;
|
|
20997
|
-
let ticksArrayBottom = [];
|
|
20998
|
-
ticksArrayBottom = temperatureScale.ticks();
|
|
20999
|
-
const maxLengthBottom = Math.max(...ticksArrayBottom.map((label) => String(label || "").length));
|
|
21000
|
-
const calculatedOffsetBottom = maxLengthBottom * baseCharacterWidthBottom + 10;
|
|
21001
|
-
margin2.left = calculatedOffset + 20;
|
|
21002
|
-
margin2.bottom = ((_c = barValue.main) == null ? void 0 : _c.bottomAxisAngle) ? calculatedOffsetBottom + 40 : margin2.bottom;
|
|
21003
20947
|
const xMax = width2 - margin2.left - margin2.right;
|
|
21004
20948
|
const yMax = height2 - margin2.top - margin2.bottom;
|
|
21005
20949
|
temperatureScale.rangeRound([0, xMax]);
|
|
@@ -21052,7 +20996,7 @@ var DrawHorizontalBarGraph = ({
|
|
|
21052
20996
|
return date2 == null ? void 0 : date2.bars.reduce((totalWidth, bar) => totalWidth + Math.min(bar.height, 15), 0);
|
|
21053
20997
|
}
|
|
21054
20998
|
return width2 < 10 ? null : /* @__PURE__ */ jsxs("div", {
|
|
21055
|
-
children: [((
|
|
20999
|
+
children: [((_c = barValue == null ? void 0 : barValue.main) == null ? void 0 : _c.legendAvailable) && keys2.length > 1 && /* @__PURE__ */ jsx(Legend, {
|
|
21056
21000
|
dataKeyArray: keys2,
|
|
21057
21001
|
colorRange: barValue.style.barStyle.colorRange,
|
|
21058
21002
|
value: barValue,
|
|
@@ -21085,10 +21029,10 @@ var DrawHorizontalBarGraph = ({
|
|
|
21085
21029
|
style: {
|
|
21086
21030
|
display: hoveredBar.date ? "block" : "none"
|
|
21087
21031
|
},
|
|
21088
|
-
y: barValue.main.type === "HorizontalStackBarGraph" ? ((
|
|
21032
|
+
y: barValue.main.type === "HorizontalStackBarGraph" ? ((_d = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _d.bars[hoveredBar.city].y) - (Math.min((_e = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _e.bars[0].height, 15) - ((_f = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _f.bars[0].height)) / 2 : ((_g = hoveredBar.date) == null ? void 0 : _g.y0) - (Math.min((_h = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _h.bars[0].height, 15) - ((_i = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _i.bars[0].height)) || 0,
|
|
21089
21033
|
width: xMax,
|
|
21090
|
-
height: barValue.main.type !== "HorizontalStackBarGraph" ? calcWidthofBar(hoveredBar == null ? void 0 : hoveredBar.date) : Math.min((
|
|
21091
|
-
fill: (
|
|
21034
|
+
height: barValue.main.type !== "HorizontalStackBarGraph" ? calcWidthofBar(hoveredBar == null ? void 0 : hoveredBar.date) : Math.min((_j = hoveredBar == null ? void 0 : hoveredBar.date) == null ? void 0 : _j.bars[0].height, 15),
|
|
21035
|
+
fill: (_l = (_k = barValue.style) == null ? void 0 : _k.barStyle) == null ? void 0 : _l.hoverBackgroundColor,
|
|
21092
21036
|
opacity: 1
|
|
21093
21037
|
}), barValue.main.type === "HorizontalStackBarGraph" ? /* @__PURE__ */ jsx(BarStackHorizontal, {
|
|
21094
21038
|
data,
|