gifted-charts-core 0.0.24 → 0.0.26
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/package.json +6 -2
- package/src/BarChart/Animated2DWithGradient.d.ts +24 -0
- package/src/BarChart/Animated2DWithGradient.js +108 -0
- package/src/BarChart/RenderStackBars.d.ts +27 -0
- package/src/BarChart/RenderStackBars.js +99 -0
- package/src/BarChart/index.d.ts +175 -0
- package/src/BarChart/index.js +611 -0
- package/src/BarChart/types.d.ts +570 -0
- package/src/BarChart/types.js +1 -0
- package/src/LineChart/LineChartBiColor.d.ts +104 -0
- package/src/LineChart/LineChartBiColor.js +520 -0
- package/src/LineChart/index.d.ts +383 -0
- package/src/LineChart/index.js +1397 -0
- package/src/LineChart/index.ts +4 -3
- package/src/LineChart/types.d.ts +531 -0
- package/src/LineChart/types.js +1 -0
- package/src/PieChart/index.d.ts +33 -0
- package/src/PieChart/index.js +119 -0
- package/src/PieChart/main.d.ts +49 -0
- package/src/PieChart/main.js +185 -0
- package/src/PieChart/types.d.ts +85 -0
- package/src/PieChart/types.js +1 -0
- package/src/PopulationPyramid/index.d.ts +137 -0
- package/src/PopulationPyramid/index.js +233 -0
- package/src/PopulationPyramid/index.ts +70 -42
- package/src/PopulationPyramid/types.d.ts +235 -0
- package/src/PopulationPyramid/types.js +1 -0
- package/src/PopulationPyramid/types.ts +62 -5
- package/src/components/AnimatedThreeDBar/index.d.ts +12 -0
- package/src/components/AnimatedThreeDBar/index.js +53 -0
- package/src/components/BarAndLineChartsWrapper/getHorizSectionsVals.d.ts +20 -0
- package/src/components/BarAndLineChartsWrapper/getHorizSectionsVals.js +217 -0
- package/src/components/BarAndLineChartsWrapper/index.d.ts +97 -0
- package/src/components/BarAndLineChartsWrapper/index.js +266 -0
- package/src/components/BarAndLineChartsWrapper/index.ts +5 -4
- package/src/components/common/StripAndLabel.d.ts +7 -0
- package/src/components/common/StripAndLabel.js +53 -0
- package/src/components/common/StripAndLabel.ts +2 -2
- package/src/components/common/types.d.ts +31 -0
- package/src/components/common/types.js +1 -0
- package/src/components/common/types.ts +1 -0
- package/src/index.d.ts +37 -0
- package/src/index.js +32 -0
- package/src/index.ts +146 -0
- package/src/utils/constants.d.ts +248 -0
- package/src/utils/constants.js +299 -0
- package/src/utils/constants.ts +0 -4
- package/src/utils/index.d.ts +89 -0
- package/src/utils/index.js +1008 -0
- package/src/utils/index.ts +42 -1
- package/src/utils/types.d.ts +337 -0
- package/src/utils/types.js +16 -0
- package/src/utils/types.ts +6 -0
- package/index.ts +0 -141
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
import { getStrokeDashArray } from '../utils';
|
|
27
|
+
import { AxesAndRulesDefaults, populationDefaults } from '../utils/constants';
|
|
28
|
+
import { Framework } from '../utils/types';
|
|
29
|
+
export var usePopulationPyramid = function (props) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
31
|
+
var framework = props.framework, _v = props.height, height = _v === void 0 ? populationDefaults.height : _v, _w = props.width, width = _w === void 0 ? props.screenWidth : _w, _x = props.verticalMarginBetweenBars, verticalMarginBetweenBars = _x === void 0 ? populationDefaults.verticalMarginBetweenBars : _x, _y = props.barsMapToYAxisSections, barsMapToYAxisSections = _y === void 0 ? populationDefaults.barsMapToYAxisSections : _y, data = props.data, _z = props.hideRules, hideRules = _z === void 0 ? AxesAndRulesDefaults.hideRules : _z, _0 = props.hideYAxisText, hideYAxisText = _0 === void 0 ? AxesAndRulesDefaults.hideYAxisText : _0, _1 = props.yAxisThickness, yAxisThickness = _1 === void 0 ? AxesAndRulesDefaults.yAxisThickness : _1, _2 = props.xAxisThickness, xAxisThickness = _2 === void 0 ? AxesAndRulesDefaults.xAxisThickness : _2, _3 = props.xAxisType, xAxisType = _3 === void 0 ? AxesAndRulesDefaults.xAxisType : _3, _4 = props.xAxisNoOfSections, xAxisNoOfSections = _4 === void 0 ? populationDefaults.xAxisNoOfSections : _4, _5 = props.showXAxisIndices, showXAxisIndices = _5 === void 0 ? populationDefaults.showXAxisIndices : _5, _6 = props.xAxisIndicesWidth, xAxisIndicesWidth = _6 === void 0 ? populationDefaults.xAxisIndicesWidth : _6, _7 = props.xAxisIndicesHeight, xAxisIndicesHeight = _7 === void 0 ? populationDefaults.xAxisIndicesHeight : _7, _8 = props.xAxisIndicesShiftY, xAxisIndicesShiftY = _8 === void 0 ? 0 : _8, _9 = props.showXAxisLabelTexts, showXAxisLabelTexts = _9 === void 0 ? populationDefaults.showXAxisLabelTexts : _9, _10 = props.xAxisLabelFontSize, xAxisLabelFontSize = _10 === void 0 ? populationDefaults.defaultFontSize : _10, _11 = props.xAxisLabelFontStyle, xAxisLabelFontStyle = _11 === void 0 ? populationDefaults.defaultFontStyle : _11, _12 = props.xAxisLabelFontWeight, xAxisLabelFontWeight = _12 === void 0 ? populationDefaults.defaultFontWeight : _12, _13 = props.xAxisLabelFontFamily, xAxisLabelFontFamily = _13 === void 0 ? populationDefaults.defaultFontFamily : _13, _14 = props.xAxisLabelShiftX, xAxisLabelShiftX = _14 === void 0 ? 0 : _14, _15 = props.xAxisLabelShiftY, xAxisLabelShiftY = _15 === void 0 ? 0 : _15, _16 = props.xAxisLabelPrefix, xAxisLabelPrefix = _16 === void 0 ? populationDefaults.prefix : _16, _17 = props.xAxisLabelSuffix, xAxisLabelSuffix = _17 === void 0 ? populationDefaults.suffix : _17, formatXAxisLabels = props.formatXAxisLabels, _18 = props.showVerticalLines, showVerticalLines = _18 === void 0 ? populationDefaults.showVerticalLines : _18, _19 = props.verticalLinesThickness, verticalLinesThickness = _19 === void 0 ? populationDefaults.verticalLinesThickness : _19, _20 = props.verticalLinesType, verticalLinesType = _20 === void 0 ? populationDefaults.verticalLinesType : _20, _21 = props.verticalLinesStrokeDashArray, verticalLinesStrokeDashArray = _21 === void 0 ? populationDefaults.verticalLinesStrokeDashArray : _21, _22 = props.showYAxisIndices, showYAxisIndices = _22 === void 0 ? AxesAndRulesDefaults.showYAxisIndices : _22, _23 = props.yAxisIndicesWidth, yAxisIndicesWidth = _23 === void 0 ? AxesAndRulesDefaults.yAxisIndicesWidth : _23, _24 = props.yAxisIndicesHeight, yAxisIndicesHeight = _24 === void 0 ? AxesAndRulesDefaults.yAxisIndicesHeight : _24, _25 = props.yAxisLabelFontSize, yAxisLabelFontSize = _25 === void 0 ? populationDefaults.defaultFontSize : _25, _26 = props.yAxisLabelFontStyle, yAxisLabelFontStyle = _26 === void 0 ? populationDefaults.defaultFontStyle : _26, _27 = props.yAxisLabelFontWeight, yAxisLabelFontWeight = _27 === void 0 ? populationDefaults.defaultFontWeight : _27, _28 = props.yAxisLabelFontFamily, yAxisLabelFontFamily = _28 === void 0 ? populationDefaults.defaultFontFamily : _28, _29 = props.yAxisLabelTextMarginRight, yAxisLabelTextMarginRight = _29 === void 0 ? populationDefaults.yAxisLabelTextMarginRight : _29, _30 = props.yAxisLabelTexts, yAxisLabelTexts = _30 === void 0 ? [] : _30, _31 = props.showValuesAsBarLabels, showValuesAsBarLabels = _31 === void 0 ? populationDefaults.showValuesAsBarLabels : _31, _32 = props.rulesThickness, rulesThickness = _32 === void 0 ? AxesAndRulesDefaults.rulesThickness : _32, _33 = props.rulesType, rulesType = _33 === void 0 ? AxesAndRulesDefaults.rulesType : _33, _34 = props.dashWidth, dashWidth = _34 === void 0 ? AxesAndRulesDefaults.dashWidth : _34, _35 = props.dashGap, dashGap = _35 === void 0 ? AxesAndRulesDefaults.dashGap : _35, _36 = props.leftBarLabelWidth, leftBarLabelWidth = _36 === void 0 ? populationDefaults.leftBarLabelWidth : _36, _37 = props.leftBarLabelFontSize, leftBarLabelFontSize = _37 === void 0 ? (_a = props.barLabelFontSize) !== null && _a !== void 0 ? _a : populationDefaults.defaultFontSize : _37, _38 = props.leftBarLabelFontStyle, leftBarLabelFontStyle = _38 === void 0 ? (_b = props.barLabelFontStyle) !== null && _b !== void 0 ? _b : populationDefaults.defaultFontStyle : _38, _39 = props.leftBarLabelFontWeight, leftBarLabelFontWeight = _39 === void 0 ? (_c = props.barLabelFontWeight) !== null && _c !== void 0 ? _c : populationDefaults.defaultFontWeight : _39, _40 = props.leftBarLabelFontFamily, leftBarLabelFontFamily = _40 === void 0 ? (_d = props.barLabelFontFamily) !== null && _d !== void 0 ? _d : populationDefaults.defaultFontFamily : _40, _41 = props.leftBarLabelPrefix, leftBarLabelPrefix = _41 === void 0 ? populationDefaults.prefix : _41, _42 = props.leftBarLabelSuffix, leftBarLabelSuffix = _42 === void 0 ? populationDefaults.suffix : _42, _43 = props.rightBarLabelWidth, rightBarLabelWidth = _43 === void 0 ? populationDefaults.rightBarLabelWidth : _43, _44 = props.rightBarLabelFontSize, rightBarLabelFontSize = _44 === void 0 ? (_e = props.barLabelFontSize) !== null && _e !== void 0 ? _e : populationDefaults.defaultFontSize : _44, _45 = props.rightBarLabelFontStyle, rightBarLabelFontStyle = _45 === void 0 ? (_f = props.barLabelFontStyle) !== null && _f !== void 0 ? _f : populationDefaults.defaultFontStyle : _45, _46 = props.rightBarLabelFontWeight, rightBarLabelFontWeight = _46 === void 0 ? (_g = props.barLabelFontWeight) !== null && _g !== void 0 ? _g : populationDefaults.defaultFontWeight : _46, _47 = props.rightBarLabelFontFamily, rightBarLabelFontFamily = _47 === void 0 ? (_h = props.barLabelFontFamily) !== null && _h !== void 0 ? _h : populationDefaults.defaultFontFamily : _47, _48 = props.rightBarLabelPrefix, rightBarLabelPrefix = _48 === void 0 ? populationDefaults.prefix : _48, _49 = props.rightBarLabelSuffix, rightBarLabelSuffix = _49 === void 0 ? populationDefaults.suffix : _49, formatBarLabels = props.formatBarLabels, _50 = props.showMidAxis, showMidAxis = _50 === void 0 ? populationDefaults.showMidAxis : _50, _51 = props.midAxisLabelWidth, midAxisLabelWidth = _51 === void 0 ? populationDefaults.midAxisLabelWidth : _51, _52 = props.midAxisLabelFontSize, midAxisLabelFontSize = _52 === void 0 ? populationDefaults.defaultFontSize : _52, _53 = props.midAxisLabelFontStyle, midAxisLabelFontStyle = _53 === void 0 ? populationDefaults.defaultFontStyle : _53, _54 = props.midAxisLabelFontWeight, midAxisLabelFontWeight = _54 === void 0 ? populationDefaults.defaultFontWeight : _54, _55 = props.midAxisLabelFontFamily, midAxisLabelFontFamily = _55 === void 0 ? populationDefaults.defaultFontFamily : _55, _56 = props.leftBarBorderWidth, leftBarBorderWidth = _56 === void 0 ? (_j = props.barBorderWidth) !== null && _j !== void 0 ? _j : populationDefaults.leftBarBorderWidth : _56, _57 = props.rightBarBorderWidth, rightBarBorderWidth = _57 === void 0 ? (_k = props.barBorderWidth) !== null && _k !== void 0 ? _k : populationDefaults.rightBarBorderWidth : _57, _58 = props.leftBarBorderRadius, leftBarBorderRadius = _58 === void 0 ? (_l = props.barBorderRadius) !== null && _l !== void 0 ? _l : populationDefaults.leftBarBorderRadius : _58, _59 = props.rightBarBorderRadius, rightBarBorderRadius = _59 === void 0 ? (_m = props.barBorderRadius) !== null && _m !== void 0 ? _m : populationDefaults.rightBarBorderRadius : _59, _60 = props.allCornersRounded, allCornersRounded = _60 === void 0 ? populationDefaults.allCornersRounded : _60, _61 = props.showSurplus, showSurplus = _61 === void 0 ? populationDefaults.showSurplus : _61, _62 = props.showSurplusLeft, showSurplusLeft = _62 === void 0 ? populationDefaults.showSurplusLeft : _62, _63 = props.showSurplusRight, showSurplusRight = _63 === void 0 ? populationDefaults.showSurplusRight : _63, _64 = props.leftSurplusBorderWidth, leftSurplusBorderWidth = _64 === void 0 ? populationDefaults.leftSurplusBorderWidth : _64, _65 = props.rightSurplusBorderWidth, rightSurplusBorderWidth = _65 === void 0 ? populationDefaults.rightSurplusBorderWidth : _65;
|
|
32
|
+
var _66 = props.yAxisColor, yAxisColor = _66 === void 0 ? AxesAndRulesDefaults.yAxisColor : _66, _67 = props.xAxisColor, xAxisColor = _67 === void 0 ? AxesAndRulesDefaults.xAxisColor : _67, _68 = props.xAxisIndicesColor, xAxisIndicesColor = _68 === void 0 ? populationDefaults.xAxisIndicesColor : _68, _69 = props.xAxisLabelColor, xAxisLabelColor = _69 === void 0 ? populationDefaults.defaultFontColor : _69, _70 = props.verticalLinesColor, verticalLinesColor = _70 === void 0 ? populationDefaults.verticalLinesColor : _70, _71 = props.yAxisIndicesColor, yAxisIndicesColor = _71 === void 0 ? AxesAndRulesDefaults.yAxisIndicesColor : _71, _72 = props.yAxisLabelColor, yAxisLabelColor = _72 === void 0 ? populationDefaults.defaultFontColor : _72, _73 = props.rulesColor, rulesColor = _73 === void 0 ? AxesAndRulesDefaults.rulesColor : _73, _74 = props.leftBarLabelColor, leftBarLabelColor = _74 === void 0 ? (_o = props.barLabelColor) !== null && _o !== void 0 ? _o : populationDefaults.defaultFontColor : _74, _75 = props.rightBarLabelColor, rightBarLabelColor = _75 === void 0 ? (_p = props.barLabelColor) !== null && _p !== void 0 ? _p : populationDefaults.defaultFontColor : _75, _76 = props.midAxisLabelColor, midAxisLabelColor = _76 === void 0 ? populationDefaults.defaultFontColor : _76, _77 = props.leftBarColor, leftBarColor = _77 === void 0 ? populationDefaults.leftBarColor : _77, _78 = props.rightBarColor, rightBarColor = _78 === void 0 ? populationDefaults.rightBarColor : _78, _79 = props.leftBarBorderColor, leftBarBorderColor = _79 === void 0 ? populationDefaults.leftBarBorderColor : _79, _80 = props.rightBarBorderColor, rightBarBorderColor = _80 === void 0 ? populationDefaults.rightBarBorderColor : _80, _81 = props.leftSurplusColor, leftSurplusColor = _81 === void 0 ? populationDefaults.leftSurplusColor : _81, _82 = props.leftSurplusBorderColor, leftSurplusBorderColor = _82 === void 0 ? populationDefaults.leftSurplusBorderColor : _82, _83 = props.rightSurplusColor, rightSurplusColor = _83 === void 0 ? populationDefaults.rightSurplusColor : _83, _84 = props.rightSurplusBorderColor, rightSurplusBorderColor = _84 === void 0 ? populationDefaults.rightSurplusBorderColor : _84;
|
|
33
|
+
if (framework === Framework.reactJS) {
|
|
34
|
+
yAxisColor = yAxisColor.toString();
|
|
35
|
+
xAxisColor = xAxisColor.toString();
|
|
36
|
+
xAxisIndicesColor = xAxisIndicesColor.toString();
|
|
37
|
+
xAxisLabelColor = xAxisLabelColor.toString();
|
|
38
|
+
verticalLinesColor = verticalLinesColor.toString();
|
|
39
|
+
yAxisIndicesColor = yAxisIndicesColor.toString();
|
|
40
|
+
yAxisLabelColor = yAxisLabelColor.toString();
|
|
41
|
+
rulesColor = rulesColor.toString();
|
|
42
|
+
leftBarLabelColor = leftBarLabelColor.toString();
|
|
43
|
+
rightBarLabelColor = rightBarLabelColor.toString();
|
|
44
|
+
midAxisLabelColor = midAxisLabelColor.toString();
|
|
45
|
+
leftBarColor = leftBarColor.toString();
|
|
46
|
+
rightBarColor = rightBarColor.toString();
|
|
47
|
+
leftBarBorderColor = leftBarBorderColor.toString();
|
|
48
|
+
rightBarBorderColor = rightBarBorderColor.toString();
|
|
49
|
+
leftSurplusColor = leftSurplusColor.toString();
|
|
50
|
+
leftSurplusBorderColor = leftSurplusBorderColor.toString();
|
|
51
|
+
rightSurplusColor = rightSurplusColor.toString();
|
|
52
|
+
rightSurplusBorderColor = rightSurplusBorderColor.toString();
|
|
53
|
+
}
|
|
54
|
+
var yAxisLabelWidth = hideYAxisText
|
|
55
|
+
? yAxisThickness
|
|
56
|
+
: (_q = props.yAxisLabelWidth) !== null && _q !== void 0 ? _q : AxesAndRulesDefaults.yAxisLabelWidth;
|
|
57
|
+
var noOfSections = (_r = props.noOfSections) !== null && _r !== void 0 ? _r : data.length;
|
|
58
|
+
var containerHeight = props.stepHeight
|
|
59
|
+
? props.stepHeight * noOfSections
|
|
60
|
+
: height;
|
|
61
|
+
var stepHeight = (_s = props.stepHeight) !== null && _s !== void 0 ? _s : containerHeight / noOfSections;
|
|
62
|
+
var xAxisLabelsHeight = 80;
|
|
63
|
+
var containerHeightWithXaxisLabels = containerHeight + xAxisLabelsHeight;
|
|
64
|
+
var mid = (width + yAxisLabelWidth) / 2;
|
|
65
|
+
var leftMax = Math.max.apply(Math, __spreadArray([], __read(data.map(function (item) { return item.left; })), false));
|
|
66
|
+
var rightMax = Math.max.apply(Math, __spreadArray([], __read(data.map(function (item) { return item.right; })), false));
|
|
67
|
+
var max = Math.max(leftMax, rightMax);
|
|
68
|
+
var xAxisRoundToDigits = (_t = props.xAxisRoundToDigits) !== null && _t !== void 0 ? _t : (max < 0.1 ? 3 : max < 1 ? 2 : max < 10 ? 1 : 0);
|
|
69
|
+
var midAxisAndLabelWidth = (showMidAxis ? midAxisLabelWidth : 0) / 2 +
|
|
70
|
+
Math.max(leftBarLabelWidth, rightBarLabelWidth);
|
|
71
|
+
var barWidthFactor = ((width - yAxisLabelWidth) / 2 - midAxisAndLabelWidth) / max;
|
|
72
|
+
var leftXAfterMid = mid - (showMidAxis ? midAxisLabelWidth / 2 : 0);
|
|
73
|
+
var rightXAfterMid = mid + (showMidAxis ? midAxisLabelWidth / 2 : 0);
|
|
74
|
+
var yAxisLineProps = {
|
|
75
|
+
x1: yAxisLabelWidth,
|
|
76
|
+
y1: 0,
|
|
77
|
+
x2: yAxisLabelWidth,
|
|
78
|
+
y2: containerHeight,
|
|
79
|
+
stroke: yAxisColor,
|
|
80
|
+
strokeWidth: yAxisThickness
|
|
81
|
+
};
|
|
82
|
+
yAxisLineProps.strokeDasharray = getStrokeDashArray(props.yAxisStrokeDashArray, framework);
|
|
83
|
+
var midAxisLineCommonProps = {
|
|
84
|
+
y1: 0,
|
|
85
|
+
y2: containerHeight,
|
|
86
|
+
strokeWidth: (_u = props.midAxisThickness) !== null && _u !== void 0 ? _u : yAxisThickness
|
|
87
|
+
};
|
|
88
|
+
midAxisLineCommonProps.strokeDasharray = getStrokeDashArray(props.midAxisStrokeDashArray, framework);
|
|
89
|
+
var xAxisLabelY = containerHeight + xAxisLabelFontSize + 6 + xAxisLabelShiftY;
|
|
90
|
+
var xAxisIndicesCommonProps = {
|
|
91
|
+
y1: containerHeight - xAxisIndicesHeight / 2 + xAxisIndicesShiftY,
|
|
92
|
+
y2: containerHeight + xAxisIndicesHeight / 2 + xAxisIndicesShiftY,
|
|
93
|
+
stroke: xAxisIndicesColor,
|
|
94
|
+
strokeWidth: xAxisIndicesWidth
|
|
95
|
+
};
|
|
96
|
+
var verticalLinesCommonProps = {
|
|
97
|
+
y1: 0,
|
|
98
|
+
y2: containerHeight,
|
|
99
|
+
stroke: verticalLinesColor,
|
|
100
|
+
strokeWidth: verticalLinesThickness
|
|
101
|
+
};
|
|
102
|
+
verticalLinesCommonProps.strokeDasharray = getStrokeDashArray(verticalLinesStrokeDashArray);
|
|
103
|
+
var xAxisLabelsCommonProps = {
|
|
104
|
+
y: xAxisLabelY + xAxisLabelShiftY,
|
|
105
|
+
stroke: xAxisLabelColor,
|
|
106
|
+
fontSize: xAxisLabelFontSize,
|
|
107
|
+
fontStyle: xAxisLabelFontStyle,
|
|
108
|
+
fontWeight: xAxisLabelFontWeight,
|
|
109
|
+
fontFamily: xAxisLabelFontFamily
|
|
110
|
+
};
|
|
111
|
+
var getXLabel = function (index) {
|
|
112
|
+
return ((leftXAfterMid * index) / xAxisNoOfSections / barWidthFactor)
|
|
113
|
+
.toFixed(xAxisRoundToDigits)
|
|
114
|
+
.toString();
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
height: height,
|
|
118
|
+
width: width,
|
|
119
|
+
verticalMarginBetweenBars: verticalMarginBetweenBars,
|
|
120
|
+
barsMapToYAxisSections: barsMapToYAxisSections,
|
|
121
|
+
data: data,
|
|
122
|
+
hideRules: hideRules,
|
|
123
|
+
hideYAxisText: hideYAxisText,
|
|
124
|
+
yAxisColor: yAxisColor,
|
|
125
|
+
yAxisThickness: yAxisThickness,
|
|
126
|
+
xAxisColor: xAxisColor,
|
|
127
|
+
xAxisThickness: xAxisThickness,
|
|
128
|
+
xAxisType: xAxisType,
|
|
129
|
+
xAxisNoOfSections: xAxisNoOfSections,
|
|
130
|
+
showXAxisIndices: showXAxisIndices,
|
|
131
|
+
xAxisIndicesWidth: xAxisIndicesWidth,
|
|
132
|
+
xAxisIndicesHeight: xAxisIndicesHeight,
|
|
133
|
+
xAxisIndicesColor: xAxisIndicesColor,
|
|
134
|
+
xAxisIndicesShiftY: xAxisIndicesShiftY,
|
|
135
|
+
showXAxisLabelTexts: showXAxisLabelTexts,
|
|
136
|
+
xAxisLabelFontSize: xAxisLabelFontSize,
|
|
137
|
+
xAxisLabelFontStyle: xAxisLabelFontStyle,
|
|
138
|
+
xAxisLabelFontWeight: xAxisLabelFontWeight,
|
|
139
|
+
xAxisLabelFontFamily: xAxisLabelFontFamily,
|
|
140
|
+
xAxisLabelColor: xAxisLabelColor,
|
|
141
|
+
xAxisLabelShiftX: xAxisLabelShiftX,
|
|
142
|
+
xAxisLabelShiftY: xAxisLabelShiftY,
|
|
143
|
+
xAxisLabelPrefix: xAxisLabelPrefix,
|
|
144
|
+
xAxisLabelSuffix: xAxisLabelSuffix,
|
|
145
|
+
formatXAxisLabels: formatXAxisLabels,
|
|
146
|
+
showVerticalLines: showVerticalLines,
|
|
147
|
+
verticalLinesColor: verticalLinesColor,
|
|
148
|
+
verticalLinesThickness: verticalLinesThickness,
|
|
149
|
+
verticalLinesType: verticalLinesType,
|
|
150
|
+
verticalLinesStrokeDashArray: verticalLinesStrokeDashArray,
|
|
151
|
+
showYAxisIndices: showYAxisIndices,
|
|
152
|
+
yAxisIndicesWidth: yAxisIndicesWidth,
|
|
153
|
+
yAxisIndicesHeight: yAxisIndicesHeight,
|
|
154
|
+
yAxisIndicesColor: yAxisIndicesColor,
|
|
155
|
+
yAxisLabelFontSize: yAxisLabelFontSize,
|
|
156
|
+
yAxisLabelFontStyle: yAxisLabelFontStyle,
|
|
157
|
+
yAxisLabelFontWeight: yAxisLabelFontWeight,
|
|
158
|
+
yAxisLabelFontFamily: yAxisLabelFontFamily,
|
|
159
|
+
yAxisLabelColor: yAxisLabelColor,
|
|
160
|
+
yAxisLabelTextMarginRight: yAxisLabelTextMarginRight,
|
|
161
|
+
yAxisLabelTexts: yAxisLabelTexts,
|
|
162
|
+
showValuesAsBarLabels: showValuesAsBarLabels,
|
|
163
|
+
rulesThickness: rulesThickness,
|
|
164
|
+
rulesColor: rulesColor,
|
|
165
|
+
rulesType: rulesType,
|
|
166
|
+
dashWidth: dashWidth,
|
|
167
|
+
dashGap: dashGap,
|
|
168
|
+
leftBarLabelWidth: leftBarLabelWidth,
|
|
169
|
+
leftBarLabelFontSize: leftBarLabelFontSize,
|
|
170
|
+
leftBarLabelColor: leftBarLabelColor,
|
|
171
|
+
leftBarLabelFontStyle: leftBarLabelFontStyle,
|
|
172
|
+
leftBarLabelFontWeight: leftBarLabelFontWeight,
|
|
173
|
+
leftBarLabelFontFamily: leftBarLabelFontFamily,
|
|
174
|
+
leftBarLabelPrefix: leftBarLabelPrefix,
|
|
175
|
+
leftBarLabelSuffix: leftBarLabelSuffix,
|
|
176
|
+
rightBarLabelWidth: rightBarLabelWidth,
|
|
177
|
+
rightBarLabelFontSize: rightBarLabelFontSize,
|
|
178
|
+
rightBarLabelColor: rightBarLabelColor,
|
|
179
|
+
rightBarLabelFontStyle: rightBarLabelFontStyle,
|
|
180
|
+
rightBarLabelFontWeight: rightBarLabelFontWeight,
|
|
181
|
+
rightBarLabelFontFamily: rightBarLabelFontFamily,
|
|
182
|
+
rightBarLabelPrefix: rightBarLabelPrefix,
|
|
183
|
+
rightBarLabelSuffix: rightBarLabelSuffix,
|
|
184
|
+
formatBarLabels: formatBarLabels,
|
|
185
|
+
showMidAxis: showMidAxis,
|
|
186
|
+
midAxisLabelWidth: midAxisLabelWidth,
|
|
187
|
+
midAxisLabelFontSize: midAxisLabelFontSize,
|
|
188
|
+
midAxisLabelColor: midAxisLabelColor,
|
|
189
|
+
midAxisLabelFontStyle: midAxisLabelFontStyle,
|
|
190
|
+
midAxisLabelFontWeight: midAxisLabelFontWeight,
|
|
191
|
+
midAxisLabelFontFamily: midAxisLabelFontFamily,
|
|
192
|
+
leftBarColor: leftBarColor,
|
|
193
|
+
rightBarColor: rightBarColor,
|
|
194
|
+
leftBarBorderColor: leftBarBorderColor,
|
|
195
|
+
rightBarBorderColor: rightBarBorderColor,
|
|
196
|
+
leftBarBorderWidth: leftBarBorderWidth,
|
|
197
|
+
rightBarBorderWidth: rightBarBorderWidth,
|
|
198
|
+
leftBarBorderRadius: leftBarBorderRadius,
|
|
199
|
+
rightBarBorderRadius: rightBarBorderRadius,
|
|
200
|
+
allCornersRounded: allCornersRounded,
|
|
201
|
+
showSurplus: showSurplus,
|
|
202
|
+
showSurplusLeft: showSurplusLeft,
|
|
203
|
+
showSurplusRight: showSurplusRight,
|
|
204
|
+
leftSurplusColor: leftSurplusColor,
|
|
205
|
+
leftSurplusBorderColor: leftSurplusBorderColor,
|
|
206
|
+
rightSurplusColor: rightSurplusColor,
|
|
207
|
+
rightSurplusBorderColor: rightSurplusBorderColor,
|
|
208
|
+
leftSurplusBorderWidth: leftSurplusBorderWidth,
|
|
209
|
+
rightSurplusBorderWidth: rightSurplusBorderWidth,
|
|
210
|
+
yAxisLabelWidth: yAxisLabelWidth,
|
|
211
|
+
noOfSections: noOfSections,
|
|
212
|
+
containerHeight: containerHeight,
|
|
213
|
+
stepHeight: stepHeight,
|
|
214
|
+
xAxisLabelsHeight: xAxisLabelsHeight,
|
|
215
|
+
containerHeightWithXaxisLabels: containerHeightWithXaxisLabels,
|
|
216
|
+
mid: mid,
|
|
217
|
+
leftMax: leftMax,
|
|
218
|
+
rightMax: rightMax,
|
|
219
|
+
max: max,
|
|
220
|
+
xAxisRoundToDigits: xAxisRoundToDigits,
|
|
221
|
+
midAxisAndLabelWidth: midAxisAndLabelWidth,
|
|
222
|
+
barWidthFactor: barWidthFactor,
|
|
223
|
+
leftXAfterMid: leftXAfterMid,
|
|
224
|
+
rightXAfterMid: rightXAfterMid,
|
|
225
|
+
yAxisLineProps: yAxisLineProps,
|
|
226
|
+
midAxisLineCommonProps: midAxisLineCommonProps,
|
|
227
|
+
xAxisLabelY: xAxisLabelY,
|
|
228
|
+
xAxisIndicesCommonProps: xAxisIndicesCommonProps,
|
|
229
|
+
verticalLinesCommonProps: verticalLinesCommonProps,
|
|
230
|
+
xAxisLabelsCommonProps: xAxisLabelsCommonProps,
|
|
231
|
+
getXLabel: getXLabel
|
|
232
|
+
};
|
|
233
|
+
};
|
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from '../utils/constants'
|
|
6
|
-
import { type PopulationPyramidPropsType, type RulesProps } from './types'
|
|
1
|
+
import { getStrokeDashArray } from '../utils'
|
|
2
|
+
import { AxesAndRulesDefaults, populationDefaults } from '../utils/constants'
|
|
3
|
+
import { Framework } from '../utils/types'
|
|
4
|
+
import { type extendedPopulationPyramidPropsType, type RulesPropsType } from './types'
|
|
7
5
|
|
|
8
|
-
export const usePopulationPyramid = (props:
|
|
6
|
+
export const usePopulationPyramid = (props: extendedPopulationPyramidPropsType) => {
|
|
9
7
|
const {
|
|
8
|
+
framework,
|
|
10
9
|
height = populationDefaults.height,
|
|
11
|
-
width =
|
|
10
|
+
width = props.screenWidth,
|
|
12
11
|
verticalMarginBetweenBars = populationDefaults.verticalMarginBetweenBars,
|
|
13
12
|
barsMapToYAxisSections = populationDefaults.barsMapToYAxisSections,
|
|
14
13
|
data,
|
|
15
14
|
hideRules = AxesAndRulesDefaults.hideRules,
|
|
16
15
|
hideYAxisText = AxesAndRulesDefaults.hideYAxisText,
|
|
17
|
-
yAxisColor = AxesAndRulesDefaults.yAxisColor,
|
|
18
16
|
yAxisThickness = AxesAndRulesDefaults.yAxisThickness,
|
|
19
17
|
|
|
20
|
-
xAxisColor = AxesAndRulesDefaults.xAxisColor,
|
|
21
18
|
xAxisThickness = AxesAndRulesDefaults.xAxisThickness,
|
|
22
19
|
xAxisType = AxesAndRulesDefaults.xAxisType,
|
|
23
20
|
xAxisNoOfSections = populationDefaults.xAxisNoOfSections,
|
|
24
21
|
showXAxisIndices = populationDefaults.showXAxisIndices,
|
|
25
22
|
xAxisIndicesWidth = populationDefaults.xAxisIndicesWidth,
|
|
26
23
|
xAxisIndicesHeight = populationDefaults.xAxisIndicesHeight,
|
|
27
|
-
xAxisIndicesColor = populationDefaults.xAxisIndicesColor,
|
|
28
24
|
xAxisIndicesShiftY = 0,
|
|
29
25
|
showXAxisLabelTexts = populationDefaults.showXAxisLabelTexts,
|
|
30
26
|
xAxisLabelFontSize = populationDefaults.defaultFontSize,
|
|
31
27
|
xAxisLabelFontStyle = populationDefaults.defaultFontStyle,
|
|
32
28
|
xAxisLabelFontWeight = populationDefaults.defaultFontWeight,
|
|
33
29
|
xAxisLabelFontFamily = populationDefaults.defaultFontFamily,
|
|
34
|
-
xAxisLabelColor = populationDefaults.defaultFontColor,
|
|
35
30
|
xAxisLabelShiftX = 0,
|
|
36
31
|
xAxisLabelShiftY = 0,
|
|
37
32
|
xAxisLabelPrefix = populationDefaults.prefix,
|
|
@@ -39,7 +34,6 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
39
34
|
formatXAxisLabels,
|
|
40
35
|
|
|
41
36
|
showVerticalLines = populationDefaults.showVerticalLines,
|
|
42
|
-
verticalLinesColor = populationDefaults.verticalLinesColor,
|
|
43
37
|
verticalLinesThickness = populationDefaults.verticalLinesThickness,
|
|
44
38
|
verticalLinesType = populationDefaults.verticalLinesType,
|
|
45
39
|
verticalLinesStrokeDashArray = populationDefaults.verticalLinesStrokeDashArray,
|
|
@@ -47,18 +41,15 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
47
41
|
showYAxisIndices = AxesAndRulesDefaults.showYAxisIndices,
|
|
48
42
|
yAxisIndicesWidth = AxesAndRulesDefaults.yAxisIndicesWidth,
|
|
49
43
|
yAxisIndicesHeight = AxesAndRulesDefaults.yAxisIndicesHeight,
|
|
50
|
-
yAxisIndicesColor = AxesAndRulesDefaults.yAxisIndicesColor,
|
|
51
44
|
yAxisLabelFontSize = populationDefaults.defaultFontSize,
|
|
52
45
|
yAxisLabelFontStyle = populationDefaults.defaultFontStyle,
|
|
53
46
|
yAxisLabelFontWeight = populationDefaults.defaultFontWeight,
|
|
54
47
|
yAxisLabelFontFamily = populationDefaults.defaultFontFamily,
|
|
55
|
-
yAxisLabelColor = populationDefaults.defaultFontColor,
|
|
56
48
|
yAxisLabelTextMarginRight = populationDefaults.yAxisLabelTextMarginRight,
|
|
57
49
|
yAxisLabelTexts = [],
|
|
58
50
|
showValuesAsBarLabels = populationDefaults.showValuesAsBarLabels,
|
|
59
51
|
|
|
60
52
|
rulesThickness = AxesAndRulesDefaults.rulesThickness,
|
|
61
|
-
rulesColor = AxesAndRulesDefaults.rulesColor,
|
|
62
53
|
rulesType = AxesAndRulesDefaults.rulesType,
|
|
63
54
|
dashWidth = AxesAndRulesDefaults.dashWidth,
|
|
64
55
|
dashGap = AxesAndRulesDefaults.dashGap,
|
|
@@ -66,8 +57,6 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
66
57
|
leftBarLabelWidth = populationDefaults.leftBarLabelWidth,
|
|
67
58
|
leftBarLabelFontSize = props.barLabelFontSize ??
|
|
68
59
|
populationDefaults.defaultFontSize,
|
|
69
|
-
leftBarLabelColor = props.barLabelColor ??
|
|
70
|
-
populationDefaults.defaultFontColor,
|
|
71
60
|
leftBarLabelFontStyle = props.barLabelFontStyle ??
|
|
72
61
|
populationDefaults.defaultFontStyle,
|
|
73
62
|
leftBarLabelFontWeight = props.barLabelFontWeight ??
|
|
@@ -80,8 +69,6 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
80
69
|
rightBarLabelWidth = populationDefaults.rightBarLabelWidth,
|
|
81
70
|
rightBarLabelFontSize = props.barLabelFontSize ??
|
|
82
71
|
populationDefaults.defaultFontSize,
|
|
83
|
-
rightBarLabelColor = props.barLabelColor ??
|
|
84
|
-
populationDefaults.defaultFontColor,
|
|
85
72
|
rightBarLabelFontStyle = props.barLabelFontStyle ??
|
|
86
73
|
populationDefaults.defaultFontStyle,
|
|
87
74
|
rightBarLabelFontWeight = props.barLabelFontWeight ??
|
|
@@ -95,15 +82,10 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
95
82
|
showMidAxis = populationDefaults.showMidAxis,
|
|
96
83
|
midAxisLabelWidth = populationDefaults.midAxisLabelWidth,
|
|
97
84
|
midAxisLabelFontSize = populationDefaults.defaultFontSize,
|
|
98
|
-
midAxisLabelColor = populationDefaults.defaultFontColor,
|
|
99
85
|
midAxisLabelFontStyle = populationDefaults.defaultFontStyle,
|
|
100
86
|
midAxisLabelFontWeight = populationDefaults.defaultFontWeight,
|
|
101
87
|
midAxisLabelFontFamily = populationDefaults.defaultFontFamily,
|
|
102
88
|
|
|
103
|
-
leftBarColor = populationDefaults.leftBarColor,
|
|
104
|
-
rightBarColor = populationDefaults.rightBarColor,
|
|
105
|
-
leftBarBorderColor = populationDefaults.leftBarBorderColor,
|
|
106
|
-
rightBarBorderColor = populationDefaults.rightBarBorderColor,
|
|
107
89
|
leftBarBorderWidth = props.barBorderWidth ??
|
|
108
90
|
populationDefaults.leftBarBorderWidth,
|
|
109
91
|
rightBarBorderWidth = props.barBorderWidth ??
|
|
@@ -117,14 +99,56 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
117
99
|
showSurplus = populationDefaults.showSurplus,
|
|
118
100
|
showSurplusLeft = populationDefaults.showSurplusLeft,
|
|
119
101
|
showSurplusRight = populationDefaults.showSurplusRight,
|
|
102
|
+
leftSurplusBorderWidth = populationDefaults.leftSurplusBorderWidth,
|
|
103
|
+
rightSurplusBorderWidth = populationDefaults.rightSurplusBorderWidth
|
|
104
|
+
} = props
|
|
105
|
+
|
|
106
|
+
let {
|
|
107
|
+
yAxisColor = AxesAndRulesDefaults.yAxisColor,
|
|
108
|
+
xAxisColor = AxesAndRulesDefaults.xAxisColor,
|
|
109
|
+
xAxisIndicesColor = populationDefaults.xAxisIndicesColor,
|
|
110
|
+
xAxisLabelColor = populationDefaults.defaultFontColor,
|
|
111
|
+
verticalLinesColor = populationDefaults.verticalLinesColor,
|
|
112
|
+
yAxisIndicesColor = AxesAndRulesDefaults.yAxisIndicesColor,
|
|
113
|
+
yAxisLabelColor = populationDefaults.defaultFontColor,
|
|
114
|
+
rulesColor = AxesAndRulesDefaults.rulesColor,
|
|
115
|
+
leftBarLabelColor = props.barLabelColor ??
|
|
116
|
+
populationDefaults.defaultFontColor,
|
|
117
|
+
rightBarLabelColor = props.barLabelColor ??
|
|
118
|
+
populationDefaults.defaultFontColor,
|
|
119
|
+
midAxisLabelColor = populationDefaults.defaultFontColor,
|
|
120
|
+
leftBarColor = populationDefaults.leftBarColor,
|
|
121
|
+
rightBarColor = populationDefaults.rightBarColor,
|
|
122
|
+
leftBarBorderColor = populationDefaults.leftBarBorderColor,
|
|
123
|
+
rightBarBorderColor = populationDefaults.rightBarBorderColor,
|
|
120
124
|
leftSurplusColor = populationDefaults.leftSurplusColor,
|
|
121
125
|
leftSurplusBorderColor = populationDefaults.leftSurplusBorderColor,
|
|
122
126
|
rightSurplusColor = populationDefaults.rightSurplusColor,
|
|
123
|
-
rightSurplusBorderColor = populationDefaults.rightSurplusBorderColor
|
|
124
|
-
leftSurplusBorderWidth = populationDefaults.leftSurplusBorderWidth,
|
|
125
|
-
rightSurplusBorderWidth = populationDefaults.rightSurplusBorderWidth
|
|
127
|
+
rightSurplusBorderColor = populationDefaults.rightSurplusBorderColor
|
|
126
128
|
} = props
|
|
127
129
|
|
|
130
|
+
if (framework === Framework.reactJS) {
|
|
131
|
+
yAxisColor = yAxisColor.toString()
|
|
132
|
+
xAxisColor = xAxisColor.toString()
|
|
133
|
+
xAxisIndicesColor = xAxisIndicesColor.toString()
|
|
134
|
+
xAxisLabelColor = xAxisLabelColor.toString()
|
|
135
|
+
verticalLinesColor = verticalLinesColor.toString()
|
|
136
|
+
yAxisIndicesColor = yAxisIndicesColor.toString()
|
|
137
|
+
yAxisLabelColor = yAxisLabelColor.toString()
|
|
138
|
+
rulesColor = rulesColor.toString()
|
|
139
|
+
leftBarLabelColor = leftBarLabelColor.toString()
|
|
140
|
+
rightBarLabelColor = rightBarLabelColor.toString()
|
|
141
|
+
midAxisLabelColor = midAxisLabelColor.toString()
|
|
142
|
+
leftBarColor = leftBarColor.toString()
|
|
143
|
+
rightBarColor = rightBarColor.toString()
|
|
144
|
+
leftBarBorderColor = leftBarBorderColor.toString()
|
|
145
|
+
rightBarBorderColor = rightBarBorderColor.toString()
|
|
146
|
+
leftSurplusColor = leftSurplusColor.toString()
|
|
147
|
+
leftSurplusBorderColor = leftSurplusBorderColor.toString()
|
|
148
|
+
rightSurplusColor = rightSurplusColor.toString()
|
|
149
|
+
rightSurplusBorderColor = rightSurplusBorderColor.toString()
|
|
150
|
+
}
|
|
151
|
+
|
|
128
152
|
const yAxisLabelWidth = hideYAxisText
|
|
129
153
|
? yAxisThickness
|
|
130
154
|
: props.yAxisLabelWidth ?? AxesAndRulesDefaults.yAxisLabelWidth
|
|
@@ -146,8 +170,7 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
146
170
|
const max = Math.max(leftMax, rightMax)
|
|
147
171
|
|
|
148
172
|
const xAxisRoundToDigits =
|
|
149
|
-
props.xAxisRoundToDigits ??
|
|
150
|
-
(max < 0.1 ? 3 : max < 1 ? 2 : max < 10 ? 1 : 0)
|
|
173
|
+
props.xAxisRoundToDigits ?? (max < 0.1 ? 3 : max < 1 ? 2 : max < 10 ? 1 : 0)
|
|
151
174
|
|
|
152
175
|
const midAxisAndLabelWidth =
|
|
153
176
|
(showMidAxis ? midAxisLabelWidth : 0) / 2 +
|
|
@@ -158,7 +181,7 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
158
181
|
const leftXAfterMid = mid - (showMidAxis ? midAxisLabelWidth / 2 : 0)
|
|
159
182
|
const rightXAfterMid = mid + (showMidAxis ? midAxisLabelWidth / 2 : 0)
|
|
160
183
|
|
|
161
|
-
const yAxisLineProps:
|
|
184
|
+
const yAxisLineProps: RulesPropsType = {
|
|
162
185
|
x1: yAxisLabelWidth,
|
|
163
186
|
y1: 0,
|
|
164
187
|
x2: yAxisLabelWidth,
|
|
@@ -166,18 +189,22 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
166
189
|
stroke: yAxisColor,
|
|
167
190
|
strokeWidth: yAxisThickness
|
|
168
191
|
}
|
|
169
|
-
if (props.yAxisStrokeDashArray?.length === 2) {
|
|
170
|
-
yAxisLineProps.strokeDasharray = props.yAxisStrokeDashArray
|
|
171
|
-
}
|
|
172
192
|
|
|
173
|
-
|
|
193
|
+
yAxisLineProps.strokeDasharray = getStrokeDashArray(
|
|
194
|
+
props.yAxisStrokeDashArray,
|
|
195
|
+
framework
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
const midAxisLineCommonProps: RulesPropsType = {
|
|
174
199
|
y1: 0,
|
|
175
200
|
y2: containerHeight,
|
|
176
201
|
strokeWidth: props.midAxisThickness ?? yAxisThickness
|
|
177
202
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
203
|
+
|
|
204
|
+
midAxisLineCommonProps.strokeDasharray = getStrokeDashArray(
|
|
205
|
+
props.midAxisStrokeDashArray,
|
|
206
|
+
framework
|
|
207
|
+
)
|
|
181
208
|
|
|
182
209
|
const xAxisLabelY =
|
|
183
210
|
containerHeight + xAxisLabelFontSize + 6 + xAxisLabelShiftY
|
|
@@ -187,15 +214,16 @@ export const usePopulationPyramid = (props: PopulationPyramidPropsType) => {
|
|
|
187
214
|
stroke: xAxisIndicesColor,
|
|
188
215
|
strokeWidth: xAxisIndicesWidth
|
|
189
216
|
}
|
|
190
|
-
const verticalLinesCommonProps:
|
|
217
|
+
const verticalLinesCommonProps: RulesPropsType = {
|
|
191
218
|
y1: 0,
|
|
192
219
|
y2: containerHeight,
|
|
193
220
|
stroke: verticalLinesColor,
|
|
194
221
|
strokeWidth: verticalLinesThickness
|
|
195
222
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
223
|
+
verticalLinesCommonProps.strokeDasharray = getStrokeDashArray(
|
|
224
|
+
verticalLinesStrokeDashArray
|
|
225
|
+
)
|
|
226
|
+
|
|
199
227
|
const xAxisLabelsCommonProps = {
|
|
200
228
|
y: xAxisLabelY + xAxisLabelShiftY,
|
|
201
229
|
stroke: xAxisLabelColor,
|