react-native-gifted-charts 1.3.30 → 1.3.32
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 +1 -1
- package/src/BarChart/index.tsx +2 -2
- package/src/BarChart/types.ts +1 -0
- package/src/Components/BarAndLineChartsWrapper/index.tsx +3 -5
- package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +1 -0
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart.tsx +1 -1
- package/src/LineChart/index.tsx +6 -7
- package/src/utils/index.tsx +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.32",
|
|
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": [
|
package/src/BarChart/index.tsx
CHANGED
|
@@ -92,10 +92,10 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
92
92
|
defaultLineConfig.animationDuration = animationDuration;
|
|
93
93
|
|
|
94
94
|
const lineConfig = props.lineConfig
|
|
95
|
-
? getLineConfigForBarChart(props.lineConfig)
|
|
95
|
+
? getLineConfigForBarChart(props.lineConfig, initialSpacing)
|
|
96
96
|
: defaultLineConfig;
|
|
97
97
|
const lineConfig2 = props.lineConfig2
|
|
98
|
-
? getLineConfigForBarChart(props.lineConfig2)
|
|
98
|
+
? getLineConfigForBarChart(props.lineConfig2, initialSpacing)
|
|
99
99
|
: defaultLineConfig;
|
|
100
100
|
const noOfSections = props.noOfSections ?? AxesAndRulesDefaults.noOfSections;
|
|
101
101
|
const containerHeight =
|
package/src/BarChart/types.ts
CHANGED
|
@@ -354,7 +354,8 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
354
354
|
labelsExtraHeight +
|
|
355
355
|
xAxisLabelsVerticalShift +
|
|
356
356
|
(trimYAxisAtTop ? 0 : yAxisExtraHeight) +
|
|
357
|
-
50
|
|
357
|
+
50 -
|
|
358
|
+
overflowTop,
|
|
358
359
|
marginTop: trimYAxisAtTop ? containerHeight / 20 : 0,
|
|
359
360
|
marginBottom: (xAxisLabelsHeight ?? xAxisTextNumberOfLines * 18) - 55, //This is to not let the Things that should be rendered below the chart overlap with it
|
|
360
361
|
},
|
|
@@ -393,9 +394,7 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
393
394
|
? 0
|
|
394
395
|
: yAxisLabelWidth + yAxisThickness,
|
|
395
396
|
position: 'absolute',
|
|
396
|
-
bottom:
|
|
397
|
-
overflowTop +
|
|
398
|
-
(chartType === chartTypes.LINE_BI_COLOR ? 0 : xAxisThickness),
|
|
397
|
+
bottom: chartType === chartTypes.LINE_BI_COLOR ? 0 : xAxisThickness,
|
|
399
398
|
},
|
|
400
399
|
!!props.width && {width: props.width},
|
|
401
400
|
horizontal && {
|
|
@@ -409,7 +408,6 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
409
408
|
containerHeightIncludingBelowXAxis +
|
|
410
409
|
yAxisExtraHeight +
|
|
411
410
|
labelsExtraHeight +
|
|
412
|
-
stepHeight / 2 +
|
|
413
411
|
(50 + xAxisLabelsVerticalShift),
|
|
414
412
|
width: Math.max(
|
|
415
413
|
props.width ?? 0,
|
|
@@ -361,7 +361,7 @@ const RenderLineInBarChart = props => {
|
|
|
361
361
|
style={{
|
|
362
362
|
position: 'absolute',
|
|
363
363
|
height: containerHeight + 10 + labelsExtraHeight,
|
|
364
|
-
left:
|
|
364
|
+
left: 6 - yAxisLabelWidth,
|
|
365
365
|
bottom: 50 + xAxisLabelsVerticalShift, //stepHeight * -0.5 + xAxisThickness,
|
|
366
366
|
width: totalWidth,
|
|
367
367
|
zIndex: lineBehindBars ? -1 : 100000,
|
package/src/LineChart/index.tsx
CHANGED
|
@@ -467,9 +467,11 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
467
467
|
const maxValue = props.maxValue || maxItem;
|
|
468
468
|
const mostNegativeValue = props.mostNegativeValue || minItem;
|
|
469
469
|
|
|
470
|
+
const overflowTop = props.overflowTop ?? 0;
|
|
471
|
+
|
|
470
472
|
const extendedContainerHeight = getExtendedContainerHeightWithPadding(
|
|
471
473
|
containerHeight,
|
|
472
|
-
|
|
474
|
+
overflowTop,
|
|
473
475
|
);
|
|
474
476
|
const getX = index => initialSpacing + spacing * index - 1;
|
|
475
477
|
const getY = value =>
|
|
@@ -2107,7 +2109,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
2107
2109
|
x={initialSpacing + (spacing * index - spacing / 2)}
|
|
2108
2110
|
y={8}
|
|
2109
2111
|
width={spacing}
|
|
2110
|
-
height={containerHeight
|
|
2112
|
+
height={containerHeight}
|
|
2111
2113
|
fill={'none'}
|
|
2112
2114
|
/>
|
|
2113
2115
|
)}
|
|
@@ -2128,7 +2130,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
2128
2130
|
width={currentStripWidth}
|
|
2129
2131
|
height={
|
|
2130
2132
|
currentStripHeight ||
|
|
2131
|
-
(item.value * containerHeight) / maxValue - 2
|
|
2133
|
+
(item.value * containerHeight) / maxValue - 2 + overflowTop
|
|
2132
2134
|
}
|
|
2133
2135
|
opacity={currentStripOpacity}
|
|
2134
2136
|
fill={stripColor}
|
|
@@ -3544,10 +3546,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
3544
3546
|
height:
|
|
3545
3547
|
extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
|
|
3546
3548
|
bottom:
|
|
3547
|
-
58 +
|
|
3548
|
-
labelsExtraHeight +
|
|
3549
|
-
xAxisLabelsVerticalShift -
|
|
3550
|
-
(props.overflowTop ?? 0),
|
|
3549
|
+
58 + labelsExtraHeight + xAxisLabelsVerticalShift - overflowTop,
|
|
3551
3550
|
// width: totalWidth,
|
|
3552
3551
|
zIndex: 20,
|
|
3553
3552
|
}}>
|
package/src/utils/index.tsx
CHANGED
|
@@ -1046,7 +1046,7 @@ export const getXForLineInBar = (
|
|
|
1046
1046
|
(currentBarWidth + (lineConfig.spacing ?? spacing)) * index +
|
|
1047
1047
|
lineConfig.shiftX -
|
|
1048
1048
|
lineConfig.dataPointsWidth / 2 -
|
|
1049
|
-
|
|
1049
|
+
4;
|
|
1050
1050
|
|
|
1051
1051
|
export const getYForLineInBar = (value, shiftY, containerHeight, maxValue) =>
|
|
1052
1052
|
containerHeight - shiftY - (value * containerHeight) / maxValue;
|
|
@@ -1069,11 +1069,13 @@ export const clone = obj => {
|
|
|
1069
1069
|
return temp;
|
|
1070
1070
|
};
|
|
1071
1071
|
|
|
1072
|
-
export const getLineConfigForBarChart = lineConfig => {
|
|
1072
|
+
export const getLineConfigForBarChart = (lineConfig, barInitialSpacing) => {
|
|
1073
1073
|
return {
|
|
1074
1074
|
initialSpacing:
|
|
1075
|
-
lineConfig.initialSpacing ??
|
|
1076
|
-
|
|
1075
|
+
lineConfig.initialSpacing ??
|
|
1076
|
+
barInitialSpacing ??
|
|
1077
|
+
defaultLineConfig.initialSpacing,
|
|
1078
|
+
spacing: lineConfig.spacing,
|
|
1077
1079
|
curved: lineConfig.curved || defaultLineConfig.curved,
|
|
1078
1080
|
curvature: lineConfig.curvature ?? defaultLineConfig.curvature,
|
|
1079
1081
|
curveType: lineConfig.curveType ?? defaultLineConfig.curveType,
|