react-native-gifted-charts 1.4.32 → 1.4.34

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.
@@ -116,7 +116,7 @@ var RenderStackBars = function (props) {
116
116
  ] })) : null, stackItem.innerBarComponent && stackItem.innerBarComponent()] }, index));
117
117
  }), (item.barBackgroundPattern || barBackgroundPattern) && (_jsxs(Svg, { children: [_jsx(Defs, { children: item.barBackgroundPattern
118
118
  ? item.barBackgroundPattern()
119
- : barBackgroundPattern === null || barBackgroundPattern === void 0 ? void 0 : barBackgroundPattern() }), _jsx(Rect, { stroke: "none", x: "1", y: "1", width: "100%", height: "100%", fill: "url(#".concat(item.patternId || patternId, ")") })] }))] }), localBarInnerComponent ? (_jsx(View, { style: { height: '100%', width: '100%' }, children: localBarInnerComponent(item, index) })) : null, (item.topLabelComponent || showValuesAsTopLabel) && (_jsx(View, { style: [
119
+ : barBackgroundPattern === null || barBackgroundPattern === void 0 ? void 0 : barBackgroundPattern() }), _jsx(Rect, { stroke: "none", x: "1", y: "1", width: "100%", height: totalHeight, fill: "url(#".concat(item.patternId || patternId, ")") })] }))] }), localBarInnerComponent ? (_jsx(View, { style: { height: '100%', width: '100%' }, children: localBarInnerComponent(item, index) })) : null, (item.topLabelComponent || showValuesAsTopLabel) && (_jsx(View, { style: [
120
120
  {
121
121
  position: 'absolute',
122
122
  top: containsNegativeValue
@@ -4,9 +4,9 @@ import Rule from '../lineSvg';
4
4
  import { styles } from '../../LineChart/styles';
5
5
  import { getHorizSectionVals, yAxisSides, chartTypes, } from 'gifted-charts-core';
6
6
  export var renderHorizSections = function (props) {
7
- var _a, _b;
7
+ var _a, _b, _c, _d;
8
8
  var chartType = props.chartType, width = props.width, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, totalWidth = props.totalWidth, endSpacing = props.endSpacing, yAxisSide = props.yAxisSide, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, sectionColors = props.sectionColors, stepHeight = props.stepHeight, negativeStepHeight = props.negativeStepHeight, yAxisLabelWidth = props.yAxisLabelWidth, yAxisLabelContainerStyle = props.yAxisLabelContainerStyle, yAxisThickness = props.yAxisThickness, yAxisColor = props.yAxisColor, xAxisThickness = props.xAxisThickness, xAxisColor = props.xAxisColor, xAxisLength = props.xAxisLength, xAxisType = props.xAxisType, dashWidth = props.dashWidth, dashGap = props.dashGap, backgroundColor = props.backgroundColor, hideRules = props.hideRules, rulesLength = props.rulesLength, rulesType = props.rulesType, rulesThickness = props.rulesThickness, rulesColor = props.rulesColor, rulesConfigArray = props.rulesConfigArray, spacing = props.spacing, showYAxisIndices = props.showYAxisIndices, yAxisIndicesHeight = props.yAxisIndicesHeight, yAxisIndicesWidth = props.yAxisIndicesWidth, yAxisIndicesColor = props.yAxisIndicesColor, hideOrigin = props.hideOrigin, hideYAxisText = props.hideYAxisText, yAxisTextNumberOfLines = props.yAxisTextNumberOfLines, yAxisTextStyle = props.yAxisTextStyle, rotateYAxisTexts = props.rotateYAxisTexts, rtl = props.rtl, containerHeight = props.containerHeight, maxValue = props.maxValue, yAxisOffset = props.yAxisOffset, horizontal = props.horizontal, yAxisAtTop = props.yAxisAtTop, secondaryYAxis = props.secondaryYAxis, onlyReferenceLines = props.onlyReferenceLines, renderReferenceLines = props.renderReferenceLines, secondaryXAxis = props.secondaryXAxis;
9
- var _c = getHorizSectionVals(props), secondaryYAxisConfig = _c.secondaryYAxisConfig, horizSections = _c.horizSections, yAxisExtraHeightAtTop = _c.yAxisExtraHeightAtTop, secondaryHorizSections = _c.secondaryHorizSections, showReferenceLine1 = _c.showReferenceLine1, referenceLine1Config = _c.referenceLine1Config, referenceLine1Position = _c.referenceLine1Position, showReferenceLine2 = _c.showReferenceLine2, referenceLine2Config = _c.referenceLine2Config, referenceLine2Position = _c.referenceLine2Position, showReferenceLine3 = _c.showReferenceLine3, referenceLine3Config = _c.referenceLine3Config, referenceLine3Position = _c.referenceLine3Position, horizSectionsBelow = _c.horizSectionsBelow, secondaryHorizSectionsBelow = _c.secondaryHorizSectionsBelow, getLabelTexts = _c.getLabelTexts, getLabelTextsForSecondaryYAxis = _c.getLabelTextsForSecondaryYAxis;
9
+ var _e = getHorizSectionVals(props), secondaryYAxisConfig = _e.secondaryYAxisConfig, horizSections = _e.horizSections, yAxisExtraHeightAtTop = _e.yAxisExtraHeightAtTop, secondaryHorizSections = _e.secondaryHorizSections, showReferenceLine1 = _e.showReferenceLine1, referenceLine1Config = _e.referenceLine1Config, referenceLine1Position = _e.referenceLine1Position, showReferenceLine2 = _e.showReferenceLine2, referenceLine2Config = _e.referenceLine2Config, referenceLine2Position = _e.referenceLine2Position, showReferenceLine3 = _e.showReferenceLine3, referenceLine3Config = _e.referenceLine3Config, referenceLine3Position = _e.referenceLine3Position, horizSectionsBelow = _e.horizSectionsBelow, secondaryHorizSectionsBelow = _e.secondaryHorizSectionsBelow, getLabelTexts = _e.getLabelTexts, getLabelTextsForSecondaryYAxis = _e.getLabelTextsForSecondaryYAxis;
10
10
  var secondaryYAxisExtraHeightAtBottom = 10;
11
11
  var renderAxesAndRules = function (index) {
12
12
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
@@ -93,7 +93,7 @@ export var renderHorizSections = function (props) {
93
93
  };
94
94
  var renderSecondaryYaxisLabels = function (horizSections, isBelow) {
95
95
  return horizSections.map(function (sectionItems, index) {
96
- var _a, _b, _c, _d, _e, _f, _g;
96
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
97
97
  var label = getLabelTextsForSecondaryYAxis(sectionItems.value, index);
98
98
  if (secondaryYAxisConfig.hideOrigin && index === 0) {
99
99
  label = '';
@@ -114,14 +114,21 @@ export var renderHorizSections = function (props) {
114
114
  ? ((_e = (_d = secondaryYAxisConfig.negativeStepHeight) !== null && _d !== void 0 ? _d : secondaryYAxisConfig.stepHeight) !== null && _e !== void 0 ? _e : 0)
115
115
  : ((_f = secondaryYAxisConfig.stepHeight) !== null && _f !== void 0 ? _f : 0),
116
116
  },
117
- yAxisLabelContainerStyle,
117
+ (_g = secondaryYAxisConfig.yAxisLabelContainerStyle) !== null && _g !== void 0 ? _g : yAxisLabelContainerStyle,
118
118
  ], children: [secondaryYAxisConfig.showYAxisIndices && (index !== 0 || isBelow) ? (_jsx(View, { style: {
119
119
  height: secondaryYAxisConfig.yAxisIndicesHeight,
120
120
  width: secondaryYAxisConfig.yAxisIndicesWidth,
121
121
  position: 'absolute',
122
- left: ((_g = secondaryYAxisConfig.yAxisIndicesWidth) !== null && _g !== void 0 ? _g : 0) / -2,
122
+ left: ((_h = secondaryYAxisConfig.yAxisIndicesWidth) !== null && _h !== void 0 ? _h : 0) / -2,
123
123
  backgroundColor: secondaryYAxisConfig.yAxisIndicesColor,
124
- } })) : null, _jsx(Text, { numberOfLines: secondaryYAxisConfig.yAxisTextNumberOfLines, ellipsizeMode: 'clip', style: [secondaryYAxisConfig.yAxisTextStyle], children: label })] }, index));
124
+ } })) : null, _jsx(Text, { numberOfLines: secondaryYAxisConfig.yAxisTextNumberOfLines, ellipsizeMode: 'clip', style: [
125
+ {
126
+ textAlign: 'left',
127
+ width: (_k = (_j = secondaryYAxisConfig.yAxisLabelContainerStyle) === null || _j === void 0 ? void 0 : _j.width) !== null && _k !== void 0 ? _k : secondaryYAxisConfig.yAxisLabelWidth,
128
+ marginLeft: 10,
129
+ },
130
+ secondaryYAxisConfig.yAxisTextStyle,
131
+ ], children: label })] }, index));
125
132
  });
