react-native-gifted-charts 1.4.14 → 1.4.15
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/package.json +2 -2
- package/src/BarChart/Animated2DWithGradient.tsx +1 -1
- package/src/BarChart/RenderBars.tsx +12 -9
- package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +15 -10
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +1 -1
- package/src/todos.md +2 -1
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.15",
|
|
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": "src/index.tsx",
|
|
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.
|
|
28
|
+
"gifted-charts-core": "^0.1.11"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@babel/core": "^7.22.5",
|
|
@@ -53,12 +53,20 @@ const RenderBars = (props: RenderBarsPropsType) => {
|
|
|
53
53
|
yAxisOffset,
|
|
54
54
|
barWidth,
|
|
55
55
|
labelsDistanceFromXaxis = 0,
|
|
56
|
+
stepHeight,
|
|
57
|
+
stepValue,
|
|
58
|
+
negativeStepHeight,
|
|
59
|
+
negativeStepValue,
|
|
56
60
|
} = props;
|
|
57
61
|
|
|
62
|
+
const heightFactor =
|
|
63
|
+
item.value < 0
|
|
64
|
+
? negativeStepHeight / negativeStepValue
|
|
65
|
+
: stepHeight / stepValue;
|
|
66
|
+
|
|
58
67
|
const barHeight = Math.max(
|
|
59
68
|
minHeight,
|
|
60
|
-
|
|
61
|
-
xAxisThickness,
|
|
69
|
+
Math.abs(item.value) * heightFactor - xAxisThickness,
|
|
62
70
|
);
|
|
63
71
|
|
|
64
72
|
const {
|
|
@@ -295,10 +303,7 @@ const RenderBars = (props: RenderBarsPropsType) => {
|
|
|
295
303
|
translateY:
|
|
296
304
|
(containerHeight || 200) -
|
|
297
305
|
(barHeight - 10 + xAxisLabelsVerticalShift) +
|
|
298
|
-
(item.value < 0
|
|
299
|
-
? (Math.abs(item.value) * (containerHeight || 200)) /
|
|
300
|
-
(maxValue || 200)
|
|
301
|
-
: 0),
|
|
306
|
+
(item.value < 0 ? Math.abs(item.value) * heightFactor : 0),
|
|
302
307
|
},
|
|
303
308
|
],
|
|
304
309
|
}
|
|
@@ -306,9 +311,7 @@ const RenderBars = (props: RenderBarsPropsType) => {
|
|
|
306
311
|
? {
|
|
307
312
|
transform: [
|
|
308
313
|
{
|
|
309
|
-
translateY:
|
|
310
|
-
(Math.abs(item.value) * (containerHeight || 200)) /
|
|
311
|
-
(maxValue || 200),
|
|
314
|
+
translateY: Math.abs(item.value) * heightFactor,
|
|
312
315
|
},
|
|
313
316
|
{rotateZ: '180deg'},
|
|
314
317
|
],
|
|
@@ -18,7 +18,9 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
|
|
|
18
18
|
yAxisSide,
|
|
19
19
|
horizontalRulesStyle,
|
|
20
20
|
noOfSections,
|
|
21
|
+
sectionColors,
|
|
21
22
|
stepHeight,
|
|
23
|
+
negativeStepHeight,
|
|
22
24
|
yAxisLabelWidth,
|
|
23
25
|
yAxisLabelContainerStyle,
|
|
24
26
|
yAxisThickness,
|
|
@@ -92,7 +94,7 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
|
|
|
92
94
|
: styles.leftPart,
|
|
93
95
|
{
|
|
94
96
|
borderColor: yAxisColor,
|
|
95
|
-
backgroundColor: backgroundColor,
|
|
97
|
+
backgroundColor: sectionColors?.[invertedIndex] ?? backgroundColor,
|
|
96
98
|
width: (props.width || totalWidth - spacing) + endSpacing,
|
|
97
99
|
},
|
|
98
100
|
!index ? {height: stepHeight / 2, marginTop: stepHeight / 2} : null,
|
|
@@ -458,7 +460,7 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
|
|
|
458
460
|
{
|
|
459
461
|
width: (width ?? totalWidth) + 15,
|
|
460
462
|
},
|
|
461
|
-
index === 0 && {marginTop:
|
|
463
|
+
index === 0 && {marginTop: negativeStepHeight / 2},
|
|
462
464
|
]}>
|
|
463
465
|
<View
|
|
464
466
|
style={[
|
|
@@ -469,11 +471,14 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
|
|
|
469
471
|
marginLeft: yAxisThickness,
|
|
470
472
|
},
|
|
471
473
|
{
|
|
472
|
-
height:
|
|
474
|
+
height:
|
|
475
|
+
index === 0
|
|
476
|
+
? negativeStepHeight * 1.5
|
|
477
|
+
: negativeStepHeight,
|
|
473
478
|
width:
|
|
474
479
|
yAxisSide === yAxisSides.RIGHT ? 0 : yAxisLabelWidth,
|
|
475
480
|
},
|
|
476
|
-
index === 0 && {marginTop: -
|
|
481
|
+
index === 0 && {marginTop: -negativeStepHeight / 2},
|
|
477
482
|
]}
|
|
478
483
|
/>
|
|
479
484
|
<View
|
|
@@ -521,12 +526,12 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
|
|
|
521
526
|
{
|
|
522
527
|
position: 'absolute',
|
|
523
528
|
zIndex: 1,
|
|
524
|
-
bottom:
|
|
529
|
+
bottom: negativeStepHeight * index,
|
|
525
530
|
width: yAxisLabelWidth,
|
|
526
531
|
height:
|
|
527
|
-
index ===
|
|
528
|
-
?
|
|
529
|
-
:
|
|
532
|
+
index === noOfSectionsBelowXAxis
|
|
533
|
+
? negativeStepHeight / 2
|
|
534
|
+
: negativeStepHeight,
|
|
530
535
|
},
|
|
531
536
|
yAxisSide === yAxisSides.RIGHT && {
|
|
532
537
|
left: (width ?? totalWidth) + yAxisLabelWidth,
|
|
@@ -538,8 +543,8 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
|
|
|
538
543
|
ellipsizeMode={'clip'}
|
|
539
544
|
style={[
|
|
540
545
|
yAxisTextStyle,
|
|
541
|
-
index ===
|
|
542
|
-
marginBottom:
|
|
546
|
+
index === noOfSectionsBelowXAxis && {
|
|
547
|
+
marginBottom: negativeStepHeight / -2,
|
|
543
548
|
},
|
|
544
549
|
]}>
|
|
545
550
|
{label}
|
|
@@ -16,7 +16,7 @@ export const renderDataPoints = props => {
|
|
|
16
16
|
spacing,
|
|
17
17
|
} = props;
|
|
18
18
|
return data.map((item: any, index: number) => {
|
|
19
|
-
if (index < lineConfig.startIndex || index > lineConfig.endIndex) {
|
|
19
|
+
if (index < lineConfig.startIndex || index > lineConfig.endIndex || item.hideDataPoint) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
const currentBarWidth = item.barWidth || barWidth || 30;
|
package/src/todos.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
## Features
|
|
2
2
|
|
|
3
|
-
1.
|
|
3
|
+
1. Scatter Chart - https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/518
|
|
4
|
+
2. Issue with eslint - tsc https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/222
|
|
4
5
|
|
|
5
6
|
## To-dos in documentation-
|
|
6
7
|
|