gifted-charts-core 0.1.68 → 0.1.69
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/BarChart/RenderBars.js +2 -1
- package/dist/BarChart/RenderStackBars.js +2 -1
- package/dist/BarChart/index.js +2 -1
- package/dist/LineChart/index.d.ts +1 -0
- package/dist/LineChart/index.js +6 -3
- package/dist/LineChart/types.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/utils/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AxesAndRulesDefaults } from '../utils/constants';
|
|
2
2
|
export var useRenderBars = function (props) {
|
|
3
3
|
var _a, _b, _c;
|
|
4
|
-
var data = props.data, item = props.item, index = props.index, barWidth = props.barWidth, initialSpacing = props.initialSpacing, propSpacing = props.propSpacing, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryStepHeight = props.secondaryStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue, secondaryStepValue = props.secondaryStepValue, negativeStepHeight = props.negativeStepHeight,
|
|
4
|
+
var data = props.data, item = props.item, index = props.index, barWidth = props.barWidth, initialSpacing = props.initialSpacing, propSpacing = props.propSpacing, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryStepHeight = props.secondaryStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue, secondaryStepValue = props.secondaryStepValue, negativeStepHeight = props.negativeStepHeight, nsv = props.negativeStepValue, stepHeight = props.stepHeight, stepValue = props.stepValue, minHeight = props.minHeight, _d = props.xAxisThickness, xAxisThickness = _d === void 0 ? AxesAndRulesDefaults.xAxisThickness : _d, leftShiftForLastIndexTooltip = props.leftShiftForLastIndexTooltip, leftShiftForTooltip = props.leftShiftForTooltip, renderTooltip = props.renderTooltip, autoCenterTooltip = props.autoCenterTooltip, horizontal = props.horizontal, containerHeight = props.containerHeight, containerHeightIncludingBelowXAxis = props.containerHeightIncludingBelowXAxis;
|
|
5
|
+
var negativeStepValue = Math.abs(nsv);
|
|
5
6
|
var heightFactor = item.isSecondary
|
|
6
7
|
? item.value < 0
|
|
7
8
|
? (secondaryNegativeStepHeight !== null && secondaryNegativeStepHeight !== void 0 ? secondaryNegativeStepHeight : secondaryStepHeight) /
|
|
@@ -18,7 +18,8 @@ import { useState } from 'react';
|
|
|
18
18
|
import { BarDefaults } from '../utils/constants';
|
|
19
19
|
export var useRenderStackBars = function (props) {
|
|
20
20
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
21
|
-
var item = props.item, index = props.index, _k = props.containerHeight, containerHeight = _k === void 0 ? 200 : _k, containerHeightIncludingBelowXAxis = props.containerHeightIncludingBelowXAxis, maxValue = props.maxValue, propSpacing = props.propSpacing, initialSpacing = props.initialSpacing, stackData = props.stackData, isAnimated = props.isAnimated, xAxisThickness = props.xAxisThickness, renderTooltip = props.renderTooltip, leftShiftForTooltip = props.leftShiftForTooltip, leftShiftForLastIndexTooltip = props.leftShiftForLastIndexTooltip, autoCenterTooltip = props.autoCenterTooltip, horizontal = props.horizontal, stepHeight = props.stepHeight, stepValue = props.stepValue, negativeStepHeight = props.negativeStepHeight,
|
|
21
|
+
var item = props.item, index = props.index, _k = props.containerHeight, containerHeight = _k === void 0 ? 200 : _k, containerHeightIncludingBelowXAxis = props.containerHeightIncludingBelowXAxis, maxValue = props.maxValue, propSpacing = props.propSpacing, initialSpacing = props.initialSpacing, stackData = props.stackData, isAnimated = props.isAnimated, xAxisThickness = props.xAxisThickness, renderTooltip = props.renderTooltip, leftShiftForTooltip = props.leftShiftForTooltip, leftShiftForLastIndexTooltip = props.leftShiftForLastIndexTooltip, autoCenterTooltip = props.autoCenterTooltip, horizontal = props.horizontal, stepHeight = props.stepHeight, stepValue = props.stepValue, negativeStepHeight = props.negativeStepHeight, nsv = props.negativeStepValue, secondaryStepHeight = props.secondaryStepHeight, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue;
|
|
22
|
+
var negativeStepValue = Math.abs(nsv);
|
|
22
23
|
var containsNegativeValue = item.stacks.some(function (item) { return item.value < 0; });
|
|
23
24
|
var anyStackContainsNegativeValue = stackData.some(function (item) {
|
|
24
25
|
return item.stacks.some(function (stack) { return stack.value < 0; });
|
package/dist/BarChart/index.js
CHANGED
|
@@ -30,7 +30,8 @@ import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPad
|
|
|
30
30
|
import { AxesAndRulesDefaults, BarDefaults, chartTypes, defaultLineConfig, defaultPointerConfig } from '../utils/constants';
|
|
31
31
|
export var useBarChart = function (props) {
|
|
32
32
|
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, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69;
|
|
33
|
-
var heightValue = props.heightValue, widthValue = props.widthValue, opacityValue = props.opacityValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth, labelsDistanceFromXaxis = props.labelsDistanceFromXaxis, autoShiftLabelsForNegativeStacks = props.autoShiftLabelsForNegativeStacks, focusedBarIndex = props.focusedBarIndex,
|
|
33
|
+
var heightValue = props.heightValue, widthValue = props.widthValue, opacityValue = props.opacityValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth, labelsDistanceFromXaxis = props.labelsDistanceFromXaxis, autoShiftLabelsForNegativeStacks = props.autoShiftLabelsForNegativeStacks, focusedBarIndex = props.focusedBarIndex, nsv = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip, floatingYAxisLabels = props.floatingYAxisLabels;
|
|
34
|
+
var negativeStepValue = nsv ? Math.abs(nsv) : undefined;
|
|
34
35
|
var allowFontScaling = (_a = props.allowFontScaling) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.allowFontScaling;
|
|
35
36
|
var _70 = __read(useState(''), 2), points = _70[0], setPoints = _70[1];
|
|
36
37
|
var _71 = __read(useState(''), 2), points2 = _71[0], setPoints2 = _71[1];
|
|
@@ -226,6 +226,7 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
|
|
|
226
226
|
color3: string;
|
|
227
227
|
color4: string;
|
|
228
228
|
color5: string;
|
|
229
|
+
colors: import("../utils/types").ColorFromToY[] | undefined;
|
|
229
230
|
startFillColor1: string;
|
|
230
231
|
endFillColor1: string;
|
|
231
232
|
startOpacity: number;
|
package/dist/LineChart/index.js
CHANGED
|
@@ -40,7 +40,7 @@ import { colorsToLowerCase, computeMaxAndMinItems, getAllArrowProperties, getArr
|
|
|
40
40
|
import { EdgePosition } from '../utils/types';
|
|
41
41
|
export var useLineChart = function (props) {
|
|
42
42
|
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, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133, _134, _135, _136, _137, _138, _139, _140, _141, _142, _143, _144, _145, _146, _147, _148, _149, _150, _151, _152, _153, _154, _155, _156, _157, _158, _159, _160, _161, _162, _163, _164, _165, _166, _167, _168, _169, _170, _171, _172, _173, _174, _175, _176, _177, _178, _179, _180, _181, _182, _183, _184, _185, _186, _187, _188, _189, _190, _191, _192, _193, _194, _195, _196, _197, _198, _199, _200, _201, _202, _203, _204, _205, _206, _207, _208, _209, _210, _211, _212, _213, _214, _215, _216, _217, _218, _219, _220, _221, _222, _223, _224, _225, _226, _227, _228, _229, _230, _231, _232, _233, _234, _235, _236, _237, _238, _239, _240, _241, _242, _243, _244, _245, _246, _247, _248, _249, _250, _251, _252, _253, _254, _255, _256, _257, _258, _259, _260, _261, _262, _263, _264, _265, _266, _267, _268, _269, _270, _271, _272, _273, _274, _275, _276, _277, _278, _279, _280, _281, _282, _283, _284, _285, _286, _287, _288, _289, _290, _291, _292, _293, _294, _295, _296, _297, _298, _299, _300, _301, _302, _303, _304, _305, _306, _307, _308, _309, _310, _311, _312, _313, _314, _315, _316, _317, _318, _319, _320, _321, _322, _323, _324, _325, _326, _327, _328, _329, _330, _331, _332, _333, _334, _335, _336, _337, _338;
|
|
43
|
-
var showDataPointsForMissingValues = props.showDataPointsForMissingValues, _339 = props.interpolateMissingValues, interpolateMissingValues = _339 === void 0 ? true : _339, _340 = props.extrapolateMissingValues, extrapolateMissingValues = _340 === void 0 ? true : _340, yAxisOffset = props.yAxisOffset, parentWidth = props.parentWidth, renderTooltip = props.renderTooltip, _341 = props.renderTooltip1, renderTooltip1 = _341 === void 0 ? props.renderTooltip : _341, _342 = props.renderTooltip2, renderTooltip2 = _342 === void 0 ? props.renderTooltip : _342, _343 = props.renderTooltip3, renderTooltip3 = _343 === void 0 ? props.renderTooltip : _343, _344 = props.renderTooltip4, renderTooltip4 = _344 === void 0 ? props.renderTooltip : _344, _345 = props.renderTooltip5, renderTooltip5 = _345 === void 0 ? props.renderTooltip : _345, _346 = props.renderTooltipSecondary, renderTooltipSecondary = _346 === void 0 ? props.renderTooltip : _346;
|
|
43
|
+
var showDataPointsForMissingValues = props.showDataPointsForMissingValues, _339 = props.interpolateMissingValues, interpolateMissingValues = _339 === void 0 ? true : _339, _340 = props.extrapolateMissingValues, extrapolateMissingValues = _340 === void 0 ? true : _340, yAxisOffset = props.yAxisOffset, parentWidth = props.parentWidth, renderTooltip = props.renderTooltip, _341 = props.renderTooltip1, renderTooltip1 = _341 === void 0 ? props.renderTooltip : _341, _342 = props.renderTooltip2, renderTooltip2 = _342 === void 0 ? props.renderTooltip : _342, _343 = props.renderTooltip3, renderTooltip3 = _343 === void 0 ? props.renderTooltip : _343, _344 = props.renderTooltip4, renderTooltip4 = _344 === void 0 ? props.renderTooltip : _344, _345 = props.renderTooltip5, renderTooltip5 = _345 === void 0 ? props.renderTooltip : _345, _346 = props.renderTooltipSecondary, renderTooltipSecondary = _346 === void 0 ? props.renderTooltip : _346, colors = props.colors;
|
|
44
44
|
var lastLineNumber = 1;
|
|
45
45
|
if (props.secondaryData) {
|
|
46
46
|
lastLineNumber = 6667; // lastLineNumber is 6667 for a secondary line, so the index or key of the secondary line is 6666
|
|
@@ -141,7 +141,9 @@ export var useLineChart = function (props) {
|
|
|
141
141
|
var labelsExtraHeight = (_x = props.labelsExtraHeight) !== null && _x !== void 0 ? _x : 0;
|
|
142
142
|
var animationDuration = (_y = props.animationDuration) !== null && _y !== void 0 ? _y : LineDefaults.animationDuration;
|
|
143
143
|
var onDataChangeAnimationDuration = (_z = props.onDataChangeAnimationDuration) !== null && _z !== void 0 ? _z : 400;
|
|
144
|
-
var animateTogether =
|
|
144
|
+
var animateTogether = colors
|
|
145
|
+
? true
|
|
146
|
+
: (_0 = props.animateTogether) !== null && _0 !== void 0 ? _0 : LineDefaults.animateTogether;
|
|
145
147
|
var renderDataPointsAfterAnimationEnds = (_1 = props.renderDataPointsAfterAnimationEnds) !== null && _1 !== void 0 ? _1 : LineDefaults.renderDataPointsAfterAnimationEnds;
|
|
146
148
|
var animateOnDataChange = (_2 = props.animateOnDataChange) !== null && _2 !== void 0 ? _2 : false;
|
|
147
149
|
var startIndex1 = (_4 = (_3 = props.startIndex1) !== null && _3 !== void 0 ? _3 : props.startIndex) !== null && _4 !== void 0 ? _4 : 0;
|
|
@@ -1089,7 +1091,7 @@ export var useLineChart = function (props) {
|
|
|
1089
1091
|
var getY = function (value) {
|
|
1090
1092
|
if (containsNegativeValue && value < 0 && stepValue !== negativeStepValue) {
|
|
1091
1093
|
return (extendedContainerHeight +
|
|
1092
|
-
(value * fourthQuadrantHeight) /
|
|
1094
|
+
(value * fourthQuadrantHeight) / mostNegativeValueOnYAxis);
|
|
1093
1095
|
}
|
|
1094
1096
|
return extendedContainerHeight - (value * containerHeight) / maxValue;
|
|
1095
1097
|
};
|
|
@@ -1642,6 +1644,7 @@ export var useLineChart = function (props) {
|
|
|
1642
1644
|
color3: color3,
|
|
1643
1645
|
color4: color4,
|
|
1644
1646
|
color5: color5,
|
|
1647
|
+
colors: colors,
|
|
1645
1648
|
startFillColor1: startFillColor1,
|
|
1646
1649
|
endFillColor1: endFillColor1,
|
|
1647
1650
|
startOpacity: startOpacity,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GestureResponderEvent, StyleProp, TextStyle, ViewStyle, type ColorValue } from 'react-native';
|
|
2
2
|
import { type yAxisSides } from '../utils/constants';
|
|
3
|
-
import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType, type Linecap, type IntersectionAreaConfig, CustomBackground, SpreadData } from '../utils/types';
|
|
3
|
+
import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType, type Linecap, type IntersectionAreaConfig, CustomBackground, SpreadData, ColorFromToY } from '../utils/types';
|
|
4
4
|
export interface LineChartPropsType {
|
|
5
5
|
height?: number;
|
|
6
6
|
overflowTop?: number;
|
|
@@ -154,6 +154,7 @@ export interface LineChartPropsType {
|
|
|
154
154
|
color3?: string;
|
|
155
155
|
color4?: string;
|
|
156
156
|
color5?: string;
|
|
157
|
+
colors?: ColorFromToY[];
|
|
157
158
|
yAxisThickness?: number;
|
|
158
159
|
yAxisColor?: ColorValue;
|
|
159
160
|
yAxisExtraHeight?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -42,4 +42,4 @@ export { type StripAndLabelProps } from './components/common/types';
|
|
|
42
42
|
/***********************************************************************************************************************/
|
|
43
43
|
export { getCumulativeWidth, getLighterColor, svgQuadraticCurvePath, svgPath, bezierCommand, getSegmentString, getCurvePathWithSegments, getPreviousSegmentsLastPoint, getPathWithHighlight, getRegionPathObjects, getSegmentedPathObjects, getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getSecondaryDataWithOffsetIncluded, getArrowProperty, getAllArrowProperties, maxAndMinUtil, computeMaxAndMinItems, getLabelTextUtil, getXForLineInBar, getYForLineInBar, clone, getLineConfigForBarChart, adjustToOffset, pointsWithPaddedRepititions } from './utils';
|
|
44
44
|
export { chartTypes, yAxisSides, loc, SEGMENT_START, SEGMENT_END, RANGE_ENTER, RANGE_EXIT, STOP, ruleTypes, AxesAndRulesDefaults, defaultArrowConfig, BarDefaults, defaultLineConfig, LineDefaults, defaultPointerConfig, pieColors, populationDefaults, defaultAnimationDuration } from './utils/constants';
|
|
45
|
-
export { type RuleType, type RuleTypes, type RulesConfig, CurveType, EdgePosition, type LabelsPosition, type PointerEvents, type secondaryYAxisType, type secondaryLineConfigType, type referenceConfigType, type arrowConfigType, type horizSectionPropTypes, type HorizSectionsType, type BarAndLineChartsWrapperTypes, type Pointer, type HighlightedRange, type LineSegment, type LineSvgProps, type LineProperties, type DataSet, type DataSetNullSafe, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps, type Linecap, type IntersectionAreaConfig, type LabelLineConfig, type TooltipProps, type SpreadData } from './utils/types';
|
|
45
|
+
export { type RuleType, type RuleTypes, type RulesConfig, CurveType, EdgePosition, type LabelsPosition, type PointerEvents, type secondaryYAxisType, type secondaryLineConfigType, type referenceConfigType, type arrowConfigType, type horizSectionPropTypes, type HorizSectionsType, type BarAndLineChartsWrapperTypes, type Pointer, type HighlightedRange, type LineSegment, type LineSvgProps, type LineProperties, type DataSet, type DataSetNullSafe, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps, type Linecap, type IntersectionAreaConfig, type LabelLineConfig, type TooltipProps, type SpreadData, type ColorFromToY } from './utils/types';
|
package/dist/utils/types.d.ts
CHANGED