gifted-charts-core 0.1.54 → 0.1.55
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.js
CHANGED
|
@@ -415,7 +415,7 @@ export var useLineChart = function (props) {
|
|
|
415
415
|
Math, __spreadArray([], __read(mergedPrimaryDataArrays.map(function (i) { return Math.max(i.value, 0); })), false)); // find the smallest +ve number
|
|
416
416
|
var showFractionalValues = (_107 = props.showFractionalValues) !== null && _107 !== void 0 ? _107 : (isFinite(valuesRange) && valuesRange <= 1);
|
|
417
417
|
var roundToDigits = (_108 = props.roundToDigits) !== null && _108 !== void 0 ? _108 : (showFractionalValues ? indexOfFirstNonZeroDigit(valuesRange) + 1 : 0);
|
|
418
|
-
var _360 = computeMaxAndMinItems(mergedPrimaryDataArrays, roundToDigits, showFractionalValues, mergedPrimaryDataArraysOriginals), maxItem = _360.maxItem, minItem = _360.minItem;
|
|
418
|
+
var _360 = computeMaxAndMinItems(mergedPrimaryDataArrays, extrapolateMissingValues, roundToDigits, showFractionalValues, mergedPrimaryDataArraysOriginals), maxItem = _360.maxItem, minItem = _360.minItem;
|
|
419
419
|
var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxItem) || 10;
|
|
420
420
|
var mostNegativeValue = (_109 = props.mostNegativeValue) !== null && _109 !== void 0 ? _109 : minItem;
|
|
421
421
|
var overflowTop = ((_110 = props.overflowTop) !== null && _110 !== void 0 ? _110 : props.secondaryXAxis)
|
|
@@ -435,7 +435,7 @@ export var useLineChart = function (props) {
|
|
|
435
435
|
var secondaryRoundToDigits = (_114 = (_113 = props.secondaryYAxis) === null || _113 === void 0 ? void 0 : _113.roundToDigits) !== null && _114 !== void 0 ? _114 : (showSecondaryFractionalValues
|
|
436
436
|
? indexOfFirstNonZeroDigit(secondaryValuesRange) + 1
|
|
437
437
|
: 0);
|
|
438
|
-
var _361 = computeMaxAndMinItems(mergedSecondaryDataArrays, secondaryRoundToDigits, showSecondaryFractionalValues), secondaryMaxItem = _361.maxItem, secondaryMinItem = _361.minItem;
|
|
438
|
+
var _361 = computeMaxAndMinItems(mergedSecondaryDataArrays, extrapolateMissingValues, secondaryRoundToDigits, showSecondaryFractionalValues), secondaryMaxItem = _361.maxItem, secondaryMinItem = _361.minItem;
|
|
439
439
|
var secondaryMaxValue = (_116 = (_115 = props.secondaryYAxis) === null || _115 === void 0 ? void 0 : _115.maxValue) !== null && _116 !== void 0 ? _116 : (secondaryMaxItem || maxValue);
|
|
440
440
|
var getSecondaryY = function (value) {
|
|
441
441
|
return extendedContainerHeight - (value * containerHeight) / secondaryMaxValue;
|
|
@@ -104,7 +104,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
104
104
|
var secondaryDataArrayWithMinValue = (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length)
|
|
105
105
|
? secondaryData
|
|
106
106
|
: setWithMinValueInDataset === null || setWithMinValueInDataset === void 0 ? void 0 : setWithMinValueInDataset.data;
|
|
107
|
-
var _20 = computeMaxAndMinItems(secondaryDataArrayWithMinValue, (_13 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.roundToDigits) !== null && _13 !== void 0 ? _13 : roundToDigits, (_14 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showFractionalValues) !== null && _14 !== void 0 ? _14 : showFractionalValues), secondaryMaxItem = _20.maxItem, secondaryMinItem = _20.minItem;
|
|
107
|
+
var _20 = computeMaxAndMinItems(secondaryDataArrayWithMinValue, true, (_13 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.roundToDigits) !== null && _13 !== void 0 ? _13 : roundToDigits, (_14 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showFractionalValues) !== null && _14 !== void 0 ? _14 : showFractionalValues), secondaryMaxItem = _20.maxItem, secondaryMinItem = _20.minItem;
|
|
108
108
|
var _21 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepValue = _21.stepValue, secondaryNegativeStepValue = _21.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _21.noOfSectionsBelowXAxis, showSecondaryFractionalValues = _21.showFractionalValues, secondaryRoundToDigits = _21.roundToDigits, secondaryStepHeight = _21.stepHeight, secondaryNegativeStepHeight = _21.negativeStepHeight;
|
|
109
109
|
var primaryYAxisHeightBelowOrigin = noOfSectionsBelowXAxis * negativeStepHeight;
|
|
110
110
|
var secondaryYAxisHeightBelowOrigin = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
|
|
@@ -180,7 +180,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
180
180
|
secondaryStepHeight: secondaryStepHeight,
|
|
181
181
|
secondaryNegativeStepHeight: secondaryNegativeStepHeight,
|
|
182
182
|
customBackground: props.customBackground,
|
|
183
|
-
onlyPositive: onlyPositive
|
|
183
|
+
onlyPositive: onlyPositive
|
|
184
184
|
};
|
|
185
185
|
var lineInBarChartProps = {
|
|
186
186
|
yAxisLabelWidth: yAxisLabelWidth,
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ interface MaxAndMin {
|
|
|
88
88
|
}
|
|
89
89
|
export declare const indexOfFirstNonZeroDigit: (num: number) => number;
|
|
90
90
|
export declare const maxAndMinUtil: (maxItem: number, minItem: number, roundToDigits?: number, showFractionalValues?: boolean) => MaxAndMin;
|
|
91
|
-
export declare const computeMaxAndMinItems: (data: any[] | undefined, roundToDigits?: number, showFractionalValues?: boolean, propsData?: any[]) => MaxAndMin;
|
|
91
|
+
export declare const computeMaxAndMinItems: (data: any[] | undefined, extrapolateMissingValues: boolean, roundToDigits?: number, showFractionalValues?: boolean, propsData?: any[]) => MaxAndMin;
|
|
92
92
|
export declare const getLabelTextUtil: (val: string, index: number, showFractionalValues?: boolean, yAxisLabelTexts?: string[], yAxisOffset?: number, yAxisLabelPrefix?: string, yAxisLabelSuffix?: string, roundToDigits?: number, formatYLabel?: (label: string) => string) => string;
|
|
93
93
|
export declare const getXForLineInBar: (index: number, firstBarWidth: number, currentBarWidth: number, yAxisLabelWidth: number, lineConfig: any, spacing: number) => number;
|
|
94
94
|
export declare const getYForLineInBar: (value: number | undefined, shiftY: number | undefined, containerHeight: number, maxValue: number, yAxisOffset: number) => number;
|
package/dist/utils/index.js
CHANGED
|
@@ -717,7 +717,7 @@ export var maxAndMinUtil = function (maxItem, minItem, roundToDigits, showFracti
|
|
|
717
717
|
}
|
|
718
718
|
return { maxItem: maxItem, minItem: minItem };
|
|
719
719
|
};
|
|
720
|
-
export var computeMaxAndMinItems = function (data, roundToDigits, showFractionalValues, propsData) {
|
|
720
|
+
export var computeMaxAndMinItems = function (data, extrapolateMissingValues, roundToDigits, showFractionalValues, propsData) {
|
|
721
721
|
if (!(data === null || data === void 0 ? void 0 : data.length)) {
|
|
722
722
|
return { maxItem: 0, minItem: 0 };
|
|
723
723
|
}
|
|
@@ -727,7 +727,8 @@ export var computeMaxAndMinItems = function (data, roundToDigits, showFractional
|
|
|
727
727
|
if (item.value > maxItem) {
|
|
728
728
|
maxItem = item.value;
|
|
729
729
|
}
|
|
730
|
-
if (item.value < minItem &&
|
|
730
|
+
if (item.value < minItem &&
|
|
731
|
+
(extrapolateMissingValues || (propsData === null || propsData === void 0 ? void 0 : propsData[index].value))) {
|
|
731
732
|
minItem = item.value;
|
|
732
733
|
}
|
|
733
734
|
});
|