gifted-charts-core 0.1.32 → 0.1.33
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/PieChart/main.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare const getPieChartMainProps: (props: PieChartMainProps) => {
|
|
|
58
58
|
avoidOverlappingOfLabels: boolean;
|
|
59
59
|
};
|
|
60
60
|
externalLabelComponent: ((item?: pieDataItem, index?: number) => any) | undefined;
|
|
61
|
-
getExternaLabelProperties: (item: pieDataItem, mx: number, my: number, cx: number, cy: number, prevSide: string, prevLabelComponentX: number) => {
|
|
61
|
+
getExternaLabelProperties: (item: pieDataItem, mx: number, my: number, cx: number, cy: number, prevSide: string, prevLabelComponentX: number, isLast?: boolean, wasFirstItemOnPole?: boolean) => {
|
|
62
62
|
labelLineColor: string;
|
|
63
63
|
labelLineThickness: number;
|
|
64
64
|
labelComponentHeight: number;
|
package/dist/PieChart/main.js
CHANGED
|
@@ -144,7 +144,7 @@ export var getPieChartMainProps = function (props) {
|
|
|
144
144
|
return pAcc + (acc - pAcc) / 2;
|
|
145
145
|
});
|
|
146
146
|
pData = __spreadArray([0], __read(pData), false);
|
|
147
|
-
var getExternaLabelProperties = function (item, mx, my, cx, cy, prevSide, prevLabelComponentX) {
|
|
147
|
+
var getExternaLabelProperties = function (item, mx, my, cx, cy, prevSide, prevLabelComponentX, isLast, wasFirstItemOnPole) {
|
|
148
148
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
149
149
|
if (!showExternalLabels)
|
|
150
150
|
return emptyExternaLabelProperties;
|
|
@@ -188,7 +188,8 @@ export var getPieChartMainProps = function (props) {
|
|
|
188
188
|
// In case both previous & current labels are at pole, then their labels might again overlap, to counter this, we vertically shift the current label
|
|
189
189
|
if (labelLineConfig.avoidOverlappingOfLabels &&
|
|
190
190
|
isOnPole &&
|
|
191
|
-
Math.abs(prevLabelComponentX - labelComponentX) < 30
|
|
191
|
+
(Math.abs(prevLabelComponentX - labelComponentX) < 30 ||
|
|
192
|
+
(isLast && wasFirstItemOnPole))) {
|
|
192
193
|
labelComponentY += outY > cy ? 20 : -20;
|
|
193
194
|
outY += outY > cy ? 20 : -20;
|
|
194
195
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxesAndRulesDefaults } from '../../utils/constants';
|
|
2
2
|
import { getLabelTextUtil } from '../../utils';
|
|
3
3
|
export var getHorizSectionVals = function (props) {
|
|
4
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14
|
|
4
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
|
|
5
5
|
var width = props.width, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, totalWidth = props.totalWidth, endSpacing = props.endSpacing, yAxisSide = props.yAxisSide, noOfSections = props.noOfSections, yAxisLabelWidth = props.yAxisLabelWidth, yAxisLabelContainerStyle = props.yAxisLabelContainerStyle, yAxisThickness = props.yAxisThickness, yAxisColor = props.yAxisColor, yAxisExtraHeight = props.yAxisExtraHeight, trimYAxisAtTop = props.trimYAxisAtTop, dashWidth = props.dashWidth, dashGap = props.dashGap, rulesType = props.rulesType, rulesThickness = props.rulesThickness, spacing = props.spacing, showYAxisIndices = props.showYAxisIndices, yAxisIndicesHeight = props.yAxisIndicesHeight, yAxisIndicesWidth = props.yAxisIndicesWidth, yAxisIndicesColor = props.yAxisIndicesColor, hideOrigin = props.hideOrigin, hideYAxisText = props.hideYAxisText, showFractionalValues = props.showFractionalValues, yAxisTextNumberOfLines = props.yAxisTextNumberOfLines, yAxisLabelPrefix = props.yAxisLabelPrefix, yAxisLabelSuffix = props.yAxisLabelSuffix, yAxisTextStyle = props.yAxisTextStyle, containerHeight = props.containerHeight, maxValue = props.maxValue, referenceLinesConfig = props.referenceLinesConfig, yAxisLabelTexts = props.yAxisLabelTexts, stepValue = props.stepValue, negativeStepValue = props.negativeStepValue, roundToDigits = props.roundToDigits, yAxisOffset = props.yAxisOffset, formatYLabel = props.formatYLabel, secondaryMaxItem = props.secondaryMaxItem, secondaryMinItem = props.secondaryMinItem, secondaryYAxis = props.secondaryYAxis, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepValue = props.secondaryNegativeStepValue, secondaryNoOfSectionsBelowXAxis = props.secondaryNoOfSectionsBelowXAxis;
|
|
6
6
|
var yAxisExtraHeightAtTop = trimYAxisAtTop ? 0 : yAxisExtraHeight;
|
|
7
7
|
/***********************************************************************************************************************************
|
|
@@ -29,23 +29,23 @@ export var getHorizSectionVals = function (props) {
|
|
|
29
29
|
yAxisThickness: (_j = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisThickness) !== null && _j !== void 0 ? _j : yAxisThickness,
|
|
30
30
|
yAxisColor: (_k = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisColor) !== null && _k !== void 0 ? _k : yAxisColor,
|
|
31
31
|
yAxisLabelContainerStyle: (_l = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelContainerStyle) !== null && _l !== void 0 ? _l : yAxisLabelContainerStyle,
|
|
32
|
-
yAxisLabelTexts:
|
|
33
|
-
yAxisTextStyle: (
|
|
34
|
-
yAxisTextNumberOfLines: (
|
|
35
|
-
yAxisLabelWidth: (
|
|
36
|
-
hideYAxisText: (
|
|
37
|
-
yAxisLabelPrefix: (
|
|
38
|
-
yAxisLabelSuffix: (
|
|
39
|
-
hideOrigin: (
|
|
32
|
+
yAxisLabelTexts: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelTexts,
|
|
33
|
+
yAxisTextStyle: (_m = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisTextStyle) !== null && _m !== void 0 ? _m : yAxisTextStyle,
|
|
34
|
+
yAxisTextNumberOfLines: (_o = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisTextNumberOfLines) !== null && _o !== void 0 ? _o : yAxisTextNumberOfLines,
|
|
35
|
+
yAxisLabelWidth: (_p = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelWidth) !== null && _p !== void 0 ? _p : yAxisLabelWidth,
|
|
36
|
+
hideYAxisText: (_q = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.hideYAxisText) !== null && _q !== void 0 ? _q : hideYAxisText,
|
|
37
|
+
yAxisLabelPrefix: (_r = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelPrefix) !== null && _r !== void 0 ? _r : yAxisLabelPrefix,
|
|
38
|
+
yAxisLabelSuffix: (_s = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelSuffix) !== null && _s !== void 0 ? _s : yAxisLabelSuffix,
|
|
39
|
+
hideOrigin: (_t = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.hideOrigin) !== null && _t !== void 0 ? _t : hideOrigin,
|
|
40
40
|
formatYLabel: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.formatYLabel
|
|
41
41
|
};
|
|
42
42
|
secondaryYAxisConfig.maxValue =
|
|
43
|
-
(
|
|
43
|
+
(_u = secondaryYAxisConfig.maxValue) !== null && _u !== void 0 ? _u : (secondaryMaxItem || maxValue);
|
|
44
44
|
secondaryYAxisConfig.mostNegativeValue =
|
|
45
|
-
(
|
|
45
|
+
(_v = secondaryYAxisConfig.mostNegativeValue) !== null && _v !== void 0 ? _v : secondaryMinItem;
|
|
46
46
|
secondaryYAxisConfig.stepHeight =
|
|
47
47
|
secondaryYAxisConfig.stepHeight ||
|
|
48
|
-
containerHeight / ((
|
|
48
|
+
containerHeight / ((_w = secondaryYAxisConfig.noOfSections) !== null && _w !== void 0 ? _w : noOfSections);
|
|
49
49
|
var horizSections = [];
|
|
50
50
|
for (var i = 0; i <= noOfSections; i++) {
|
|
51
51
|
var value = maxValue - stepValue * i;
|
|
@@ -54,7 +54,7 @@ export var getHorizSectionVals = function (props) {
|
|
|
54
54
|
}
|
|
55
55
|
horizSections.push({
|
|
56
56
|
value: (yAxisLabelTexts === null || yAxisLabelTexts === void 0 ? void 0 : yAxisLabelTexts.length)
|
|
57
|
-
? (
|
|
57
|
+
? (_x = yAxisLabelTexts[noOfSections + noOfSectionsBelowXAxis - i]) !== null && _x !== void 0 ? _x : value.toString()
|
|
58
58
|
: value.toString()
|
|
59
59
|
});
|
|
60
60
|
}
|
|
@@ -67,22 +67,22 @@ export var getHorizSectionVals = function (props) {
|
|
|
67
67
|
}
|
|
68
68
|
horizSectionsBelow.push({
|
|
69
69
|
value: props.yAxisLabelTexts
|
|
70
|
-
? (
|
|
70
|
+
? (_y = props.yAxisLabelTexts[noOfSectionsBelowXAxis - i]) !== null && _y !== void 0 ? _y : value.toString()
|
|
71
71
|
: value.toString()
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
var secondaryHorizSections = [];
|
|
76
76
|
if (secondaryYAxis) {
|
|
77
|
-
for (var i = 0; i <= ((
|
|
77
|
+
for (var i = 0; i <= ((_z = secondaryYAxisConfig.noOfSections) !== null && _z !== void 0 ? _z : noOfSections); i++) {
|
|
78
78
|
var value = secondaryYAxisConfig.stepValue * i;
|
|
79
79
|
if (secondaryYAxisConfig.showFractionalValues ||
|
|
80
80
|
secondaryYAxisConfig.roundToDigits) {
|
|
81
|
-
value = parseFloat(value.toFixed((
|
|
81
|
+
value = parseFloat(value.toFixed((_0 = secondaryYAxisConfig.roundToDigits) !== null && _0 !== void 0 ? _0 : AxesAndRulesDefaults.roundToDigits));
|
|
82
82
|
}
|
|
83
83
|
secondaryHorizSections.push({
|
|
84
|
-
value: ((
|
|
85
|
-
? (
|
|
84
|
+
value: ((_1 = secondaryYAxisConfig.yAxisLabelTexts) === null || _1 === void 0 ? void 0 : _1.length)
|
|
85
|
+
? (_2 = secondaryYAxisConfig.yAxisLabelTexts[i - noOfSectionsBelowXAxis - 1]) !== null && _2 !== void 0 ? _2 : value.toString()
|
|
86
86
|
: value.toString()
|
|
87
87
|
});
|
|
88
88
|
}
|
|
@@ -94,11 +94,11 @@ export var getHorizSectionVals = function (props) {
|
|
|
94
94
|
(i - secondaryYAxisConfig.noOfSectionsBelowXAxis - 1);
|
|
95
95
|
if (secondaryYAxisConfig.showFractionalValues ||
|
|
96
96
|
secondaryYAxisConfig.roundToDigits) {
|
|
97
|
-
value = parseFloat(value.toFixed((
|
|
97
|
+
value = parseFloat(value.toFixed((_3 = secondaryYAxisConfig.roundToDigits) !== null && _3 !== void 0 ? _3 : AxesAndRulesDefaults.roundToDigits));
|
|
98
98
|
}
|
|
99
99
|
secondaryHorizSectionsBelow.push({
|
|
100
|
-
value: ((
|
|
101
|
-
? (
|
|
100
|
+
value: ((_4 = secondaryYAxisConfig.yAxisLabelTexts) === null || _4 === void 0 ? void 0 : _4.length)
|
|
101
|
+
? (_5 = secondaryYAxisConfig.yAxisLabelTexts[i - 1]) !== null && _5 !== void 0 ? _5 : value.toString()
|
|
102
102
|
: value.toString()
|
|
103
103
|
});
|
|
104
104
|
}
|
|
@@ -119,12 +119,12 @@ export var getHorizSectionVals = function (props) {
|
|
|
119
119
|
};
|
|
120
120
|
showReferenceLine1 = referenceLinesConfig.showReferenceLine1 || false;
|
|
121
121
|
referenceLine1Position =
|
|
122
|
-
(
|
|
122
|
+
(_6 = referenceLinesConfig.referenceLine1Position) !== null && _6 !== void 0 ? _6 : (referenceLinesConfig.referenceLine1Position || containerHeight / 2);
|
|
123
123
|
referenceLine1Config = referenceLinesConfig.referenceLine1Config
|
|
124
124
|
? {
|
|
125
125
|
thickness: referenceLinesConfig.referenceLine1Config.thickness ||
|
|
126
126
|
defaultReferenceConfig.thickness,
|
|
127
|
-
width: (
|
|
127
|
+
width: (_7 = referenceLinesConfig.referenceLine1Config.width) !== null && _7 !== void 0 ? _7 : defaultReferenceConfig.width,
|
|
128
128
|
color: referenceLinesConfig.referenceLine1Config.color ||
|
|
129
129
|
defaultReferenceConfig.color,
|
|
130
130
|
type: referenceLinesConfig.referenceLine1Config.type ||
|
|
@@ -137,17 +137,17 @@ export var getHorizSectionVals = function (props) {
|
|
|
137
137
|
defaultReferenceConfig.labelText,
|
|
138
138
|
labelTextStyle: referenceLinesConfig.referenceLine1Config.labelTextStyle ||
|
|
139
139
|
defaultReferenceConfig.labelTextStyle,
|
|
140
|
-
zIndex: (
|
|
140
|
+
zIndex: (_8 = referenceLinesConfig.referenceLine1Config.zIndex) !== null && _8 !== void 0 ? _8 : defaultReferenceConfig.zIndex
|
|
141
141
|
}
|
|
142
142
|
: defaultReferenceConfig;
|
|
143
143
|
showReferenceLine2 = referenceLinesConfig.showReferenceLine2 || false;
|
|
144
144
|
referenceLine2Position =
|
|
145
|
-
(
|
|
145
|
+
(_9 = referenceLinesConfig.referenceLine2Position) !== null && _9 !== void 0 ? _9 : (referenceLinesConfig.referenceLine2Position || (3 * containerHeight) / 2);
|
|
146
146
|
referenceLine2Config = referenceLinesConfig.referenceLine2Config
|
|
147
147
|
? {
|
|
148
148
|
thickness: referenceLinesConfig.referenceLine2Config.thickness ||
|
|
149
149
|
defaultReferenceConfig.thickness,
|
|
150
|
-
width: (
|
|
150
|
+
width: (_10 = referenceLinesConfig.referenceLine2Config.width) !== null && _10 !== void 0 ? _10 : defaultReferenceConfig.width,
|
|
151
151
|
color: referenceLinesConfig.referenceLine2Config.color ||
|
|
152
152
|
defaultReferenceConfig.color,
|
|
153
153
|
type: referenceLinesConfig.referenceLine2Config.type ||
|
|
@@ -160,17 +160,17 @@ export var getHorizSectionVals = function (props) {
|
|
|
160
160
|
defaultReferenceConfig.labelText,
|
|
161
161
|
labelTextStyle: referenceLinesConfig.referenceLine2Config.labelTextStyle ||
|
|
162
162
|
defaultReferenceConfig.labelTextStyle,
|
|
163
|
-
zIndex: (
|
|
163
|
+
zIndex: (_11 = referenceLinesConfig.referenceLine2Config.zIndex) !== null && _11 !== void 0 ? _11 : defaultReferenceConfig.zIndex
|
|
164
164
|
}
|
|
165
165
|
: defaultReferenceConfig;
|
|
166
166
|
showReferenceLine3 = referenceLinesConfig.showReferenceLine3 || false;
|
|
167
167
|
referenceLine3Position =
|
|
168
|
-
(
|
|
168
|
+
(_12 = referenceLinesConfig.referenceLine3Position) !== null && _12 !== void 0 ? _12 : (referenceLinesConfig.referenceLine3Position || containerHeight / 3);
|
|
169
169
|
referenceLine3Config = referenceLinesConfig.referenceLine3Config
|
|
170
170
|
? {
|
|
171
171
|
thickness: referenceLinesConfig.referenceLine3Config.thickness ||
|
|
172
172
|
defaultReferenceConfig.thickness,
|
|
173
|
-
width: (
|
|
173
|
+
width: (_13 = referenceLinesConfig.referenceLine3Config.width) !== null && _13 !== void 0 ? _13 : defaultReferenceConfig.width,
|
|
174
174
|
color: referenceLinesConfig.referenceLine3Config.color ||
|
|
175
175
|
defaultReferenceConfig.color,
|
|
176
176
|
type: referenceLinesConfig.referenceLine3Config.type ||
|
|
@@ -183,7 +183,7 @@ export var getHorizSectionVals = function (props) {
|
|
|
183
183
|
defaultReferenceConfig.labelText,
|
|
184
184
|
labelTextStyle: referenceLinesConfig.referenceLine3Config.labelTextStyle ||
|
|
185
185
|
defaultReferenceConfig.labelTextStyle,
|
|
186
|
-
zIndex: (
|
|
186
|
+
zIndex: (_14 = referenceLinesConfig.referenceLine3Config.zIndex) !== null && _14 !== void 0 ? _14 : defaultReferenceConfig.zIndex
|
|
187
187
|
}
|
|
188
188
|
: defaultReferenceConfig;
|
|
189
189
|
var getLabelTexts = function (val, index) {
|
|
@@ -186,6 +186,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
186
186
|
initialSpacing: initialSpacing,
|
|
187
187
|
spacing: spacing,
|
|
188
188
|
containerHeight: containerHeight,
|
|
189
|
+
containerHeightIncludingBelowXAxis: containerHeightIncludingBelowXAxis,
|
|
189
190
|
lineConfig: lineConfig,
|
|
190
191
|
maxValue: (_23 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue) !== null && _23 !== void 0 ? _23 : maxValue,
|
|
191
192
|
animatedWidth: animatedWidth,
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -109,6 +109,7 @@ export interface LineInBarChartPropsType {
|
|
|
109
109
|
initialSpacing: number;
|
|
110
110
|
spacing: number;
|
|
111
111
|
containerHeight: number;
|
|
112
|
+
containerHeightIncludingBelowXAxis: number;
|
|
112
113
|
lineConfig: ExtendedLineConfigType;
|
|
113
114
|
maxValue: number;
|
|
114
115
|
animatedWidth: number;
|