gifted-charts-core 0.1.2 → 0.1.3
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 +1 -1
- package/src/LineChart/index.d.ts +1 -1
- package/src/LineChart/index.js +9 -4
- package/src/LineChart/index.ts +11 -4
- package/src/PieChart/pro.js +3 -3
- package/src/PieChart/pro.ts +4 -4
- package/src/utils/types.d.ts +1 -0
- package/src/utils/types.ts +1 -0
package/package.json
CHANGED
package/src/LineChart/index.d.ts
CHANGED
|
@@ -306,7 +306,7 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
|
|
|
306
306
|
addLeadingAndTrailingPathForAreaFill: (initialPath: string, value: number, dataLength: number) => string;
|
|
307
307
|
getNextPoint: (data: lineDataItem[], index: number, around: boolean, before: boolean) => string;
|
|
308
308
|
getStepPath: (data: lineDataItem[], i: number) => string;
|
|
309
|
-
getSegmentPath: (data: lineDataItem[], i: number, lineSegment: LineSegment[] | undefined, startIndex: number, endIndex: number) => string;
|
|
309
|
+
getSegmentPath: (data: lineDataItem[], i: number, lineSegment: LineSegment[] | undefined, startIndex: number, endIndex: number, isSecondary?: boolean) => string;
|
|
310
310
|
gradientDirection: string;
|
|
311
311
|
horizSections: {
|
|
312
312
|
value: string;
|
package/src/LineChart/index.js
CHANGED
|
@@ -414,11 +414,11 @@ export var useLineChart = function (props) {
|
|
|
414
414
|
getY(data[i].value) +
|
|
415
415
|
getNextPoint(data, i, around, before));
|
|
416
416
|
};
|
|
417
|
-
var getSegmentPath = function (data, i, lineSegment, startIndex, endIndex) {
|
|
417
|
+
var getSegmentPath = function (data, i, lineSegment, startIndex, endIndex, isSecondary) {
|
|
418
418
|
var path = 'L' +
|
|
419
419
|
getX(i) +
|
|
420
420
|
' ' +
|
|
421
|
-
getY(data[i].value) +
|
|
421
|
+
(isSecondary ? getSecondaryY(data[i].value) : getY(data[i].value)) +
|
|
422
422
|
' ' +
|
|
423
423
|
getSegmentString(lineSegment, i, SEGMENT_START, SEGMENT_END);
|
|
424
424
|
if (highlightedRange) {
|
|
@@ -439,7 +439,12 @@ export var useLineChart = function (props) {
|
|
|
439
439
|
for (var i = 0; i < set.data.length; i++) {
|
|
440
440
|
if (i >= ((_b = set.startIndex) !== null && _b !== void 0 ? _b : 0) &&
|
|
441
441
|
i <= ((_c = set.endIndex) !== null && _c !== void 0 ? _c : set.data.length - 1)) {
|
|
442
|
-
pArray.push([
|
|
442
|
+
pArray.push([
|
|
443
|
+
getX(i),
|
|
444
|
+
set.isSecondary
|
|
445
|
+
? getSecondaryY(set.data[i].value)
|
|
446
|
+
: getY(set.data[i].value)
|
|
447
|
+
]);
|
|
443
448
|
}
|
|
444
449
|
}
|
|
445
450
|
var xx = svgPath(pArray, (_d = set.curveType) !== null && _d !== void 0 ? _d : curveType, (_e = set.curvature) !== null && _e !== void 0 ? _e : curvature);
|
|
@@ -468,7 +473,7 @@ export var useLineChart = function (props) {
|
|
|
468
473
|
pp += getStepPath(set.data, i);
|
|
469
474
|
}
|
|
470
475
|
else {
|
|
471
|
-
pp += getSegmentPath(set.data, i, set.lineSegments, (_l = set.startIndex) !== null && _l !== void 0 ? _l : 0, (_m = set.endIndex) !== null && _m !== void 0 ? _m : set.data.length - 1);
|
|
476
|
+
pp += getSegmentPath(set.data, i, set.lineSegments, (_l = set.startIndex) !== null && _l !== void 0 ? _l : 0, (_m = set.endIndex) !== null && _m !== void 0 ? _m : set.data.length - 1, set.isSecondary);
|
|
472
477
|
}
|
|
473
478
|
}
|
|
474
479
|
}
|
package/src/LineChart/index.ts
CHANGED
|
@@ -727,13 +727,14 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
727
727
|
i: number,
|
|
728
728
|
lineSegment: LineSegment[] | undefined,
|
|
729
729
|
startIndex: number,
|
|
730
|
-
endIndex: number
|
|
730
|
+
endIndex: number,
|
|
731
|
+
isSecondary?: boolean
|
|
731
732
|
): string => {
|
|
732
733
|
let path =
|
|
733
734
|
'L' +
|
|
734
735
|
getX(i) +
|
|
735
736
|
' ' +
|
|
736
|
-
getY(data[i].value) +
|
|
737
|
+
(isSecondary ? getSecondaryY(data[i].value) : getY(data[i].value)) +
|
|
737
738
|
' ' +
|
|
738
739
|
getSegmentString(lineSegment, i, SEGMENT_START, SEGMENT_END)
|
|
739
740
|
|
|
@@ -764,7 +765,12 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
764
765
|
i >= (set.startIndex ?? 0) &&
|
|
765
766
|
i <= (set.endIndex ?? set.data.length - 1)
|
|
766
767
|
) {
|
|
767
|
-
pArray.push([
|
|
768
|
+
pArray.push([
|
|
769
|
+
getX(i),
|
|
770
|
+
set.isSecondary
|
|
771
|
+
? getSecondaryY(set.data[i].value)
|
|
772
|
+
: getY(set.data[i].value)
|
|
773
|
+
])
|
|
768
774
|
}
|
|
769
775
|
}
|
|
770
776
|
let xx = svgPath(
|
|
@@ -825,7 +831,8 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
825
831
|
i,
|
|
826
832
|
set.lineSegments,
|
|
827
833
|
set.startIndex ?? 0,
|
|
828
|
-
set.endIndex ?? set.data.length - 1
|
|
834
|
+
set.endIndex ?? set.data.length - 1,
|
|
835
|
+
set.isSecondary
|
|
829
836
|
)
|
|
830
837
|
}
|
|
831
838
|
}
|
package/src/PieChart/pro.js
CHANGED
|
@@ -34,9 +34,9 @@ export var usePiePro = function (props) {
|
|
|
34
34
|
var heightFactor = semiCircle ? 1 : 2;
|
|
35
35
|
var height = radius + maxStrokeWidth;
|
|
36
36
|
var svgProps = {
|
|
37
|
-
height:
|
|
38
|
-
width:
|
|
39
|
-
viewBox: "".concat(-maxStrokeWidth, " ").concat(-maxStrokeWidth - (semiCircle ? height / 2 : 0), " ").concat(
|
|
37
|
+
height: height * 2,
|
|
38
|
+
width: height * 2,
|
|
39
|
+
viewBox: "".concat(-maxStrokeWidth * 1.5, " ").concat(-maxStrokeWidth - (semiCircle ? height / 2 : 0), " ").concat(height * 2, " ").concat(height * 2)
|
|
40
40
|
};
|
|
41
41
|
// let endAngleLocal = 0
|
|
42
42
|
var addValues = function (index) {
|
package/src/PieChart/pro.ts
CHANGED
|
@@ -57,11 +57,11 @@ export const usePiePro = (props: PieChartPropsType): IusePiePro => {
|
|
|
57
57
|
const height = radius + maxStrokeWidth
|
|
58
58
|
|
|
59
59
|
const svgProps = {
|
|
60
|
-
height:
|
|
61
|
-
width:
|
|
62
|
-
viewBox: `${-maxStrokeWidth} ${
|
|
60
|
+
height: height * 2,
|
|
61
|
+
width: height * 2,
|
|
62
|
+
viewBox: `${-maxStrokeWidth * 1.5} ${
|
|
63
63
|
-maxStrokeWidth - (semiCircle ? height / 2 : 0)
|
|
64
|
-
} ${
|
|
64
|
+
} ${height * 2} ${height * 2}`
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// let endAngleLocal = 0
|
package/src/utils/types.d.ts
CHANGED