@harveylx/react-native-gifted-charts 1.4.70

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.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +162 -0
  3. package/dist/BarChart/Animated2DWithGradient.d.ts +3 -0
  4. package/dist/BarChart/Animated2DWithGradient.js +78 -0
  5. package/dist/BarChart/RenderBars.d.ts +3 -0
  6. package/dist/BarChart/RenderBars.js +222 -0
  7. package/dist/BarChart/RenderStackBars.d.ts +3 -0
  8. package/dist/BarChart/RenderStackBars.js +214 -0
  9. package/dist/BarChart/index.d.ts +2 -0
  10. package/dist/BarChart/index.js +256 -0
  11. package/dist/BarChart/styles.d.ts +45 -0
  12. package/dist/BarChart/styles.js +46 -0
  13. package/dist/Components/AnimatedThreeDBar/index.d.ts +3 -0
  14. package/dist/Components/AnimatedThreeDBar/index.js +103 -0
  15. package/dist/Components/AnimatedThreeDBar/styles.d.ts +11 -0
  16. package/dist/Components/AnimatedThreeDBar/styles.js +12 -0
  17. package/dist/Components/BarAndLineChartsWrapper/index.d.ts +3 -0
  18. package/dist/Components/BarAndLineChartsWrapper/index.js +161 -0
  19. package/dist/Components/BarAndLineChartsWrapper/renderBackgroundSlices.d.ts +7 -0
  20. package/dist/Components/BarAndLineChartsWrapper/renderBackgroundSlices.js +30 -0
  21. package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.d.ts +2 -0
  22. package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +468 -0
  23. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.d.ts +3 -0
  24. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +87 -0
  25. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.d.ts +2 -0
  26. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +102 -0
  27. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.d.ts +1 -0
  28. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +25 -0
  29. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.d.ts +1 -0
  30. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +20 -0
  31. package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.d.ts +2 -0
  32. package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +133 -0
  33. package/dist/Components/BarSpecificComponents/barBackgroundPattern.d.ts +2 -0
  34. package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +9 -0
  35. package/dist/Components/BarSpecificComponents/cap.d.ts +2 -0
  36. package/dist/Components/BarSpecificComponents/cap.js +16 -0
  37. package/dist/Components/BarSpecificComponents/tooltip.d.ts +3 -0
  38. package/dist/Components/BarSpecificComponents/tooltip.js +38 -0
  39. package/dist/Components/common/LinearGradient.d.ts +16 -0
  40. package/dist/Components/common/LinearGradient.js +15 -0
  41. package/dist/Components/common/Pointer.d.ts +1 -0
  42. package/dist/Components/common/Pointer.js +18 -0
  43. package/dist/Components/common/StripAndLabel.d.ts +2 -0
  44. package/dist/Components/common/StripAndLabel.js +60 -0
  45. package/dist/Components/lineSvg.d.ts +14 -0
  46. package/dist/Components/lineSvg.js +22 -0
  47. package/dist/LineChart/LineChartBicolor.d.ts +2 -0
  48. package/dist/LineChart/LineChartBicolor.js +298 -0
  49. package/dist/LineChart/index.d.ts +2 -0
  50. package/dist/LineChart/index.js +1137 -0
  51. package/dist/LineChart/styles.d.ts +43 -0
  52. package/dist/LineChart/styles.js +46 -0
  53. package/dist/PieChart/index.d.ts +2 -0
  54. package/dist/PieChart/index.js +146 -0
  55. package/dist/PieChart/main.d.ts +2 -0
  56. package/dist/PieChart/main.js +178 -0
  57. package/dist/PieChartPro/index.d.ts +2 -0
  58. package/dist/PieChartPro/index.js +124 -0
  59. package/dist/PopulationPyramid/index.d.ts +2 -0
  60. package/dist/PopulationPyramid/index.js +132 -0
  61. package/dist/RadarChart/index.d.ts +2 -0
  62. package/dist/RadarChart/index.js +113 -0
  63. package/dist/index.d.ts +8 -0
  64. package/dist/index.js +8 -0
  65. package/dist/utils/index.d.ts +5 -0
  66. package/dist/utils/index.js +22 -0
  67. package/package.json +89 -0
