gifted-charts-core 0.1.31 → 0.1.32
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/LineChart/index.d.ts +1 -0
- package/dist/LineChart/index.js +10 -7
- package/dist/PieChart/main.d.ts +6 -1
- package/dist/PieChart/main.js +41 -20
- package/dist/components/common/types.d.ts +1 -0
- package/dist/utils/index.d.ts +6 -3
- package/dist/utils/index.js +33 -19
- package/dist/utils/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -374,6 +374,7 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
|
|
|
374
374
|
stripStrokeDashArray: number[] | undefined;
|
|
375
375
|
unFocusOnPressOut: boolean;
|
|
376
376
|
delayBeforeUnFocus: number;
|
|
377
|
+
containerHeightIncludingBelowXAxis: number;
|
|
377
378
|
lineGradient: boolean;
|
|
378
379
|
lineGradientDirection: string;
|
|
379
380
|
lineGradientStartColor: string;
|
package/dist/LineChart/index.js
CHANGED
|
@@ -425,7 +425,7 @@ export var useLineChart = function (props) {
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
var xx = svgPath(pArray, (_d = set.curveType) !== null && _d !== void 0 ? _d : curveType, (_e = set.curvature) !== null && _e !== void 0 ? _e : curvature);
|
|
428
|
-
pointsArray_1.push(getCurvePathWithSegments(xx, set.lineSegments, SEGMENT_START, SEGMENT_END));
|
|
428
|
+
pointsArray_1.push(getCurvePathWithSegments(xx, set.lineSegments, SEGMENT_START, SEGMENT_END, curveType));
|
|
429
429
|
// For Arrow-
|
|
430
430
|
if (set.data.length > 1 && ((_f = set.showArrow) !== null && _f !== void 0 ? _f : props.showArrows)) {
|
|
431
431
|
var arrowTipY = pArray[pArray.length - 1][1];
|
|
@@ -676,11 +676,11 @@ export var useLineChart = function (props) {
|
|
|
676
676
|
var xx3 = svgPath(p3Array, curveType, curvature);
|
|
677
677
|
var xx4 = svgPath(p4Array, curveType, curvature);
|
|
678
678
|
var xx5 = svgPath(p5Array, curveType, curvature);
|
|
679
|
-
setPoints(getCurvePathWithSegments(xx, lineSegments, SEGMENT_START, SEGMENT_END));
|
|
680
|
-
setPoints2(getCurvePathWithSegments(xx2, lineSegments2, SEGMENT_START, SEGMENT_END));
|
|
681
|
-
setPoints3(getCurvePathWithSegments(xx3, lineSegments3, SEGMENT_START, SEGMENT_END));
|
|
682
|
-
setPoints4(getCurvePathWithSegments(xx4, lineSegments4, SEGMENT_START, SEGMENT_END));
|
|
683
|
-
setPoints5(getCurvePathWithSegments(xx5, lineSegments5, SEGMENT_START, SEGMENT_END));
|
|
679
|
+
setPoints(getCurvePathWithSegments(xx, lineSegments, SEGMENT_START, SEGMENT_END, curveType));
|
|
680
|
+
setPoints2(getCurvePathWithSegments(xx2, lineSegments2, SEGMENT_START, SEGMENT_END, curveType));
|
|
681
|
+
setPoints3(getCurvePathWithSegments(xx3, lineSegments3, SEGMENT_START, SEGMENT_END, curveType));
|
|
682
|
+
setPoints4(getCurvePathWithSegments(xx4, lineSegments4, SEGMENT_START, SEGMENT_END, curveType));
|
|
683
|
+
setPoints5(getCurvePathWithSegments(xx5, lineSegments5, SEGMENT_START, SEGMENT_END, curveType));
|
|
684
684
|
if (data.length > 1 && ((_f = props.showArrow1) !== null && _f !== void 0 ? _f : props.showArrows)) {
|
|
685
685
|
var arrowTipY = p1Array[p1Array.length - 1][1];
|
|
686
686
|
var arrowTipX = p1Array[p1Array.length - 1][0];
|
|
@@ -871,6 +871,7 @@ export var useLineChart = function (props) {
|
|
|
871
871
|
var stepHeight = (_237 = props.stepHeight) !== null && _237 !== void 0 ? _237 : containerHeight / noOfSections;
|
|
872
872
|
var stepValue = (_238 = props.stepValue) !== null && _238 !== void 0 ? _238 : maxValue / noOfSections;
|
|
873
873
|
var noOfSectionsBelowXAxis = (_239 = props.noOfSectionsBelowXAxis) !== null && _239 !== void 0 ? _239 : Math.round(Math.ceil(-mostNegativeValue / stepValue));
|
|
874
|
+
var containerHeightIncludingBelowXAxis = extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
|
|
874
875
|
var showXAxisIndices = (_240 = props.showXAxisIndices) !== null && _240 !== void 0 ? _240 : AxesAndRulesDefaults.showXAxisIndices;
|
|
875
876
|
var xAxisIndicesHeight = (_241 = props.xAxisIndicesHeight) !== null && _241 !== void 0 ? _241 : AxesAndRulesDefaults.xAxisIndicesHeight;
|
|
876
877
|
var xAxisIndicesWidth = (_242 = props.xAxisIndicesWidth) !== null && _242 !== void 0 ? _242 : AxesAndRulesDefaults.xAxisIndicesWidth;
|
|
@@ -881,7 +882,8 @@ export var useLineChart = function (props) {
|
|
|
881
882
|
var showFractionalValues = (_246 = props.showFractionalValues) !== null && _246 !== void 0 ? _246 : AxesAndRulesDefaults.showFractionalValues;
|
|
882
883
|
var horizontal = false;
|
|
883
884
|
var yAxisAtTop = false;
|
|
884
|
-
defaultPointerConfig.pointerStripHeight =
|
|
885
|
+
defaultPointerConfig.pointerStripHeight =
|
|
886
|
+
containerHeight + noOfSectionsBelowXAxis * stepHeight;
|
|
885
887
|
var pointerConfig = props.pointerConfig;
|
|
886
888
|
var getPointerProps = (_247 = props.getPointerProps) !== null && _247 !== void 0 ? _247 : null;
|
|
887
889
|
var pointerHeight = (_248 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _248 !== void 0 ? _248 : defaultPointerConfig.height;
|
|
@@ -1427,6 +1429,7 @@ export var useLineChart = function (props) {
|
|
|
1427
1429
|
stripStrokeDashArray: stripStrokeDashArray,
|
|
1428
1430
|
unFocusOnPressOut: unFocusOnPressOut,
|
|
1429
1431
|
delayBeforeUnFocus: delayBeforeUnFocus,
|
|
1432
|
+
containerHeightIncludingBelowXAxis: containerHeightIncludingBelowXAxis,
|
|
1430
1433
|
lineGradient: lineGradient,
|
|
1431
1434
|
lineGradientDirection: lineGradientDirection,
|
|
1432
1435
|
lineGradientStartColor: lineGradientStartColor,
|
package/dist/PieChart/main.d.ts
CHANGED
|
@@ -55,9 +55,10 @@ export declare const getPieChartMainProps: (props: PieChartMainProps) => {
|
|
|
55
55
|
labelComponentWidth: number;
|
|
56
56
|
labelComponentHeight: number;
|
|
57
57
|
labelComponentMargin: number;
|
|
58
|
+
avoidOverlappingOfLabels: boolean;
|
|
58
59
|
};
|
|
59
60
|
externalLabelComponent: ((item?: pieDataItem, index?: number) => any) | undefined;
|
|
60
|
-
getExternaLabelProperties: (item: pieDataItem, mx: number, my: number, cx: number, cy: number) => {
|
|
61
|
+
getExternaLabelProperties: (item: pieDataItem, mx: number, my: number, cx: number, cy: number, prevSide: string, prevLabelComponentX: number) => {
|
|
61
62
|
labelLineColor: string;
|
|
62
63
|
labelLineThickness: number;
|
|
63
64
|
labelComponentHeight: number;
|
|
@@ -67,7 +68,9 @@ export declare const getPieChartMainProps: (props: PieChartMainProps) => {
|
|
|
67
68
|
outY: number;
|
|
68
69
|
finalX: number;
|
|
69
70
|
labelComponentX: number;
|
|
71
|
+
labelComponentY: number;
|
|
70
72
|
localExternalLabelComponent: null;
|
|
73
|
+
isRightHalf: boolean;
|
|
71
74
|
} | {
|
|
72
75
|
labelLineColor: import("react-native").ColorValue;
|
|
73
76
|
labelLineThickness: number;
|
|
@@ -78,6 +81,8 @@ export declare const getPieChartMainProps: (props: PieChartMainProps) => {
|
|
|
78
81
|
outY: number;
|
|
79
82
|
finalX: number;
|
|
80
83
|
labelComponentX: number;
|
|
84
|
+
labelComponentY: number;
|
|
81
85
|
localExternalLabelComponent: ((item?: pieDataItem, index?: number) => any) | undefined;
|
|
86
|
+
isRightHalf: boolean;
|
|
82
87
|
};
|
|
83
88
|
};
|
package/dist/PieChart/main.js
CHANGED
|
@@ -36,7 +36,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
36
36
|
};
|
|
37
37
|
import { defaultLabelLineConfig, emptyExternaLabelProperties, getTextSizeForPieLabels } from '../utils';
|
|
38
38
|
export var getPieChartMainProps = function (props) {
|
|
39
|
-
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;
|
|
39
|
+
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;
|
|
40
40
|
var isThreeD = props.isThreeD, isBiggerPie = props.isBiggerPie, paddingHorizontal = props.paddingHorizontal, paddingVertical = props.paddingVertical, extraRadius = props.extraRadius, showExternalLabels = props.showExternalLabels, externalLabelComponent = props.externalLabelComponent;
|
|
41
41
|
var propData = props.data;
|
|
42
42
|
var data = [];
|
|
@@ -79,9 +79,10 @@ export var getPieChartMainProps = function (props) {
|
|
|
79
79
|
thickness: (_x = (_w = props.labelLineConfig) === null || _w === void 0 ? void 0 : _w.thickness) !== null && _x !== void 0 ? _x : defaultLabelLineConfig.thickness,
|
|
80
80
|
labelComponentWidth: (_z = (_y = props.labelLineConfig) === null || _y === void 0 ? void 0 : _y.labelComponentWidth) !== null && _z !== void 0 ? _z : defaultLabelLineConfig.labelComponentWidth,
|
|
81
81
|
labelComponentHeight: (_1 = (_0 = props.labelLineConfig) === null || _0 === void 0 ? void 0 : _0.labelComponentHeight) !== null && _1 !== void 0 ? _1 : defaultLabelLineConfig.labelComponentHeight,
|
|
82
|
-
labelComponentMargin: (_3 = (_2 = props.labelLineConfig) === null || _2 === void 0 ? void 0 : _2.labelComponentMargin) !== null && _3 !== void 0 ? _3 : defaultLabelLineConfig.labelComponentMargin
|
|
82
|
+
labelComponentMargin: (_3 = (_2 = props.labelLineConfig) === null || _2 === void 0 ? void 0 : _2.labelComponentMargin) !== null && _3 !== void 0 ? _3 : defaultLabelLineConfig.labelComponentMargin,
|
|
83
|
+
avoidOverlappingOfLabels: (_5 = (_4 = props.labelLineConfig) === null || _4 === void 0 ? void 0 : _4.avoidOverlappingOfLabels) !== null && _5 !== void 0 ? _5 : defaultLabelLineConfig.avoidOverlappingOfLabels
|
|
83
84
|
};
|
|
84
|
-
var tiltAngle = (
|
|
85
|
+
var tiltAngle = (_6 = props.tiltAngle) !== null && _6 !== void 0 ? _6 : '55deg';
|
|
85
86
|
if (tiltAngle &&
|
|
86
87
|
!isNaN(Number(tiltAngle)) &&
|
|
87
88
|
!(tiltAngle + '').endsWith('deg')) {
|
|
@@ -93,12 +94,12 @@ export var getPieChartMainProps = function (props) {
|
|
|
93
94
|
: donut || props.centerLabelComponent
|
|
94
95
|
? 'outward'
|
|
95
96
|
: 'mid';
|
|
96
|
-
var showTextBackground = (
|
|
97
|
-
var textBackgroundColor = (
|
|
98
|
-
var showValuesAsLabels = (
|
|
99
|
-
var showGradient = (
|
|
100
|
-
var gradientCenterColor = (
|
|
101
|
-
var toggleFocusOnPress = (
|
|
97
|
+
var showTextBackground = (_7 = props.showTextBackground) !== null && _7 !== void 0 ? _7 : false;
|
|
98
|
+
var textBackgroundColor = (_8 = props.textBackgroundColor) !== null && _8 !== void 0 ? _8 : 'white';
|
|
99
|
+
var showValuesAsLabels = (_9 = props.showValuesAsLabels) !== null && _9 !== void 0 ? _9 : false;
|
|
100
|
+
var showGradient = (_10 = props.showGradient) !== null && _10 !== void 0 ? _10 : false;
|
|
101
|
+
var gradientCenterColor = (_11 = props.gradientCenterColor) !== null && _11 !== void 0 ? _11 : 'white';
|
|
102
|
+
var toggleFocusOnPress = (_12 = props.toggleFocusOnPress) !== null && _12 !== void 0 ? _12 : true;
|
|
102
103
|
var minShiftX = 0;
|
|
103
104
|
var maxShiftX = 0;
|
|
104
105
|
var minShiftY = 0;
|
|
@@ -143,7 +144,7 @@ export var getPieChartMainProps = function (props) {
|
|
|
143
144
|
return pAcc + (acc - pAcc) / 2;
|
|
144
145
|
});
|
|
145
146
|
pData = __spreadArray([0], __read(pData), false);
|
|
146
|
-
var getExternaLabelProperties = function (item, mx, my, cx, cy) {
|
|
147
|
+
var getExternaLabelProperties = function (item, mx, my, cx, cy, prevSide, prevLabelComponentX) {
|
|
147
148
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
148
149
|
if (!showExternalLabels)
|
|
149
150
|
return emptyExternaLabelProperties;
|
|
@@ -162,17 +163,35 @@ export var getPieChartMainProps = function (props) {
|
|
|
162
163
|
var outY = my + (isRightHalf ? yFactor : -yFactor);
|
|
163
164
|
var inX = mx + (isRightHalf ? -xFactor : xFactor);
|
|
164
165
|
var inY = my + (isRightHalf ? -yFactor : yFactor);
|
|
166
|
+
var labelComponentY = outY;
|
|
167
|
+
var side = isRightHalf ? 'right' : 'left';
|
|
168
|
+
var isOnPole = labelLineConfig.avoidOverlappingOfLabels &&
|
|
169
|
+
Math.abs(inX - outX) < 4 &&
|
|
170
|
+
side === prevSide;
|
|
165
171
|
var finalX = isRightHalf ? cx * 2 + labelLineLength : -labelLineLength;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
if (isOnPole) {
|
|
173
|
+
finalX = outX;
|
|
174
|
+
labelComponentY += outY > cy ? 10 : -10;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
finalX = isRightHalf
|
|
178
|
+
? finalX > outX
|
|
179
|
+
? finalX
|
|
180
|
+
: outX
|
|
181
|
+
: finalX < outX
|
|
182
|
+
? finalX
|
|
183
|
+
: outX;
|
|
184
|
+
}
|
|
173
185
|
var labelComponentX = isRightHalf
|
|
174
|
-
? finalX + labelComponentMargin
|
|
175
|
-
: finalX - labelComponentWidth - labelComponentMargin;
|
|
186
|
+
? finalX + (isOnPole ? -10 : labelComponentMargin)
|
|
187
|
+
: finalX - labelComponentWidth - (isOnPole ? -20 : labelComponentMargin);
|
|
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
|
+
if (labelLineConfig.avoidOverlappingOfLabels &&
|
|
190
|
+
isOnPole &&
|
|
191
|
+
Math.abs(prevLabelComponentX - labelComponentX) < 30) {
|
|
192
|
+
labelComponentY += outY > cy ? 20 : -20;
|
|
193
|
+
outY += outY > cy ? 20 : -20;
|
|
194
|
+
}
|
|
176
195
|
var localExternalLabelComponent = (_q = item.externalLabelComponent) !== null && _q !== void 0 ? _q : props.externalLabelComponent;
|
|
177
196
|
return {
|
|
178
197
|
labelLineColor: labelLineColor,
|
|
@@ -184,7 +203,9 @@ export var getPieChartMainProps = function (props) {
|
|
|
184
203
|
outY: outY,
|
|
185
204
|
finalX: finalX,
|
|
186
205
|
labelComponentX: labelComponentX,
|
|
187
|
-
|
|
206
|
+
labelComponentY: labelComponentY,
|
|
207
|
+
localExternalLabelComponent: localExternalLabelComponent,
|
|
208
|
+
isRightHalf: isRightHalf
|
|
188
209
|
};
|
|
189
210
|
};
|
|
190
211
|
return {
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ export declare const svgQuadraticCurvePath: (points: number[][]) => string;
|
|
|
10
10
|
export declare const svgPath: (points: number[][], curveType?: CurveType, curvature?: number) => string;
|
|
11
11
|
export declare const bezierCommand: (point: number[], i: number, a: number[][], curvature: number) => string;
|
|
12
12
|
export declare const getSegmentString: (lineSegment: LineSegment[] | undefined, index: number, startDelimeter: string, endDelimeter: string) => string;
|
|
13
|
-
export declare const getCurvePathWithSegments: (path: string, lineSegment: LineSegment[] | undefined, startDelimeter: string, endDelimeter: string) => string;
|
|
13
|
+
export declare const getCurvePathWithSegments: (path: string, lineSegment: LineSegment[] | undefined, startDelimeter: string, endDelimeter: string, curveType: CurveType) => string;
|
|
14
14
|
export declare const getPreviousSegmentsLastPoint: (isCurved: boolean, previousSegment: string) => string;
|
|
15
15
|
export declare const getPathWithHighlight: (data: lineDataItem[], i: number, highlightedRange: HighlightedRange, startIndex: number, endIndex: number, getX: (i: number) => number, getY: (value: number) => number) => string;
|
|
16
|
-
export declare const getRegionPathObjects: (points: string, color: ColorValue, currentLineThickness: number, thickness: number, strokeDashArray: number[], isCurved: boolean, startDelimeter: string, stop: string, endDelimeter: string) => LineProperties[];
|
|
17
|
-
export declare const getSegmentedPathObjects: (points: string, color: ColorValue, currentLineThickness: number, thickness: number, strokeDashArray: number[], isCurved: boolean, startDelimeter: string, endDelimeter: string) => LineProperties[];
|
|
16
|
+
export declare const getRegionPathObjects: (points: string, color: ColorValue, currentLineThickness: number, thickness: number, strokeDashArray: number[], isCurved: boolean, startDelimeter: string, stop: string, endDelimeter: string, curveType: CurveType) => LineProperties[];
|
|
17
|
+
export declare const getSegmentedPathObjects: (points: string, color: ColorValue, currentLineThickness: number, thickness: number, strokeDashArray: number[], isCurved: boolean, startDelimeter: string, endDelimeter: string, curveType: CurveType) => LineProperties[];
|
|
18
18
|
export declare const getArrowPoints: (arrowTipX: number, arrowTipY: number, x1: number, y1: number, arrowLength?: number, arrowWidth?: number, showArrowBase?: boolean) => string;
|
|
19
19
|
interface ReferenceLinesConfig {
|
|
20
20
|
showReferenceLine1?: boolean;
|
|
@@ -109,7 +109,9 @@ export declare const emptyExternaLabelProperties: {
|
|
|
109
109
|
outY: number;
|
|
110
110
|
finalX: number;
|
|
111
111
|
labelComponentX: number;
|
|
112
|
+
labelComponentY: number;
|
|
112
113
|
localExternalLabelComponent: null;
|
|
114
|
+
isRightHalf: boolean;
|
|
113
115
|
};
|
|
114
116
|
export declare const defaultLabelLineConfig: {
|
|
115
117
|
length: number;
|
|
@@ -119,6 +121,7 @@ export declare const defaultLabelLineConfig: {
|
|
|
119
121
|
labelComponentWidth: number;
|
|
120
122
|
labelComponentHeight: number;
|
|
121
123
|
labelComponentMargin: number;
|
|
124
|
+
avoidOverlappingOfLabels: boolean;
|
|
122
125
|
};
|
|
123
126
|
export declare const pointsWithPaddedRepititions: (oldPoints: string, newPoints: string) => string[];
|
|
124
127
|
export {};
|
package/dist/utils/index.js
CHANGED
|
@@ -87,21 +87,21 @@ export var svgQuadraticCurvePath = function (points) {
|
|
|
87
87
|
var cpX1 = (xMid + points[i][0]) / 2;
|
|
88
88
|
var cpX2 = (xMid + points[i + 1][0]) / 2;
|
|
89
89
|
path +=
|
|
90
|
-
'Q ' +
|
|
90
|
+
' Q ' +
|
|
91
91
|
cpX1 +
|
|
92
|
-
',
|
|
92
|
+
',' +
|
|
93
93
|
points[i][1] +
|
|
94
94
|
', ' +
|
|
95
95
|
xMid +
|
|
96
|
-
',
|
|
96
|
+
',' +
|
|
97
97
|
yMid +
|
|
98
|
-
(' Q
|
|
98
|
+
(' Q' +
|
|
99
99
|
cpX2 +
|
|
100
|
-
',
|
|
100
|
+
',' +
|
|
101
101
|
points[i + 1][1] +
|
|
102
102
|
', ' +
|
|
103
103
|
points[i + 1][0] +
|
|
104
|
-
',
|
|
104
|
+
',' +
|
|
105
105
|
points[i + 1][1]);
|
|
106
106
|
}
|
|
107
107
|
return path;
|
|
@@ -157,15 +157,16 @@ export var getSegmentString = function (lineSegment, index, startDelimeter, endD
|
|
|
157
157
|
var segment = lineSegment === null || lineSegment === void 0 ? void 0 : lineSegment.find(function (segment) { return segment.startIndex === index; });
|
|
158
158
|
return segment ? startDelimeter + JSON.stringify(segment) + endDelimeter : '';
|
|
159
159
|
};
|
|
160
|
-
export var getCurvePathWithSegments = function (path, lineSegment, startDelimeter, endDelimeter) {
|
|
160
|
+
export var getCurvePathWithSegments = function (path, lineSegment, startDelimeter, endDelimeter, curveType) {
|
|
161
161
|
if (!(lineSegment === null || lineSegment === void 0 ? void 0 : lineSegment.length))
|
|
162
162
|
return path;
|
|
163
|
+
var char = curveType === CurveType.QUADRATIC ? 'Q ' : 'C'; // space after Q is intentional, it signifies the first Q as their are 2 Qs equivalent to 1 C, and to counter this, we placed space after the 1st Q
|
|
163
164
|
var newPath = '';
|
|
164
|
-
var pathArray = path.split(
|
|
165
|
+
var pathArray = path.split(char);
|
|
165
166
|
var _loop_1 = function (i) {
|
|
166
167
|
var segment = lineSegment === null || lineSegment === void 0 ? void 0 : lineSegment.find(function (segment) { return segment.startIndex === i; });
|
|
167
168
|
newPath +=
|
|
168
|
-
(pathArray[i].startsWith('M') ? '' :
|
|
169
|
+
(pathArray[i].startsWith('M') ? '' : char) +
|
|
169
170
|
pathArray[i] +
|
|
170
171
|
(segment ? startDelimeter + JSON.stringify(segment) + endDelimeter : '');
|
|
171
172
|
};
|
|
@@ -286,10 +287,11 @@ export var getPathWithHighlight = function (data, i, highlightedRange, startInde
|
|
|
286
287
|
}
|
|
287
288
|
return path;
|
|
288
289
|
};
|
|
289
|
-
export var getRegionPathObjects = function (points, color, currentLineThickness, thickness, strokeDashArray, isCurved, startDelimeter, stop, endDelimeter) {
|
|
290
|
+
export var getRegionPathObjects = function (points, color, currentLineThickness, thickness, strokeDashArray, isCurved, startDelimeter, stop, endDelimeter, curveType) {
|
|
290
291
|
var _a, _b;
|
|
291
292
|
var ar = [{ d: '', color: '', strokeWidth: 0 }];
|
|
292
293
|
var tempStr = points;
|
|
294
|
+
var char = curveType === CurveType.QUADRATIC ? 'Q' : 'C';
|
|
293
295
|
if (!points.startsWith(startDelimeter)) {
|
|
294
296
|
/** ******************** line upto first segment *****************/
|
|
295
297
|
var lineSvgProps = {
|
|
@@ -326,7 +328,7 @@ export var getRegionPathObjects = function (points, color, currentLineThickness,
|
|
|
326
328
|
var stringUptoNextSegment = tempStr.substring(0, nextDelimiterIndex);
|
|
327
329
|
/** ******************** line upto the next segment *****************/
|
|
328
330
|
if (nextDelimiterIndex !== -1 &&
|
|
329
|
-
stringUptoNextSegment.includes(isCurved ?
|
|
331
|
+
stringUptoNextSegment.includes(isCurved ? char : 'L')) {
|
|
330
332
|
var previousSegment_1 = ar[ar.length - 1].d;
|
|
331
333
|
var moveToLastPointOfPreviousSegment_1 = getPreviousSegmentsLastPoint(isCurved, previousSegment_1);
|
|
332
334
|
var lineSvgProps_1 = {
|
|
@@ -357,10 +359,11 @@ export var getRegionPathObjects = function (points, color, currentLineThickness,
|
|
|
357
359
|
ar.shift();
|
|
358
360
|
return ar;
|
|
359
361
|
};
|
|
360
|
-
export var getSegmentedPathObjects = function (points, color, currentLineThickness, thickness, strokeDashArray, isCurved, startDelimeter, endDelimeter) {
|
|
362
|
+
export var getSegmentedPathObjects = function (points, color, currentLineThickness, thickness, strokeDashArray, isCurved, startDelimeter, endDelimeter, curveType) {
|
|
361
363
|
var _a, _b;
|
|
362
364
|
var ar = [{ d: '', color: '', strokeWidth: 0 }];
|
|
363
365
|
var tempStr = points;
|
|
366
|
+
var char = curveType === CurveType.QUADRATIC ? 'Q' : 'C';
|
|
364
367
|
if (!points.startsWith(startDelimeter)) {
|
|
365
368
|
/** ******************** line upto first segment *****************/
|
|
366
369
|
var lineSvgProps = {
|
|
@@ -385,13 +388,21 @@ export var getSegmentedPathObjects = function (points, color, currentLineThickne
|
|
|
385
388
|
var s = 0;
|
|
386
389
|
var i = void 0;
|
|
387
390
|
for (i = 0; i < segment.length; i++) {
|
|
388
|
-
if (segment[i] === (isCurved ?
|
|
389
|
-
|
|
390
|
-
|
|
391
|
+
if (segment[i] === (isCurved ? char : 'L')) {
|
|
392
|
+
if (curveType === CurveType.QUADRATIC) {
|
|
393
|
+
if (segment[i + 1] == ' ')
|
|
394
|
+
c++;
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
c++;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
if (c >= segmentLength) {
|
|
391
401
|
if (segment[i] === ' ')
|
|
392
402
|
s++;
|
|
393
|
-
if (s === (isCurved ? 3 : 2))
|
|
403
|
+
if (s === (isCurved ? (char === 'Q' ? 5 : 3) : 2)) {
|
|
394
404
|
break;
|
|
405
|
+
}
|
|
395
406
|
}
|
|
396
407
|
}
|
|
397
408
|
segment = segment.substring(0, i);
|
|
@@ -412,7 +423,7 @@ export var getSegmentedPathObjects = function (points, color, currentLineThickne
|
|
|
412
423
|
var stringUptoNextSegment = tempStr.substring(0, nextDelimiterIndex);
|
|
413
424
|
/** ******************** line upto the next segment *****************/
|
|
414
425
|
if (nextDelimiterIndex !== -1 &&
|
|
415
|
-
stringUptoNextSegment.includes(isCurved ?
|
|
426
|
+
stringUptoNextSegment.includes(isCurved ? char : 'L')) {
|
|
416
427
|
var previousSegment_2 = ar[ar.length - 1].d;
|
|
417
428
|
var moveToLastPointOfPreviousSegment_2 = getPreviousSegmentsLastPoint(isCurved, previousSegment_2);
|
|
418
429
|
var lineSvgProps_2 = {
|
|
@@ -1033,7 +1044,9 @@ export var emptyExternaLabelProperties = {
|
|
|
1033
1044
|
outY: 0,
|
|
1034
1045
|
finalX: 0,
|
|
1035
1046
|
labelComponentX: 0,
|
|
1036
|
-
|
|
1047
|
+
labelComponentY: 0,
|
|
1048
|
+
localExternalLabelComponent: null,
|
|
1049
|
+
isRightHalf: false
|
|
1037
1050
|
};
|
|
1038
1051
|
export var defaultLabelLineConfig = {
|
|
1039
1052
|
length: 10,
|
|
@@ -1042,7 +1055,8 @@ export var defaultLabelLineConfig = {
|
|
|
1042
1055
|
thickness: 1,
|
|
1043
1056
|
labelComponentWidth: 20,
|
|
1044
1057
|
labelComponentHeight: 10,
|
|
1045
|
-
labelComponentMargin: 4
|
|
1058
|
+
labelComponentMargin: 4,
|
|
1059
|
+
avoidOverlappingOfLabels: true
|
|
1046
1060
|
};
|
|
1047
1061
|
var secondLastIndexOf = function (text, seq) {
|
|
1048
1062
|
// assuming seq is a single char
|
package/dist/utils/types.d.ts
CHANGED