react-native-gifted-charts 1.4.67 → 1.4.68
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.
|
@@ -1,9 +1,22 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { createElement as _createElement } from "react";
|
|
2
14
|
import { View } from 'react-native';
|
|
3
15
|
import { chartTypes } from 'gifted-charts-core';
|
|
4
16
|
import { Line, Svg } from 'react-native-svg';
|
|
5
17
|
var RenderVerticalLines = function (props) {
|
|
6
|
-
var
|
|
18
|
+
var showVerticalLines = props.showVerticalLines, // this is the value passed by user (note that it's not the effective value that is computed by traversing through the data array and finding any item for which showVerticalLines is true)
|
|
19
|
+
verticalLinesAr = props.verticalLinesAr, verticalLinesSpacing = props.verticalLinesSpacing, spacing = props.spacing, initialSpacing = props.initialSpacing, verticalLinesZIndex = props.verticalLinesZIndex, verticalLinesHeight = props.verticalLinesHeight, verticalLinesThickness = props.verticalLinesThickness, verticalLinesColor = props.verticalLinesColor, verticalLinesStrokeDashArray = props.verticalLinesStrokeDashArray, verticalLinesShift = props.verticalLinesShift, verticalLinesUptoDataPoint = props.verticalLinesUptoDataPoint, verticalLinesStrokeLinecap = props.verticalLinesStrokeLinecap, xAxisThickness = props.xAxisThickness, labelsExtraHeight = props.labelsExtraHeight, containerHeight = props.containerHeight, data = props.data, stackData = props.stackData, barWidth = props.barWidth, maxValue = props.maxValue, chartType = props.chartType, containerHeightIncludingBelowXAxis = props.containerHeightIncludingBelowXAxis, totalWidth = props.totalWidth, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift;
|
|
7
20
|
var getHeightOfVerticalLine = function (index) {
|
|
8
21
|
if (verticalLinesUptoDataPoint) {
|
|
9
22
|
if (index < data.length) {
|
|
@@ -32,6 +45,7 @@ var RenderVerticalLines = function (props) {
|
|
|
32
45
|
width: totalWidth,
|
|
33
46
|
zIndex: verticalLinesZIndex || -1,
|
|
34
47
|
}, children: _jsx(Svg, { height: containerHeightIncludingBelowXAxis, width: totalWidth, children: verticalLinesAr.map(function (item, index) {
|
|
48
|
+
var _a, _b, _c, _d, _e, _f;
|
|
35
49
|
var totalSpacing = initialSpacing;
|
|
36
50
|
if (verticalLinesSpacing) {
|
|
37
51
|
totalSpacing = verticalLinesSpacing * (index + 1);
|
|
@@ -80,16 +94,40 @@ var RenderVerticalLines = function (props) {
|
|
|
80
94
|
totalSpacing += actualSpacing;
|
|
81
95
|
}
|
|
82
96
|
}
|
|
83
|
-
|
|
97
|
+
if (!showVerticalLines && !item.showVerticalLine) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
var verticalLinesShiftLocal = chartType === chartTypes.BAR
|
|
101
|
+
? ((_a = item.verticalLineShift) !== null && _a !== void 0 ? _a : verticalLinesShift)
|
|
102
|
+
: verticalLinesShift;
|
|
103
|
+
var x = verticalLinesShiftLocal +
|
|
84
104
|
1 +
|
|
85
|
-
(chartType === chartTypes.BAR
|
|
105
|
+
(chartType === chartTypes.BAR // This logic exists because we have renderSpecificVerticalLines in Line Charts which I would love to deprecate at the earliest, because that functionality gets handled here elegantly
|
|
86
106
|
? totalSpacing - 1
|
|
87
107
|
: verticalLinesSpacing
|
|
88
108
|
? verticalLinesSpacing * (index + 1)
|
|
89
109
|
: index * spacing + (initialSpacing - 2));
|
|
90
|
-
|
|
110
|
+
var lineProps = chartType === chartTypes.BAR // This logic exists because we have renderSpecificVerticalLines in Line Charts which I would love to deprecate at the earliest, because that functionality gets handled here elegantly
|
|
111
|
+
? {
|
|
112
|
+
y2: containerHeightIncludingBelowXAxis -
|
|
113
|
+
heightAdjustmentDueToStrokeLinecap,
|
|
114
|
+
stroke: ((_b = item.verticalLineColor) !== null && _b !== void 0 ? _b : verticalLinesColor) ||
|
|
115
|
+
'lightgray',
|
|
116
|
+
strokeWidth: ((_c = item.verticalLineThickness) !== null && _c !== void 0 ? _c : verticalLinesThickness) || 2,
|
|
117
|
+
strokeDasharray: (_e = (_d = item.verticalLineStrokeDashArray) !== null && _d !== void 0 ? _d : verticalLinesStrokeDashArray) !== null && _e !== void 0 ? _e : '',
|
|
118
|
+
strokeLinecap: (_f = item.verticalLineStrokeLinecap) !== null && _f !== void 0 ? _f : verticalLinesStrokeLinecap,
|
|
119
|
+
}
|
|
120
|
+
: {
|
|
121
|
+
y2: containerHeightIncludingBelowXAxis -
|
|
122
|
+
heightAdjustmentDueToStrokeLinecap,
|
|
123
|
+
stroke: verticalLinesColor || 'lightgray',
|
|
124
|
+
strokeWidth: verticalLinesThickness || 2,
|
|
125
|
+
strokeDasharray: verticalLinesStrokeDashArray !== null && verticalLinesStrokeDashArray !== void 0 ? verticalLinesStrokeDashArray : '',
|
|
126
|
+
strokeLinecap: verticalLinesStrokeLinecap,
|
|
127
|
+
};
|
|
128
|
+
return (_createElement(Line, __assign({}, lineProps, { key: index, x1: x, y1: extendedContainerHeight -
|
|
91
129
|
getHeightOfVerticalLine(index) +
|
|
92
|
-
heightAdjustmentDueToStrokeLinecap, x2: x
|
|
130
|
+
heightAdjustmentDueToStrokeLinecap, x2: x })));
|
|
93
131
|
}) }) }));
|
|
94
132
|
};
|
|
95
133
|
export default RenderVerticalLines;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.68",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid and Radar charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"registry": "https://registry.npmjs.org/"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"gifted-charts-core": "0.1.
|
|
29
|
+
"gifted-charts-core": "0.1.70"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/cli": "^7.24.8",
|