gifted-charts-core 0.1.50 → 0.1.52

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/README.md CHANGED
@@ -1 +1,4 @@
1
- This library contains the common code used by [react-native-gifted-charts](https://www.npmjs.com/package/react-native-gifted-charts) and [react-gifted-charts](https://www.npmjs.com/package/react-gifted-charts).
1
+ This library contains the common code used by [react-native-gifted-charts](https://www.npmjs.com/package/react-native-gifted-charts) and [react-gifted-charts](https://www.npmjs.com/package/react-gifted-charts). <br/><br />
2
+
3
+
4
+ ![Gifted charts](https://raw.githubusercontent.com/Abhinandan-Kushwaha/react-native-gifted-charts/db0b1034ed869c87db66998efb8588da76c7439a/docs/dev/gifted-charts-architecture.drawio.svg)
@@ -0,0 +1,8 @@
1
+ import { TooltipProps } from '../utils/types';
2
+ import { RenderBarsPropsType } from './types';
3
+ export declare const useRenderBars: (props: RenderBarsPropsType) => {
4
+ heightFactor: number;
5
+ barHeight: number;
6
+ leftSpacing: number;
7
+ tooltipProps: TooltipProps;
8
+ };
@@ -0,0 +1,51 @@
1
+ import { AxesAndRulesDefaults } from '../utils/constants';
2
+ export var useRenderBars = function (props) {
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, negativeStepValue = 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 heightFactor = item.isSecondary
6
+ ? item.value < 0
7
+ ? (secondaryNegativeStepHeight !== null && secondaryNegativeStepHeight !== void 0 ? secondaryNegativeStepHeight : secondaryStepHeight) /
8
+ (secondaryNegativeStepValue !== null && secondaryNegativeStepValue !== void 0 ? secondaryNegativeStepValue : secondaryStepValue)
9
+ : secondaryStepHeight / secondaryStepValue
10
+ : item.value < 0
11
+ ? negativeStepHeight / negativeStepValue
12
+ : stepHeight / stepValue;
13
+ var barHeight = Math.max(minHeight, Math.abs(item.value) * heightFactor - xAxisThickness);
14
+ var leftSpacing = initialSpacing;
15
+ for (var i = 0; i < index; i++) {
16
+ leftSpacing +=
17
+ ((_a = data[i].spacing) !== null && _a !== void 0 ? _a : propSpacing) + (data[i].barWidth || barWidth);
18
+ }
19
+ var containsNegativeValue = data.some(function (item) { return item.value < 0; });
20
+ var chartHeightBelowXAxis = containerHeightIncludingBelowXAxis - containerHeight;
21
+ var getBotomForTooltip = function () {
22
+ if (item.value < 0) {
23
+ return chartHeightBelowXAxis - barHeight - 34;
24
+ }
25
+ else {
26
+ return ((containsNegativeValue
27
+ ? barHeight + chartHeightBelowXAxis - 8
28
+ : barHeight) + 2);
29
+ }
30
+ };
31
+ var tooltipProps = {
32
+ barHeight: barHeight,
33
+ barWidth: item.barWidth || barWidth,
34
+ item: item,
35
+ index: index,
36
+ isLast: index === data.length - 1,
37
+ leftSpacing: leftSpacing,
38
+ leftShiftForLastIndexTooltip: leftShiftForLastIndexTooltip,
39
+ leftShiftForTooltip: (_c = (_b = item.leftShiftForTooltip) !== null && _b !== void 0 ? _b : leftShiftForTooltip) !== null && _c !== void 0 ? _c : 0,
40
+ renderTooltip: renderTooltip,
41
+ autoCenterTooltip: autoCenterTooltip,
42
+ horizontal: horizontal,
43
+ bottom: getBotomForTooltip()
44
+ };
45
+ return {
46
+ heightFactor: heightFactor,
47
+ barHeight: barHeight,
48
+ leftSpacing: leftSpacing,
49
+ tooltipProps: tooltipProps
50
+ };
51
+ };
@@ -1,4 +1,5 @@
1
1
  import { type StackedBarChartPropsType, type stackDataItem } from './types';
2
+ import { TooltipProps } from '../utils/types';
2
3
  export declare const useRenderStackBars: (props: StackedBarChartPropsType) => {
3
4
  containsNegativeValue: boolean;
4
5
  noAnimation: boolean;
@@ -23,17 +24,5 @@ export declare const useRenderStackBars: (props: StackedBarChartPropsType) => {
23
24
  borderBottomLeftRadius: number;
24
25
  borderBottomRightRadius: number;
25
26
  };
26
- tooltipProps: {
27
- barHeight: number;
28
- barWidth: number;
29
- item: stackDataItem;
30
- index: number;
31
- isLast: boolean;
32
- leftSpacing: number;
33
- leftShiftForLastIndexTooltip: number;
34
- leftShiftForTooltip: number;
35
- renderTooltip: Function | undefined;
36
- autoCenterTooltip: boolean | undefined;
37
- horizontal: boolean;
38
- };
27
+ tooltipProps: TooltipProps;
39
28
  };
@@ -17,8 +17,11 @@ var __read = (this && this.__read) || function (o, n) {
17
17
  import { useState } from 'react';
18
18
  export var useRenderStackBars = function (props) {
19
19
  var _a, _b, _c, _d, _e, _f, _g, _h;
20
- var item = props.item, index = props.index, containerHeight = props.containerHeight, 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, negativeStepValue = props.negativeStepValue, secondaryStepHeight = props.secondaryStepHeight, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue;
20
+ var item = props.item, index = props.index, _j = props.containerHeight, containerHeight = _j === void 0 ? 200 : _j, 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, negativeStepValue = props.negativeStepValue, secondaryStepHeight = props.secondaryStepHeight, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue;
21
21
  var containsNegativeValue = item.stacks.some(function (item) { return item.value < 0; });
22
+ var anyStackContainsNegativeValue = stackData.some(function (item) {
23
+ return item.stacks.some(function (stack) { return stack.value < 0; });
24
+ });
22
25
  var noAnimation = containsNegativeValue || !isAnimated;
23
26
  var localBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
24
27
  var borderRadius = item.borderRadius, borderTopLeftRadius = item.borderTopLeftRadius, borderTopRightRadius = item.borderTopRightRadius, borderBottomLeftRadius = item.borderBottomLeftRadius, borderBottomRightRadius = item.borderBottomRightRadius;
@@ -40,7 +43,7 @@ export var useRenderStackBars = function (props) {
40
43
  Math.abs(stack.value) *
41
44
  (stack.value < 0 ? negativeHeightFactor : heightFactor);
42
45
  }, 0);
43
- var _j = __read(useState(noAnimation ? totalHeight : 1), 2), height = _j[0], setHeight = _j[1];
46
+ var _k = __read(useState(noAnimation ? totalHeight : 1), 2), height = _k[0], setHeight = _k[1];
44
47
  var getBarHeight = function (value, marginBottom) {
45
48
  return (Math.abs(value) * (value < 0 ? negativeHeightFactor : heightFactor) -
46
49
  (marginBottom !== null && marginBottom !== void 0 ? marginBottom : 0));
@@ -48,10 +51,6 @@ export var useRenderStackBars = function (props) {
48
51
  var getPosition = function (index, height) {
49
52
  /* Returns bottom position for stack item
50
53
  negative values are below origin (-> negative position) */
51
- // const height = getBarHeight(
52
- // item.stacks[index].value,
53
- // item.stacks[index].marginBottom
54
- // )
55
54
  var itemValue = item.stacks[index].value;
56
55
  var isNegative = itemValue <= 0;
57
56
  var position = isNegative ? -(height || 0) - xAxisThickness : 0;
@@ -72,10 +71,19 @@ export var useRenderStackBars = function (props) {
72
71
  var _a;
73
72
  return (((_a = item.stacks
74
73
  .map(function (_, index) {
75
- return getPosition(index, getBarHeight(index, _.marginBottom));
74
+ return getPosition(index, getBarHeight(_.value, _.marginBottom));
76
75
  })
77
76
  .sort(function (a, b) { return a - b; })) === null || _a === void 0 ? void 0 : _a[0]) || 0);
78
77
  };
78
+ var getPositiveBoxesHeightSum = function () {
79
+ var sum = 0;
80
+ item.stacks.forEach(function (_, ind) {
81
+ var value = _.value;
82
+ sum += value > 0 ? getBarHeight(value, _.marginBottom) : 0;
83
+ console.log(ind, sum);
84
+ });
85
+ return sum;
86
+ };
79
87
  var lowestBarPosition = getLowestPosition();
80
88
  var getStackBorderRadii = function (item, index) {
81
89
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
@@ -88,8 +96,25 @@ export var useRenderStackBars = function (props) {
88
96
  };
89
97
  return borderRadii;
90
98
  };
99
+ var chartHeightBelowXAxis = containerHeightIncludingBelowXAxis - containerHeight;
100
+ var barHeight = totalHeight;
101
+ var getBotomForTooltip = function () {
102
+ var _a;
103
+ if (anyStackContainsNegativeValue) {
104
+ // If any of the stacks has a negative value
105
+ if (item.stacks.some(function (stack) { return stack.value > 0; })) {
106
+ // if a box in the current stack has a +ve value
107
+ return chartHeightBelowXAxis + ((_a = getPositiveBoxesHeightSum()) !== null && _a !== void 0 ? _a : 0) - 8;
108
+ }
109
+ else
110
+ return chartHeightBelowXAxis - barHeight - 34;
111
+ }
112
+ else {
113
+ return barHeight + 2;
114
+ }
115
+ };
91
116
  var tooltipProps = {
92
- barHeight: totalHeight,
117
+ barHeight: barHeight,
93
118
  barWidth: item.barWidth || props.barWidth || 30,
94
119
  item: item,
95
120
  index: index,
@@ -99,7 +124,8 @@ export var useRenderStackBars = function (props) {
99
124
  leftShiftForTooltip: (_h = (_g = item.leftShiftForTooltip) !== null && _g !== void 0 ? _g : leftShiftForTooltip) !== null && _h !== void 0 ? _h : 0,
100
125
  renderTooltip: renderTooltip,
101
126
  autoCenterTooltip: autoCenterTooltip,
102
- horizontal: horizontal
127
+ horizontal: horizontal,
128
+ bottom: getBotomForTooltip()
103
129
  };
104
130
  return {
105
131
  containsNegativeValue: containsNegativeValue,
@@ -120,6 +120,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
120
120
  item: any;
121
121
  index: number;
122
122
  containerHeight: number;
123
+ containerHeightIncludingBelowXAxis: number;
123
124
  maxValue: number;
124
125
  spacing: any;
125
126
  propSpacing: number;
@@ -477,6 +477,7 @@ export var useBarChart = function (props) {
477
477
  item: item,
478
478
  index: index,
479
479
  containerHeight: containerHeight,
480
+ containerHeightIncludingBelowXAxis: containerHeightIncludingBelowXAxis,
480
481
  maxValue: maxValue,
481
482
  spacing: (_a = item.spacing) !== null && _a !== void 0 ? _a : spacing,
482
483
  propSpacing: spacing,
@@ -74,7 +74,7 @@ export interface StackedBarChartPropsType {
74
74
  disablePress?: boolean;
75
75
  item: stackDataItem;
76
76
  index: number;
77
- containerHeight?: number;
77
+ containerHeight: number;
78
78
  maxValue: number;
79
79
  spacing: number;
80
80
  propSpacing?: number;
@@ -136,7 +136,7 @@ export interface StackedBarChartPropsType {
136
136
  secondaryNegativeStepHeight: number;
137
137
  secondaryNegativeStepValue: number;
138
138
  secondaryNoOfSectionsBelowXAxis: number;
139
- containerHeightIncludingBelowXAxis?: number;
139
+ containerHeightIncludingBelowXAxis: number;
140
140
  }
141
141
  export interface BarChartPropsType {
142
142
  width?: number;
@@ -520,7 +520,8 @@ export interface RenderBarsPropsType {
520
520
  index: number;
521
521
  label: string;
522
522
  secondaryLabel: string;
523
- containerHeight?: number;
523
+ containerHeight: number;
524
+ containerHeightIncludingBelowXAxis: number;
524
525
  maxValue: number;
525
526
  spacing: number;
526
527
  propSpacing?: number;
@@ -397,7 +397,11 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
397
397
  cumulativeSpacingForSet: any[];
398
398
  stripOverDataPoints: boolean | undefined;
399
399
  strips: any;
400
+ selectedLineNumber: number;
401
+ setSelectedLineNumber: import("react").Dispatch<import("react").SetStateAction<number>>;
400
402
  lastLineNumber: number;
401
403
  focusTogether: boolean;
402
404
  focusProximity: number;
405
+ handleFocus: (index: number, item: lineDataItemNullSafe, locationY: number, onStripPress: Function) => void;
406
+ handleUnFocus: () => void;
403
407
  };
@@ -1140,10 +1140,13 @@ export var useLineChart = function (props) {
1140
1140
  var stripStrokeDashArray = props.stripStrokeDashArray;
1141
1141
  var unFocusOnPressOut = (_302 = props.unFocusOnPressOut) !== null && _302 !== void 0 ? _302 : LineDefaults.unFocusOnPressOut;
1142
1142
  var delayBeforeUnFocus = (_303 = props.delayBeforeUnFocus) !== null && _303 !== void 0 ? _303 : LineDefaults.delayBeforeUnFocus;
1143
- var lineGradient = (_304 = props.lineGradient) !== null && _304 !== void 0 ? _304 : LineDefaults.lineGradient;
1144
- var lineGradientDirection = (_305 = props.lineGradientDirection) !== null && _305 !== void 0 ? _305 : 'vertical';
1145
- var lineGradientStartColor = (_306 = props.lineGradientStartColor) !== null && _306 !== void 0 ? _306 : LineDefaults.lineGradientStartColor;
1146
- var lineGradientEndColor = (_307 = props.lineGradientEndColor) !== null && _307 !== void 0 ? _307 : LineDefaults.lineGradientEndColor;
1143
+ var focusTogether = (_304 = props.focusTogether) !== null && _304 !== void 0 ? _304 : true;
1144
+ var focusProximity = (_305 = props.focusProximity) !== null && _305 !== void 0 ? _305 : Infinity;
1145
+ var lineGradient = (_306 = props.lineGradient) !== null && _306 !== void 0 ? _306 : LineDefaults.lineGradient;
1146
+ var lineGradientDirection = (_307 = props.lineGradientDirection) !== null && _307 !== void 0 ? _307 : 'vertical';
1147
+ var lineGradientStartColor = (_308 = props.lineGradientStartColor) !== null && _308 !== void 0 ? _308 : LineDefaults.lineGradientStartColor;
1148
+ var lineGradientEndColor = (_309 = props.lineGradientEndColor) !== null && _309 !== void 0 ? _309 : LineDefaults.lineGradientEndColor;
1149
+ var _362 = __read(useState(-1), 2), selectedLineNumber = _362[0], setSelectedLineNumber = _362[1];
1147
1150
  var getPointerY = function (value) {
1148
1151
  return value
1149
1152
  ? containerHeight -
@@ -1214,8 +1217,77 @@ export var useLineChart = function (props) {
1214
1217
  var initialPointerYs = (_a = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return getPointerY(set.data[initialPointerIndex].value); })) !== null && _a !== void 0 ? _a : [];
1215
1218
  setPointerYsForDataSet(initialPointerYs);
1216
1219
  };
1217
- var dataPointsRadius = (_309 = (_308 = props.dataPointsRadius1) !== null && _308 !== void 0 ? _308 : props.dataPointsRadius) !== null && _309 !== void 0 ? _309 : LineDefaults.dataPointsRadius;
1218
- var dataPointsWidth = (_311 = (_310 = props.dataPointsWidth1) !== null && _310 !== void 0 ? _310 : props.dataPointsWidth) !== null && _311 !== void 0 ? _311 : LineDefaults.dataPointsWidth;
1220
+ var handleFocus = function (index, item, locationY, onStripPress) {
1221
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1222
+ var lineNumber = 0;
1223
+ if (dataSet) {
1224
+ var minDistance_1 = Infinity;
1225
+ dataSet.forEach(function (setItem, setIndex) {
1226
+ var _a;
1227
+ var distance = Math.abs(getY((_a = setItem.data[index]) === null || _a === void 0 ? void 0 : _a.value) - locationY);
1228
+ if (distance < minDistance_1) {
1229
+ minDistance_1 = distance;
1230
+ lineNumber = setIndex + 1;
1231
+ }
1232
+ });
1233
+ }
1234
+ else {
1235
+ var distance1 = void 0, distance2 = void 0, distance3 = void 0, distance4 = void 0, distance5 = void 0, distance6 = void 0;
1236
+ var minDistance = Infinity;
1237
+ if (typeof ((_a = data[index]) === null || _a === void 0 ? void 0 : _a.value) === 'number') {
1238
+ distance1 = Math.abs(getY((_b = data[index]) === null || _b === void 0 ? void 0 : _b.value) - locationY);
1239
+ minDistance = distance1;
1240
+ if (distance1 < focusProximity)
1241
+ lineNumber = 1;
1242
+ }
1243
+ if (typeof ((_c = data2[index]) === null || _c === void 0 ? void 0 : _c.value) === 'number') {
1244
+ distance2 = Math.abs(getY((_d = data2[index]) === null || _d === void 0 ? void 0 : _d.value) - locationY);
1245
+ if (minDistance > distance2 && distance2 < focusProximity) {
1246
+ minDistance = distance2;
1247
+ lineNumber = 2;
1248
+ }
1249
+ }
1250
+ if (typeof ((_e = data3[index]) === null || _e === void 0 ? void 0 : _e.value) === 'number') {
1251
+ distance3 = Math.abs(getY((_f = data3[index]) === null || _f === void 0 ? void 0 : _f.value) - locationY);
1252
+ if (minDistance > distance3 && distance3 < focusProximity) {
1253
+ minDistance = distance3;
1254
+ lineNumber = 3;
1255
+ }
1256
+ }
1257
+ if (typeof ((_g = data4[index]) === null || _g === void 0 ? void 0 : _g.value) === 'number') {
1258
+ distance4 = Math.abs(getY((_h = data4[index]) === null || _h === void 0 ? void 0 : _h.value) - locationY);
1259
+ if (minDistance > distance4 && distance4 < focusProximity) {
1260
+ minDistance = distance4;
1261
+ lineNumber = 4;
1262
+ }
1263
+ }
1264
+ if (typeof ((_j = data5[index]) === null || _j === void 0 ? void 0 : _j.value) === 'number') {
1265
+ distance5 = Math.abs(getY((_k = data5[index]) === null || _k === void 0 ? void 0 : _k.value) - locationY);
1266
+ if (minDistance > distance5 && distance5 < focusProximity) {
1267
+ minDistance = distance5;
1268
+ lineNumber = 5;
1269
+ }
1270
+ }
1271
+ if (typeof ((_l = secondaryData[index]) === null || _l === void 0 ? void 0 : _l.value) === 'number') {
1272
+ distance6 = Math.abs(getY((_m = secondaryData[index]) === null || _m === void 0 ? void 0 : _m.value) - locationY);
1273
+ if (minDistance > distance6 && distance6 < focusProximity) {
1274
+ minDistance = distance6;
1275
+ lineNumber = 6666;
1276
+ }
1277
+ }
1278
+ }
1279
+ setSelectedLineNumber(lineNumber - 1);
1280
+ if (lineNumber) {
1281
+ onStripPress(item, index);
1282
+ }
1283
+ };
1284
+ var handleUnFocus = function () {
1285
+ if (unFocusOnPressOut) {
1286
+ setTimeout(function () { return setSelectedIndex(-1); }, delayBeforeUnFocus);
1287
+ }
1288
+ };
1289
+ var dataPointsRadius = (_311 = (_310 = props.dataPointsRadius1) !== null && _310 !== void 0 ? _310 : props.dataPointsRadius) !== null && _311 !== void 0 ? _311 : LineDefaults.dataPointsRadius;
1290
+ var dataPointsWidth = (_313 = (_312 = props.dataPointsWidth1) !== null && _312 !== void 0 ? _312 : props.dataPointsWidth) !== null && _313 !== void 0 ? _313 : LineDefaults.dataPointsWidth;
1219
1291
  var extraWidthDueToDataPoint = props.hideDataPoints
1220
1292
  ? 0
1221
1293
  : dataPointsRadius !== null && dataPointsRadius !== void 0 ? dataPointsRadius : dataPointsWidth;
@@ -1283,7 +1355,7 @@ export var useLineChart = function (props) {
1283
1355
  pointerY: pointerY,
1284
1356
  onEndReached: props.onEndReached,
1285
1357
  onStartReached: props.onStartReached,
1286
- endReachedOffset: (_312 = props.endReachedOffset) !== null && _312 !== void 0 ? _312 : LineDefaults.endReachedOffset,
1358
+ endReachedOffset: (_314 = props.endReachedOffset) !== null && _314 !== void 0 ? _314 : LineDefaults.endReachedOffset,
1287
1359
  onMomentumScrollEnd: props.onMomentumScrollEnd,
1288
1360
  extraWidthDueToDataPoint: extraWidthDueToDataPoint,
1289
1361
  customBackground: props.customBackground
@@ -1653,9 +1725,13 @@ export var useLineChart = function (props) {
1653
1725
  cumulativeSpacingForSet: cumulativeSpacingForSet,
1654
1726
  stripOverDataPoints: props.stripOverDataPoints,
1655
1727
  strips: strips,
1728
+ selectedLineNumber: selectedLineNumber,
1729
+ setSelectedLineNumber: setSelectedLineNumber,
1656
1730
  lastLineNumber: lastLineNumber,
1657
- focusTogether: (_313 = props.focusTogether) !== null && _313 !== void 0 ? _313 : true,
1658
- focusProximity: (_314 = props.focusProximity) !== null && _314 !== void 0 ? _314 : Infinity
1731
+ focusTogether: focusTogether,
1732
+ focusProximity: focusProximity,
1733
+ handleFocus: handleFocus,
1734
+ handleUnFocus: handleUnFocus
1659
1735
  // oldPoints
1660
1736
  };
1661
1737
  };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  export { useBarChart } from './BarChart';
5
5
  export { getPropsForAnimated2DWithGradient } from './BarChart/Animated2DWithGradient';
6
6
  export { useRenderStackBars } from './BarChart/RenderStackBars';
7
+ export { useRenderBars } from './BarChart/RenderBars';
7
8
  export { type stackDataItem, type StackedBarChartPropsType, type BarChartPropsType, type defaultLineConfigType, type barDataItem, type barDataItemNullSafe, type Animated2DWithGradientPropsType, type RenderBarsPropsType, type trianglePropTypes, type animatedBarPropTypes, type FocusedBarConfig, type CommonPropsFor2dand3dBarsType } from './BarChart/types';
8
9
  /************************************************************************************************************************
9
10
  /***************************************** Line Chart *****************************************
@@ -36,4 +37,4 @@ export { type StripAndLabelProps } from './components/common/types';
36
37
  /***********************************************************************************************************************/
37
38
  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';
38
39
  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';
39
- 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 } from './utils/types';
40
+ 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 } from './utils/types';
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  export { useBarChart } from './BarChart';
5
5
  export { getPropsForAnimated2DWithGradient } from './BarChart/Animated2DWithGradient';
6
6
  export { useRenderStackBars } from './BarChart/RenderStackBars';
7
+ export { useRenderBars } from './BarChart/RenderBars';
7
8
  /************************************************************************************************************************
8
9
  /***************************************** Line Chart *****************************************
9
10
  /************************************************************************************************************************/
@@ -79,6 +79,20 @@ export interface secondaryYAxisType {
79
79
  hideOrigin?: boolean;
80
80
  formatYLabel?: (label: string) => string;
81
81
  }
82
+ export interface TooltipProps {
83
+ barHeight: number;
84
+ barWidth: number;
85
+ item: any;
86
+ index: number;
87
+ isLast: boolean;
88
+ leftSpacing: number;
89
+ leftShiftForLastIndexTooltip: number;
90
+ leftShiftForTooltip: number;
91
+ renderTooltip?: Function;
92
+ autoCenterTooltip?: boolean;
93
+ horizontal?: boolean;
94
+ bottom: number;
95
+ }
82
96
  export interface secondaryLineConfigType {
83
97
  zIndex?: number;
84
98
  curved?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "./dist/index.js",
6
6
  "files": [