@@ -0,0 +1,102 @@
1
+ var __read = (this && this.__read) || function (o, n) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3
+ if (!m) return o;
4
+ var i = m.call(o), r, ar = [], e;
5
+ try {
6
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
+ }
8
+ catch (error) { e = { error: error }; }
9
+ finally {
10
+ try {
11
+ if (r && !r.done && (m = i["return"])) m.call(i);
12
+ }
13
+ finally { if (e) throw e.error; }
14
+ }
15
+ return ar;
16
+ };
17
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
+ import { Fragment, useState } from 'react';
19
+ import { styles } from '../../../BarChart/styles';
20
+ import { TouchableOpacity, View } from 'react-native';
21
+ import { getXForLineInBar, getYForLineInBar } from '@harveylx/gifted-charts-core';
22
+ import { Rect, Text as CanvasText, Circle, ForeignObject, } from 'react-native-svg';
23
+ import { isWebApp } from '../../../utils';
24
+ export var renderDataPoints = function (props) {
25
+ var data = props.data, lineConfig = props.lineConfig, barWidth = props.barWidth, containerHeight = props.containerHeight, maxValue = props.maxValue, firstBarWidth = props.firstBarWidth, yAxisLabelWidth = props.yAxisLabelWidth, spacing = props.spacing, selectedIndex = props.selectedIndex, yAxisOffset = props.yAxisOffset, opacity = props.opacity, svgHeight = props.svgHeight, totalWidth = props.totalWidth;
26
+ var focusEnabled = lineConfig.focusEnabled, dataPointLabelComponent = lineConfig.dataPointLabelComponent, showDataPointLabelOnFocus = lineConfig.showDataPointLabelOnFocus, focusedDataPointIndex = lineConfig.focusedDataPointIndex;
27
+ var _a = __read(useState(focusedDataPointIndex !== null && focusedDataPointIndex !== void 0 ? focusedDataPointIndex : -1), 2), selectedDataPointIndex = _a[0], setSelectedDataPointIndex = _a[1];
28
+ return (_jsxs(_Fragment, { children: [data.map(function (item, index) {
29
+ var _a, _b, _c;
30
+ if (index < lineConfig.startIndex ||
31
+ index > lineConfig.endIndex ||
32
+ item.hideDataPoint) {
33
+ return null;
34
+ }
35
+ var currentBarWidth = item.barWidth || barWidth || 30;
36
+ var customDataPoint = item.customDataPoint || lineConfig.customDataPoint;
37
+ var dataPointColor = lineConfig.focusEnabled && index === selectedDataPointIndex
38
+ ? lineConfig.focusedDataPointColor
39
+ : lineConfig.dataPointsColor;
40
+ var dataPointRadius = lineConfig.focusEnabled && index === selectedDataPointIndex
41
+ ? lineConfig.focusedDataPointRadius
42
+ : lineConfig.dataPointsRadius;
43
+ var value = (_a = item.value) !== null && _a !== void 0 ? _a : item.stacks.reduce(function (total, item) { return total + item.value; }, 0);
44
+ var x = getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing);
45
+ var y = getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset);
46
+ if (customDataPoint) {
47
+ return (_jsx(TouchableOpacity, { style: [
48
+ styles.customDataPointContainer,
49
+ {
50
+ opacity: opacity,
51
+ height: lineConfig.dataPointsHeight,
52
+ width: lineConfig.dataPointsWidth,
53
+ top: containerHeight -
54
+ (value * containerHeight) / maxValue -
55
+ ((_c = (_b = item.shiftY) !== null && _b !== void 0 ? _b : lineConfig.shiftY) !== null && _c !== void 0 ? _c : 0),
56
+ left: getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing),
57
+ },
58
+ ], onPress: function () {
59
+ if (focusEnabled)
60
+ setSelectedDataPointIndex(index);
61
+ }, children: customDataPoint(item, index) }, index + '.' + value + 'custom'));
62
+ }
63
+ if (lineConfig.dataPointsShape === 'rectangular') {
64
+ return (_jsxs(Fragment, { children: [_jsx(Rect, { x: x, y: y - lineConfig.dataPointsHeight / 2, width: lineConfig.dataPointsWidth, height: lineConfig.dataPointsHeight, fill: dataPointColor, opacity: opacity, onPress: function () {
65
+ if (focusEnabled)
66
+ setSelectedDataPointIndex(index);
67
+ } }), item.dataPointText && (_jsx(CanvasText, { fill: item.textColor || lineConfig.textColor, opacity: opacity, fontSize: item.textFontSize || lineConfig.textFontSize, x: x + (item.textShiftX || lineConfig.textShiftX || 0), y: y -
68
+ lineConfig.dataPointsHeight / 2 +
69
+ (item.textShiftY || lineConfig.textShiftY || 0), children: item.dataPointText }))] }, index + '.' + value + 'rect'));
70
+ }
71
+ return (_jsxs(Fragment, { children: [_jsx(Circle, { cx: x, cy: y, r: dataPointRadius, fill: dataPointColor, opacity: opacity, onPress: function () {
72
+ if (focusEnabled)
73
+ setSelectedDataPointIndex(index);
74
+ } }), item.dataPointText && (_jsx(CanvasText, { fill: item.textColor || lineConfig.textColor, opacity: opacity, fontSize: item.textFontSize || lineConfig.textFontSize, x: x + (item.textShiftX || lineConfig.textShiftX || 0), y: y -
75
+ lineConfig.dataPointsHeight / 2 +
76
+ (item.textShiftY || lineConfig.textShiftY || 0), children: item.dataPointText }))] }, index + '.' + value + 'circ'));
77
+ }), dataPointLabelComponent
78
+ ? data.map(function (item, index) {
79
+ var _a;
80
+ if (index < lineConfig.startIndex ||
81
+ index > lineConfig.endIndex ||
82
+ item.hideDataPoint) {
83
+ return null;
84
+ }
85
+ var currentBarWidth = item.barWidth || barWidth || 30;
86
+ var value = (_a = item.value) !== null && _a !== void 0 ? _a : item.stacks.reduce(function (total, item) { return total + item.value; }, 0);
87
+ var x = getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing);
88
+ var y = getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset);
89
+ if (isWebApp)
90
+ return (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: x - 12, y: y - 24, children: showDataPointLabelOnFocus
91
+ ? selectedDataPointIndex === index
92
+ ? dataPointLabelComponent === null || dataPointLabelComponent === void 0 ? void 0 : dataPointLabelComponent(item, index)
93
+ : null
94
+ : dataPointLabelComponent === null || dataPointLabelComponent === void 0 ? void 0 : dataPointLabelComponent(item, index) }, index + '.' + value + 'label'));
95
+ return (_jsx(View, { style: { top: y - 24, left: x - 12, position: 'absolute' }, children: showDataPointLabelOnFocus
96
+ ? selectedDataPointIndex === index
97
+ ? dataPointLabelComponent === null || dataPointLabelComponent === void 0 ? void 0 : dataPointLabelComponent(item, index)
98
+ : null
99
+ : dataPointLabelComponent === null || dataPointLabelComponent === void 0 ? void 0 : dataPointLabelComponent(item, index) }, index + '.' + value + 'label'));
100
+ })
101
+ : null] }));
102
+ };
@@ -0,0 +1 @@
1
+ export declare const renderSpecificDataPoints: (props: any) => any;
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
3
+ import { getXForLineInBar, getYForLineInBar } from '@harveylx/gifted-charts-core';
4
+ import { Circle, Rect, Text as CanvasText } from 'react-native-svg';
5
+ export var renderSpecificDataPoints = function (props) {
6
+ var data = props.data, barWidth = props.barWidth, firstBarWidth = props.firstBarWidth, yAxisLabelWidth = props.yAxisLabelWidth, lineConfig = props.lineConfig, spacing = props.spacing, containerHeight = props.containerHeight, maxValue = props.maxValue, yAxisOffset = props.yAxisOffset;
7
+ return data.map(function (item, index) {
8
+ var currentBarWidth = item.barWidth || barWidth || 30;
9
+ var x = getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing);
10
+ var y = getYForLineInBar(item.value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset);
11
+ if (item.showDataPoint) {
12
+ if (item.dataPointShape === 'rectangular') {
13
+ return (_jsxs(Fragment, { children: [_jsx(Rect, { x: x, y: y - item.dataPointsHeight / 2, width: item.dataPointWidth || lineConfig.dataPointsWidth, height: item.dataPointHeight || 2, fill: item.dataPointColor || 'black' }), item.dataPointText && (_jsx(CanvasText, { fill: item.textColor || 'black', fontSize: item.textFontSize || 10, x: x + (item.textShiftX || lineConfig.textShiftX || 0), y: y -
14
+ (item.dataPointHeight || lineConfig.dataPointsHeight) / 2 +
15
+ (item.textShiftY || lineConfig.textShiftY || 0), children: item.dataPointText }))] }, index));
16
+ }
17
+ else {
18
+ return (_jsxs(Fragment, { children: [_jsx(Circle, { cx: x, cy: y, r: item.dataPointRadius || 3, fill: item.dataPointColor || 'black' }), item.dataPointText && (_jsx(CanvasText, { fill: item.textColor || 'black', fontSize: item.textFontSize || 10, x: x + (item.textShiftX || lineConfig.textShiftX || 0), y: y -
19
+ (item.dataPointHeight || lineConfig.dataPointsHeight) / 2 +
20
+ (item.textShiftY || lineConfig.textShiftY || 0), children: item.dataPointText }))] }, index));
21
+ }
22
+ }
23
+ return null;
24
+ });
25
+ };
@@ -0,0 +1 @@
1
+ export declare const renderSpecificVerticalLines: (props: any) => any;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Rect } from 'react-native-svg';
3
+ export var renderSpecificVerticalLines = function (props) {
4
+ var data = props.data, barWidth = props.barWidth, yAxisLabelWidth = props.yAxisLabelWidth, initialSpacing = props.initialSpacing, spacing = props.spacing, containerHeight = props.containerHeight, lineConfig = props.lineConfig, maxValue = props.maxValue;
5
+ return data.map(function (item, index) {
6
+ if (item.showVerticalLine) {
7
+ var currentBarWidth = item.barWidth || barWidth || 30;
8
+ return (_jsx(Rect, { x: yAxisLabelWidth +
9
+ 6 -
10
+ (item.verticalLineThickness || 1) / 2 -
11
+ 1 -
12
+ (initialSpacing - currentBarWidth / 2) +
13
+ (currentBarWidth + spacing) * index, y: containerHeight -
14
+ lineConfig.shiftY -
15
+ (item.value * containerHeight) / maxValue +
16
+ 9, width: item.verticalLineThickness || 1, height: (item.value * containerHeight) / maxValue + lineConfig.shiftY, fill: item.verticalLineColor || 'lightgray' }));
17
+ }
18
+ return null;
19
+ });
20
+ };
@@ -0,0 +1,2 @@
1
+ declare const RenderVerticalLines: (props: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default RenderVerticalLines;
@@ -0,0 +1,133 @@
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
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { createElement as _createElement } from "react";
14
+ import { View } from 'react-native';
15
+ import { chartTypes } from '@harveylx/gifted-charts-core';
16
+ import { Line, Svg } from 'react-native-svg';
17
+ var RenderVerticalLines = function (props) {
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;
20
+ var getHeightOfVerticalLine = function (index) {
21
+ if (verticalLinesUptoDataPoint) {
22
+ if (index < data.length) {
23
+ return ((data[index].value * containerHeight) / maxValue - xAxisThickness);
24
+ }
25
+ else {
26
+ return verticalLinesHeight !== null && verticalLinesHeight !== void 0 ? verticalLinesHeight : 0;
27
+ }
28
+ }
29
+ else {
30
+ return (verticalLinesHeight ||
31
+ containerHeightIncludingBelowXAxis - xAxisThickness);
32
+ }
33
+ };
34
+ var extendedContainerHeight = containerHeight + 10 + labelsExtraHeight;
35
+ var thickness = verticalLinesThickness || 2;
36
+ var heightAdjustmentDueToStrokeLinecap = verticalLinesStrokeLinecap === 'round' ||
37
+ verticalLinesStrokeLinecap === 'square'
38
+ ? thickness / 2
39
+ : 0;
40
+ return (_jsx(View, { style: {
41
+ position: 'absolute',
42
+ height: containerHeightIncludingBelowXAxis,
43
+ bottom: 60 + xAxisLabelsVerticalShift, //stepHeight * -0.5 + xAxisThickness,
44
+ left: 0,
45
+ width: totalWidth,
46
+ zIndex: verticalLinesZIndex || -1,
47
+ }, children: _jsx(Svg, { height: containerHeightIncludingBelowXAxis, width: totalWidth, children: verticalLinesAr.map(function (item, index) {
48
+ var _a, _b, _c, _d, _e, _f;
49
+ var totalSpacing = initialSpacing;
50
+ if (verticalLinesSpacing) {
51
+ totalSpacing = verticalLinesSpacing * (index + 1);
52
+ }
53
+ else {
54
+ if (stackData) {
55
+ totalSpacing += (stackData[0].barWidth || barWidth || 30) / 2;
56
+ }
57
+ else {
58
+ totalSpacing += (data[0].barWidth || barWidth || 30) / 2;
59
+ }
60
+ for (var i = 0; i < index; i++) {
61
+ var actualSpacing = spacing;
62
+ if (stackData) {
63
+ if (i >= stackData.length - 1) {
64
+ actualSpacing += (barWidth || 30) / 2;
65
+ }
66
+ else {
67
+ if (stackData[i].spacing || stackData[i].spacing === 0) {
68
+ actualSpacing = stackData[i].spacing;
69
+ }
70
+ if (stackData[i + 1].barWidth) {
71
+ actualSpacing += stackData[i + 1].barWidth;
72
+ }
73
+ else {
74
+ actualSpacing += barWidth || 30;
75
+ }
76
+ }
77
+ }
78
+ else {
79
+ if (i >= data.length - 1) {
80
+ actualSpacing += (barWidth || 30) / 2;
81
+ }
82
+ else {
83
+ if (data[i].spacing || data[i].spacing === 0) {
84
+ actualSpacing = data[i].spacing;
85
+ }
86
+ if (data[i + 1].barWidth) {
87
+ actualSpacing += data[i + 1].barWidth;
88
+ }
89
+ else {
90
+ actualSpacing += barWidth || 30;
91
+ }
92
+ }
93
+ }
94
+ totalSpacing += actualSpacing;
95
+ }
96
+ }
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 +
104
+ 1 +
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
106
+ ? totalSpacing - 1
107
+ : verticalLinesSpacing
108
+ ? verticalLinesSpacing * (index + 1)
109
+ : index * spacing + (initialSpacing - 2));
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 -
129
+ getHeightOfVerticalLine(index) +
130
+ heightAdjustmentDueToStrokeLinecap, x2: x })));
131
+ }) }) }));
132
+ };
133
+ export default RenderVerticalLines;
@@ -0,0 +1,2 @@
1
+ declare const BarBackgroundPattern: (props: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default BarBackgroundPattern;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Svg, { Defs, Rect } from 'react-native-svg';
3
+ var BarBackgroundPattern = function (props) {
4
+ var barBackgroundPatternFromItem = props.barBackgroundPatternFromItem, barBackgroundPatternFromProps = props.barBackgroundPatternFromProps, patternIdFromItem = props.patternIdFromItem, patternIdFromProps = props.patternIdFromProps;
5
+ return (_jsxs(Svg, { children: [_jsx(Defs, { children: barBackgroundPatternFromItem
6
+ ? barBackgroundPatternFromItem()
7
+ : barBackgroundPatternFromProps() }), _jsx(Rect, { stroke: "none", x: "1", y: "1", width: "100%", height: "100%", fill: "url(#".concat(patternIdFromItem !== null && patternIdFromItem !== void 0 ? patternIdFromItem : patternIdFromProps, ")") })] }));
8
+ };
9
+ export default BarBackgroundPattern;
@@ -0,0 +1,2 @@
1
+ declare const Cap: (props: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default Cap;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import { BarDefaults } from '@harveylx/gifted-charts-core';
4
+ var Cap = function (props) {
5
+ var _a, _b, _c, _d;
6
+ var capThicknessFromItem = props.capThicknessFromItem, capThicknessFromProps = props.capThicknessFromProps, capColorFromItem = props.capColorFromItem, capColorFromProps = props.capColorFromProps, capRadiusFromItem = props.capRadiusFromItem, capRadiusFromProps = props.capRadiusFromProps;
7
+ return (_jsx(View, { style: {
8
+ position: 'absolute',
9
+ width: '100%',
10
+ height: (_a = capThicknessFromItem !== null && capThicknessFromItem !== void 0 ? capThicknessFromItem : capThicknessFromProps) !== null && _a !== void 0 ? _a : BarDefaults.capThickness,
11
+ backgroundColor: (_b = capColorFromItem !== null && capColorFromItem !== void 0 ? capColorFromItem : capColorFromProps) !== null && _b !== void 0 ? _b : BarDefaults.capColor,
12
+ borderTopLeftRadius: (_c = capRadiusFromItem !== null && capRadiusFromItem !== void 0 ? capRadiusFromItem : capRadiusFromProps) !== null && _c !== void 0 ? _c : BarDefaults.capRadius,
13
+ borderTopRightRadius: (_d = capRadiusFromItem !== null && capRadiusFromItem !== void 0 ? capRadiusFromItem : capRadiusFromProps) !== null && _d !== void 0 ? _d : BarDefaults.capRadius,
14
+ } }));
15
+ };
16
+ export default Cap;
@@ -0,0 +1,3 @@
1
+ import { TooltipProps } from '@harveylx/gifted-charts-core/dist/utils/types';
2
+ declare const Tooltip: (props: TooltipProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Tooltip;
@@ -0,0 +1,38 @@
1
+ var __read = (this && this.__read) || function (o, n) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3
+ if (!m) return o;
4
+ var i = m.call(o), r, ar = [], e;
5
+ try {
6
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
+ }
8
+ catch (error) { e = { error: error }; }
9
+ finally {
10
+ try {
11
+ if (r && !r.done && (m = i["return"])) m.call(i);
12
+ }
13
+ finally { if (e) throw e.error; }
14
+ }
15
+ return ar;
16
+ };
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ import { useState } from 'react';
19
+ import { View } from 'react-native';
20
+ var Tooltip = function (props) {
21
+ var barWidth = props.barWidth, item = props.item, index = props.index, isLast = props.isLast, leftSpacing = props.leftSpacing, leftShiftForLastIndexTooltip = props.leftShiftForLastIndexTooltip, leftShiftForTooltip = props.leftShiftForTooltip, renderTooltip = props.renderTooltip, autoCenterTooltip = props.autoCenterTooltip, horizontal = props.horizontal, bottom = props.bottom;
22
+ var _a = __read(useState(0), 2), leftShiftTooltipForCentering = _a[0], setLeftShiftTooltipForCentering = _a[1];
23
+ return (_jsx(View, { style: {
24
+ position: 'absolute',
25
+ bottom: bottom,
26
+ left: leftSpacing -
27
+ (isLast ? leftShiftForLastIndexTooltip : leftShiftForTooltip) -
28
+ leftShiftTooltipForCentering,
29
+ zIndex: 300000,
30
+ transform: [{ rotate: horizontal ? '-90deg' : '0deg' }],
31
+ }, onLayout: function (event) {
32
+ if (!autoCenterTooltip)
33
+ return;
34
+ var width = event.nativeEvent.layout.width;
35
+ setLeftShiftTooltipForCentering((width - barWidth) / 2);
36
+ }, children: renderTooltip === null || renderTooltip === void 0 ? void 0 : renderTooltip(item, index) }));
37
+ };
38
+ export default Tooltip;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ type LinearGradientProps = {
3
+ style?: any;
4
+ start?: {
5
+ x: number;
6
+ y: number;
7
+ };
8
+ end?: {
9
+ x: number;
10
+ y: number;
11
+ };
12
+ colors: string[];
13
+ children?: any;
14
+ };
15
+ declare let LinearGradient: React.FC<LinearGradientProps>;
16
+ export default LinearGradient;
@@ -0,0 +1,15 @@
1
+ var LinearGradient;
2
+ try {
3
+ // for bare react-native projects
4
+ LinearGradient = require('react-native-linear-gradient').LinearGradient;
5
+ }
6
+ catch (e) {
7
+ try {
8
+ // for expo-based projects
9
+ LinearGradient = require('expo-linear-gradient').LinearGradient;
10
+ }
11
+ catch (e) {
12
+ throw new Error('Gradient package was not found. Make sure "react-native-linear-gradient" or "expo-linear-gradient" is installed');
13
+ }
14
+ }
15
+ export default LinearGradient;
@@ -0,0 +1 @@
1
+ export declare const Pointer: (props: any) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ export var Pointer = function (props) {
4
+ var pointerX = props.pointerX, pointerYLocal = props.pointerYLocal, pointerComponent = props.pointerComponent, pointerHeight = props.pointerHeight, pointerRadius = props.pointerRadius, pointerWidth = props.pointerWidth, pointerItemLocal = props.pointerItemLocal, pointerColorLocal = props.pointerColorLocal, pointerIndex = props.pointerIndex;
5
+ if (isNaN(pointerYLocal) || typeof pointerYLocal !== 'number')
6
+ return null;
7
+ return (_jsx(View, { style: {
8
+ position: 'absolute',
9
+ left: pointerX + 1 + (pointerX.pointerShiftX || 0),
10
+ top: pointerYLocal - 4,
11
+ }, children: pointerComponent ? (pointerComponent(pointerItemLocal, pointerIndex)) : (_jsx(View, { style: {
12
+ height: pointerHeight || pointerRadius * 2,
13
+ width: pointerWidth || pointerRadius * 2,
14
+ marginTop: (pointerItemLocal === null || pointerItemLocal === void 0 ? void 0 : pointerItemLocal.pointerShiftY) || 0,
15
+ backgroundColor: pointerColorLocal,
16
+ borderRadius: pointerRadius || 0,
17
+ } })) }));
18
+ };
@@ -0,0 +1,2 @@
1
+ import { StripAndLabelProps } from '@harveylx/gifted-charts-core';
2
+ export declare const StripAndLabel: (props: StripAndLabelProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import Svg, { Line } from 'react-native-svg';
4
+ import { getTopAndLeftForStripAndLabel, } from '@harveylx/gifted-charts-core';
5
+ export var StripAndLabel = function (props) {
6
+ var _a, _b, _c, _d, _e, _f, _g, _h;
7
+ var pointerX = props.pointerX, pointerLabelWidth = props.pointerLabelWidth, pointerRadius = props.pointerRadius, pointerWidth = props.pointerWidth, pointerYLocal = props.pointerYLocal, pointerStripUptoDataPoint = props.pointerStripUptoDataPoint, pointerStripHeight = props.pointerStripHeight, pointerItemLocal = props.pointerItemLocal, showPointerStrip = props.showPointerStrip, pointerStripWidth = props.pointerStripWidth, containerHeight = props.containerHeight, xAxisThickness = props.xAxisThickness, pointerStripColor = props.pointerStripColor, pointerConfig = props.pointerConfig, pointerLabelComponent = props.pointerLabelComponent, secondaryPointerItem = props.secondaryPointerItem, pointerItemsForSet = props.pointerItemsForSet, secondaryPointerItemsForSet = props.secondaryPointerItemsForSet, pointerEvents = props.pointerEvents, isBarChart = props.isBarChart, pointerIndex = props.pointerIndex, hasDataSet = props.hasDataSet, containsNegative = props.containsNegative, horizontalStripConfig = props.horizontalStripConfig, screenWidth = props.screenWidth, width = props.width;
8
+ var _j = getTopAndLeftForStripAndLabel(props), top = _j.top, left = _j.left;
9
+ if (isNaN(top) || typeof top !== 'number')
10
+ return null;
11
+ return (_jsxs(View, { style: {
12
+ position: 'absolute',
13
+ top: pointerYLocal,
14
+ }, children: [(isBarChart
15
+ ? showPointerStrip && !pointerLabelComponent
16
+ : showPointerStrip) ? (_jsxs(View, { style: {
17
+ position: 'absolute',
18
+ left: -pointerStripWidth / 4,
19
+ top: containsNegative ? 0 : -pointerYLocal + 8 + xAxisThickness,
20
+ width: width,
21
+ height: containerHeight,
22
+ }, children: [_jsxs(Svg, { children: [_jsx(Line, { stroke: pointerStripColor, strokeWidth: pointerStripWidth, strokeDasharray: (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray)
23
+ ? pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray
24
+ : '', x1: pointerX +
25
+ pointerRadius +
26
+ 2 -
27
+ pointerStripWidth / 2 +
28
+ (((_a = pointerItemLocal[0]) === null || _a === void 0 ? void 0 : _a.pointerShiftX) || 0), y1: pointerStripUptoDataPoint
29
+ ? pointerYLocal + pointerRadius - 4
30
+ : containerHeight - pointerStripHeight, x2: pointerX +
31
+ pointerRadius +
32
+ 2 -
33
+ pointerStripWidth / 2 +
34
+ (((_b = pointerItemLocal[0]) === null || _b === void 0 ? void 0 : _b.pointerShiftX) || 0), y2: containerHeight }), horizontalStripConfig && (_jsx(Line, { stroke: (_c = horizontalStripConfig.color) !== null && _c !== void 0 ? _c : pointerStripColor, strokeWidth: (_d = horizontalStripConfig.thickness) !== null && _d !== void 0 ? _d : pointerStripWidth, strokeDasharray: ((_f = (_e = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.horizontalStripConfig) === null || _e === void 0 ? void 0 : _e.strokeDashArray) !== null && _f !== void 0 ? _f : pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray)
35
+ ? pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray
36
+ : '', x1: 0, y1: pointerYLocal - 7, x2: horizontalStripConfig.horizontalStripUptoDataPoint
37
+ ? pointerX + 2
38
+ : screenWidth, y2: pointerYLocal - 7 }))] }), (horizontalStripConfig === null || horizontalStripConfig === void 0 ? void 0 : horizontalStripConfig.labelComponent) ? (_jsx(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: [
39
+ {
40
+ position: 'absolute',
41
+ left: 0,
42
+ top: pointerYLocal -
43
+ 3 -
44
+ ((_g = horizontalStripConfig.labelComponentHeight) !== null && _g !== void 0 ? _g : 30) / 2,
45
+ width: pointerLabelWidth,
46
+ },
47
+ ], children: (_h = horizontalStripConfig === null || horizontalStripConfig === void 0 ? void 0 : horizontalStripConfig.labelComponent) === null || _h === void 0 ? void 0 : _h.call(horizontalStripConfig, hasDataSet ? pointerItemsForSet : pointerItemLocal, hasDataSet
48
+ ? secondaryPointerItemsForSet
49
+ : [secondaryPointerItem], pointerIndex) })) : null] })) : null, pointerLabelComponent ? (_jsx(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: [
50
+ {
51
+ position: 'absolute',
52
+ left: left + pointerX,
53
+ top: top,
54
+ marginTop: pointerStripUptoDataPoint
55
+ ? 0
56
+ : containerHeight - pointerStripHeight,
57
+ width: pointerLabelWidth,
58
+ },
59
+ ], children: pointerLabelComponent === null || pointerLabelComponent === void 0 ? void 0 : pointerLabelComponent(hasDataSet ? pointerItemsForSet : pointerItemLocal, hasDataSet ? secondaryPointerItemsForSet : [secondaryPointerItem], pointerIndex) })) : null] }));
60
+ };
@@ -0,0 +1,14 @@
1
+ import { ColorValue } from 'react-native';
2
+ type ruleProps = {
3
+ thickness: number;
4
+ width: number;
5
+ color: ColorValue | string | any;
6
+ type: string;
7
+ dashWidth: number;
8
+ dashGap: number;
9
+ };
10
+ type configType = {
11
+ config: ruleProps;
12
+ };
13
+ declare function Rule(props: configType): import("react/jsx-runtime").JSX.Element;
14
+ export default Rule;
@@ -0,0 +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
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import Svg, { G, Path } from 'react-native-svg';
14
+ import { ruleTypes } from '@harveylx/gifted-charts-core';
15
+ function Rule(props) {
16
+ var _a = props.config, thickness = _a.thickness, width = _a.width, color = _a.color, type = _a.type, dashWidth = _a.dashWidth, dashGap = _a.dashGap;
17
+ if (type === ruleTypes.SOLID) {
18
+ return (_jsx(Svg, __assign({ height: thickness, width: width }, props, { children: _jsx(G, { fill: "lightgray", stroke: color, strokeWidth: thickness, children: _jsx(Path, { d: "M0 ".concat(thickness / 2, "h").concat(width) }) }) })));
19
+ }
20
+ return (_jsx(Svg, __assign({ height: thickness, width: width }, props, { children: _jsx(G, { fill: "lightgray", stroke: color, strokeWidth: thickness, children: _jsx(Path, { strokeDasharray: "".concat(dashWidth, ",").concat(dashGap), d: "M0 ".concat(thickness / 2, "h").concat(width) }) }) })));
21
+ }
22
+ export default Rule;
@@ -0,0 +1,2 @@
1
+ import { LineChartBicolorPropsType } from '@harveylx/gifted-charts-core';
2
+ export declare const LineChartBicolor: (props: LineChartBicolorPropsType) => import("react/jsx-runtime").JSX.Element;