126
133
  };
127
134
  var referenceLines = function () {
@@ -319,7 +326,6 @@ export var renderHorizSections = function (props) {
319
326
  borderLeftWidth: secondaryYAxisConfig.yAxisThickness,
320
327
  height: containerHeight + yAxisExtraHeightAtTop,
321
328
  bottom: stepHeight / -2,
322
- // backgroundColor:'red'
323
329
  }, children: !secondaryYAxisConfig.hideYAxisText
324
330
  ? renderSecondaryYaxisLabels(secondaryHorizSections, false)
325
331
  : null })) : null,
@@ -327,15 +333,15 @@ export var renderHorizSections = function (props) {
327
333
  /************************* Render the secondary Y Axis below origin *********************/
328
334
  /***********************************************************************************************/
329
335
  secondaryYAxisConfig.noOfSectionsBelowXAxis ? (_jsx(View, { style: {
330
- width: secondaryYAxisConfig.yAxisLabelWidth,
336
+ width: (_a = secondaryYAxisConfig.yAxisLabelWidth) !== null && _a !== void 0 ? _a : yAxisLabelWidth,
331
337
  left: (width ? yAxisLabelWidth : yAxisLabelWidth - spacing) -
332
- yAxisLabelWidth,
338
+ ((_b = secondaryYAxisConfig.yAxisLabelWidth) !== null && _b !== void 0 ? _b : yAxisLabelWidth),
333
339
  borderColor: secondaryYAxisConfig.yAxisColor,
334
340
  borderLeftWidth: secondaryYAxisConfig.yAxisThickness,
335
- height: ((_b = (_a = secondaryYAxisConfig.negativeStepHeight) !== null && _a !== void 0 ? _a : secondaryYAxisConfig.stepHeight) !== null && _b !== void 0 ? _b : stepHeight) *
341
+ height: ((_d = (_c = secondaryYAxisConfig.negativeStepHeight) !== null && _c !== void 0 ? _c : secondaryYAxisConfig.stepHeight) !== null && _d !== void 0 ? _d : stepHeight) *
336
342
  secondaryHorizSectionsBelow.length +
337
343
  secondaryYAxisExtraHeightAtBottom,
338
- bottom: -containerHeight - stepHeight * 0.84,
344
+ bottom: -containerHeight - stepHeight / 2 - yAxisExtraHeightAtTop,
339
345
  }, children: !secondaryYAxisConfig.hideYAxisText
340
346
  ? renderSecondaryYaxisLabels(secondaryHorizSectionsBelow, true)
341
347
  : null })) : null] })) }));
@@ -24,7 +24,7 @@ export var StripAndLabel = function (props) {
24
24
  : -pointerYLocal + 8,
25
25
  width: pointerStripWidth,
26
26
  height: pointerStripUptoDataPoint
27
- ? containerHeight - pointerYLocal + 10 - xAxisThickness
27
+ ? containerHeight - pointerYLocal + 4 - xAxisThickness
28
28
  : pointerStripHeight + (containsNegative ? 10 : 0),
29
29
  marginTop: pointerStripUptoDataPoint
30
30
  ? 0
@@ -34,7 +34,7 @@ export var StripAndLabel = function (props) {
34
34
  }, children: _jsx(Svg, { children: _jsx(Line, { stroke: pointerStripColor, strokeWidth: pointerStripWidth, strokeDasharray: (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray)
35
35
  ? pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray
36
36
  : '', x1: 0, y1: 0, x2: 0, y2: pointerStripUptoDataPoint
37
- ? containerHeight - pointerYLocal + 10 - xAxisThickness
37
+ ? containerHeight - pointerYLocal + 4 - xAxisThickness
38
38
  : pointerStripHeight + 10 }) }) })) : null, pointerLabelComponent ? (_jsx(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: [
39
39
  {
40
40
  position: 'absolute',
@@ -248,7 +248,7 @@ export var LineChartBicolor = function (props) {
248
248
  ? fillPointsArray.map(function (item, index) {
249
249
  return (_jsx(Path, { d: item.points, fill: item.color === 'green'
250
250
  ? 'url(#Gradient)'
251
- : 'url(#GradientNegative)', stroke: 'transparent', strokeWidth: currentLineThickness || thickness }, index));
251
+ : 'url(#GradientNegative)', stroke: 'none', strokeWidth: currentLineThickness || thickness }, index));
252
252
  })
253
253
  : null, renderSpecificVerticalLines(data), !hideDataPoints1
254
254
  ? renderDataPoints(data, dataPointsShape1, dataPointsWidth1, dataPointsHeight1, dataPointsColor1, dataPointsRadius1, textColor1, textFontSize1, startIndex1, endIndex1)
@@ -196,7 +196,7 @@ export var LineChart = function (props) {
196
196
  ]);
197
197
  var svgWrapperViewStyle = {
198
198
  position: 'absolute',
199
- bottom: 62 +
199
+ bottom: 63 +
200
200
  xAxisLabelsVerticalShift +
201
201
  labelsExtraHeight -
202
202
  xAxisThickness -
@@ -262,7 +262,7 @@ export var LineChart = function (props) {
262
262
  var getYOrSecondaryY = isSecondary ? getSecondaryY : getY;
263
263
  return dataForRender.map(function (item, index) {
264
264
  var _a;
265
- var _b, _c, _d, _e, _f;
265
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
266
266
  if (index < startIndex || index > endIndex)
267
267
  return null;
268
268
  if (item.hideDataPoint) {
@@ -290,10 +290,7 @@ export var LineChart = function (props) {
290
290
  props.focusedDataPointColor ||
291
291
  LineDefaults.focusedDataPointColor;
292
292
  dataPointsRadius =
293
- item.focusedDataPointRadius ||
294
- props.focusedDataPointRadius ||
295
- item.dataPointRadius ||
296
- dataPtsRadius;
293
+ (_d = (_c = (_b = item.focusedDataPointRadius) !== null && _b !== void 0 ? _b : props.focusedDataPointRadius) !== null && _c !== void 0 ? _c : item.dataPointRadius) !== null && _d !== void 0 ? _d : dataPtsRadius;
297
294
  if (showTextOnFocus) {
298
295
  text = item.dataPointText;
299
296
  }
@@ -310,7 +307,7 @@ export var LineChart = function (props) {
310
307
  dataPointsWidth = item.dataPointWidth || dataPtsWidth;
311
308
  dataPointsHeight = item.dataPointHeight || dataPtsHeight;
312
309
  dataPointsColor = item.dataPointColor || dataPtsColor;
313
- dataPointsRadius = item.dataPointRadius || dataPtsRadius;
310
+ dataPointsRadius = (_e = item.dataPointRadius) !== null && _e !== void 0 ? _e : dataPtsRadius;
314
311
  if (showTextOnFocus) {
315
312
  text = '';
316
313
  }
@@ -320,10 +317,10 @@ export var LineChart = function (props) {
320
317
  if (showValuesAsDataPointsText) {
321
318
  text = originalDataFromProps[index].value;
322
319
  }
323
- var currentStripHeight = (_b = item.stripHeight) !== null && _b !== void 0 ? _b : stripHeight;
324
- var currentStripWidth = (_c = item.stripWidth) !== null && _c !== void 0 ? _c : stripWidth;
325
- var currentStripOpacity = (_d = item.stripOpacity) !== null && _d !== void 0 ? _d : stripOpacity;
326
- var currentStripStrokeDashArray = (_f = (_e = item.stripStrokeDashArray) !== null && _e !== void 0 ? _e : stripStrokeDashArray) !== null && _f !== void 0 ? _f : '';
320
+ var currentStripHeight = (_f = item.stripHeight) !== null && _f !== void 0 ? _f : stripHeight;
321
+ var currentStripWidth = (_g = item.stripWidth) !== null && _g !== void 0 ? _g : stripWidth;
322
+ var currentStripOpacity = (_h = item.stripOpacity) !== null && _h !== void 0 ? _h : stripOpacity;
323
+ var currentStripStrokeDashArray = (_k = (_j = item.stripStrokeDashArray) !== null && _j !== void 0 ? _j : stripStrokeDashArray) !== null && _k !== void 0 ? _k : '';
327
324
  var currentStripColor = item.stripColor || stripColor;
328
325
  var position = I18nManager.isRTL ? 'right' : 'left';
329
326
  var y1 = currentStripHeight
@@ -620,7 +617,8 @@ export var LineChart = function (props) {
620
617
  }
621
618
  return _jsx(Path, __assign({}, lineSvgProps), index);
622
619
  })) : animateOnDataChange && animatedPath ? (_jsx(AnimatedPath, __assign({}, lineSvgPropsOuter))) : (_jsx(Path, __assign({}, lineSvgPropsOuter))), isNthAreaChart &&
623
- getAreaGradientComponent(startFillColor, endFillColor, startOpacity, endOpacity), isNthAreaChart ? (animateOnDataChange && animatedFillPath ? (_jsx(AnimatedPath, { onPress: props.onChartAreaPress, d: animatedFillPath, fill: props.areaGradientId
620
+ getAreaGradientComponent(startFillColor, endFillColor, startOpacity, endOpacity), isNthAreaChart ? (props.interpolateMissingValues === false &&
621
+ propsData.some(function (item) { return isNaN(item.value); }) ? null : animateOnDataChange && animatedFillPath ? (_jsx(AnimatedPath, { onPress: props.onChartAreaPress, d: animatedFillPath, fill: props.areaGradientId
624
622
  ? "url(#".concat(props.areaGradientId, ")")
625
623
  : "url(#Gradient)", stroke: 'none', strokeWidth: currentLineThickness || thickness })) : (_jsx(Path, { onPress: props.onChartAreaPress, d: fillPoints, fill: props.areaGradientId
626
624
  ? "url(#".concat(props.areaGradientId, ")")
@@ -764,7 +762,7 @@ export var LineChart = function (props) {
764
762
  onResponderEnd: function (evt) {
765
763
  // console.log('evt...end.......',evt);
766
764
  setResponderStartTime(0);
767
- setPointerIndex(-1);
765
+ // setPointerIndex(-1);
768
766
  setResponderActive(false);
769
767
  if (!persistPointer)
770
768
  setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
@@ -817,7 +815,7 @@ export var LineChart = function (props) {
817
815
  onResponderEnd: function (evt) {
818
816
  // console.log('evt...end.......',evt);
819
817
  setResponderStartTime(0);
820
- setPointerIndex(-1);
818
+ // setPointerIndex(-1);
821
819
  setResponderActive(false);
822
820
  if (!persistPointer)
823
821
  setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { View } from 'react-native';
13
+ import { Platform, View } from 'react-native';
14
14
  import { PieChartMain } from './main';
15
15
  import { pieColors, usePieChart } from 'gifted-charts-core';
16
16
  export var PieChart = function (props) {
@@ -77,7 +77,7 @@ export var PieChart = function (props) {
77
77
  position: 'absolute',
78
78
  top: -extraRadius,
79
79
  left: -extraRadius,
80
- zIndex: -1, // was not getting displayed in web (using Expo)
80
+ zIndex: Platform.OS === 'web' ? -1 : 0, // was not getting displayed in web (using Expo)
81
81
  }, children: _jsx(PieChartMain, __assign({}, props, { data: [
82
82
  {
83
83
  value: props.data[selectedIndex].value,
@@ -57,7 +57,7 @@ export var PieChartMain = function (props) {
57
57
  : item.strokeWidth === 0
58
58
  ? 0
59
59
  : item.strokeWidth || strokeWidth, fill: props.selectedIndex === index || item.peripheral
60
- ? 'transparent'
60
+ ? 'none'
61
61
  : showGradient
62
62
  ? "url(#grad".concat(index, ")")
63
63
  : item.color || pieColors[index % 9], onPressIn: function () {
@@ -71,10 +71,10 @@ export var PieChartPro = function (props) {
71
71
  }) }), data.map(function (item, index) {
72
72
  var _a, _b, _c, _d;
73
73
  var borderWidth = (_a = item.strokeWidth) !== null && _a !== void 0 ? _a : strokeWidth;
74
- var borderColor = (_c = (_b = item.strokeColor) !== null && _b !== void 0 ? _b : props.strokeColor) !== null && _c !== void 0 ? _c : (borderWidth ? 'black' : 'transparent');
74
+ var borderColor = (_c = (_b = item.strokeColor) !== null && _b !== void 0 ? _b : props.strokeColor) !== null && _c !== void 0 ? _c : (borderWidth ? 'black' : 'none');
75
75
  var strokeDashArrayLocal = (_d = item.strokeDashArray) !== null && _d !== void 0 ? _d : strokeDashArray;
76
76
  return (_jsx(AnimatedPath, { id: "renderPath", d: isAnimated ? animatedPaths[index] : dFinal[index], fill: ring
77
- ? 'transparent'
77
+ ? 'none'
78
78
  : showGradient
79
79
  ? "url(#grad".concat(index, ")")
80
80
  : data[index].color || pieColors[index % 9], strokeWidth: borderWidth, strokeDasharray: strokeDashArrayLocal, stroke: borderColor }, "path".concat(index)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gifted-charts",
3
- "version": "1.4.32",
3
+ "version": "1.4.34",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -25,7 +25,7 @@
25
25
  "registry": "https://registry.npmjs.org/"
26
26
  },
27
27
  "dependencies": {
28
- "gifted-charts-core": "^0.1.33"
28
+ "gifted-charts-core": "^0.1.35"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@babel/cli": "^7.24.8",