react-native-gifted-charts 1.2.2 → 1.2.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut and Stacked Bar charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"files": [
|
|
@@ -25,6 +25,7 @@ type Props = {
|
|
|
25
25
|
|
|
26
26
|
item: itemType;
|
|
27
27
|
index: number;
|
|
28
|
+
label: String;
|
|
28
29
|
containerHeight?: number;
|
|
29
30
|
maxValue: number;
|
|
30
31
|
spacing?: number;
|
|
@@ -108,6 +109,8 @@ const RenderBars = (props: Props) => {
|
|
|
108
109
|
opacity,
|
|
109
110
|
animationDuration,
|
|
110
111
|
autoShiftLabels,
|
|
112
|
+
label,
|
|
113
|
+
labelTextStyle,
|
|
111
114
|
} = props;
|
|
112
115
|
|
|
113
116
|
const barMarginBottom =
|
|
@@ -527,8 +530,8 @@ const RenderBars = (props: Props) => {
|
|
|
527
530
|
/>
|
|
528
531
|
)}
|
|
529
532
|
{isAnimated
|
|
530
|
-
? renderAnimatedLabel(
|
|
531
|
-
: renderLabel(
|
|
533
|
+
? renderAnimatedLabel(label, labelTextStyle, item.value)
|
|
534
|
+
: renderLabel(label, labelTextStyle, item.value)}
|
|
532
535
|
</TouchableOpacity>
|
|
533
536
|
);
|
|
534
537
|
};
|
|
@@ -11,6 +11,7 @@ type Props = {
|
|
|
11
11
|
topLabelComponent?: Component;
|
|
12
12
|
topLabelContainerStyle?: Style;
|
|
13
13
|
opacity?: number;
|
|
14
|
+
label: String;
|
|
14
15
|
labelTextStyle?: any;
|
|
15
16
|
disablePress?: boolean;
|
|
16
17
|
|
|
@@ -66,6 +67,8 @@ const RenderStackBars = (props: Props) => {
|
|
|
66
67
|
spacing,
|
|
67
68
|
rotateLabel,
|
|
68
69
|
xAxisThickness,
|
|
70
|
+
label,
|
|
71
|
+
labelTextStyle,
|
|
69
72
|
} = props;
|
|
70
73
|
const disablePress = props.disablePress || false;
|
|
71
74
|
const renderLabel = (label: String, labelTextStyle: any) => {
|
|
@@ -246,7 +249,7 @@ const RenderStackBars = (props: Props) => {
|
|
|
246
249
|
/>
|
|
247
250
|
)}
|
|
248
251
|
{static2DSimple(item)}
|
|
249
|
-
{renderLabel(
|
|
252
|
+
{renderLabel(label || '', labelTextStyle)}
|
|
250
253
|
</View>
|
|
251
254
|
);
|
|
252
255
|
};
|
package/src/BarChart/index.tsx
CHANGED
|
@@ -119,6 +119,8 @@ type PropTypes = {
|
|
|
119
119
|
hideOrigin?: Boolean;
|
|
120
120
|
labelWidth?: number;
|
|
121
121
|
yAxisLabelTexts?: Array<string>;
|
|
122
|
+
xAxisLabelTexts?: Array<string>;
|
|
123
|
+
xAxisLabelTextStyle?: any;
|
|
122
124
|
yAxisLabelPrefix?: String;
|
|
123
125
|
yAxisLabelSuffix?: String;
|
|
124
126
|
autoShiftLabels?: Boolean;
|
|
@@ -1385,6 +1387,15 @@ export const BarChart = (props: PropTypes) => {
|
|
|
1385
1387
|
barBorderRadius={props.barBorderRadius}
|
|
1386
1388
|
barBackgroundPattern={props.barBackgroundPattern}
|
|
1387
1389
|
patternId={props.patternId}
|
|
1390
|
+
label={
|
|
1391
|
+
item.label ||
|
|
1392
|
+
(props.xAxisLabelTexts && props.xAxisLabelTexts[index]
|
|
1393
|
+
? props.xAxisLabelTexts[index]
|
|
1394
|
+
: '')
|
|
1395
|
+
}
|
|
1396
|
+
labelTextStyle={
|
|
1397
|
+
item.labelTextStyle || props.xAxisLabelTextStyle
|
|
1398
|
+
}
|
|
1388
1399
|
/>
|
|
1389
1400
|
);
|
|
1390
1401
|
})
|
|
@@ -1436,6 +1447,15 @@ export const BarChart = (props: PropTypes) => {
|
|
|
1436
1447
|
barBackgroundPattern={props.barBackgroundPattern}
|
|
1437
1448
|
patternId={props.patternId}
|
|
1438
1449
|
barMarginBottom={props.barMarginBottom}
|
|
1450
|
+
label={
|
|
1451
|
+
item.label ||
|
|
1452
|
+
(props.xAxisLabelTexts && props.xAxisLabelTexts[index]
|
|
1453
|
+
? props.xAxisLabelTexts[index]
|
|
1454
|
+
: '')
|
|
1455
|
+
}
|
|
1456
|
+
labelTextStyle={
|
|
1457
|
+
item.labelTextStyle || props.xAxisLabelTextStyle
|
|
1458
|
+
}
|
|
1439
1459
|
/>
|
|
1440
1460
|
))}
|
|
1441
1461
|
</Fragment>
|
package/src/LineChart/index.tsx
CHANGED
|
@@ -247,6 +247,8 @@ type propTypes = {
|
|
|
247
247
|
textShiftX?: number;
|
|
248
248
|
textShiftY?: number;
|
|
249
249
|
yAxisLabelTexts?: Array<string>;
|
|
250
|
+
xAxisLabelTexts?: Array<string>;
|
|
251
|
+
xAxisLabelTextStyle?: any;
|
|
250
252
|
width?: number;
|
|
251
253
|
yAxisLabelPrefix?: String;
|
|
252
254
|
yAxisLabelSuffix?: String;
|
|
@@ -254,6 +256,7 @@ type propTypes = {
|
|
|
254
256
|
scrollAnimation?: Boolean;
|
|
255
257
|
noOfSectionsBelowXAxis?: number;
|
|
256
258
|
labelsExtraHeight?: number;
|
|
259
|
+
adjustToWidth?: Boolean;
|
|
257
260
|
};
|
|
258
261
|
type referenceConfigType = {
|
|
259
262
|
thickness: number;
|
|
@@ -422,7 +425,15 @@ export const LineChart = (props: propTypes) => {
|
|
|
422
425
|
props.initialSpacing === 0 ? 0 : props.initialSpacing || 40;
|
|
423
426
|
const thickness = props.thickness || 2;
|
|
424
427
|
|
|
425
|
-
const
|
|
428
|
+
const adjustToWidth = props.adjustToWidth || false;
|
|
429
|
+
|
|
430
|
+
const spacing =
|
|
431
|
+
props.spacing === 0
|
|
432
|
+
? 0
|
|
433
|
+
: props.spacing ||
|
|
434
|
+
(adjustToWidth
|
|
435
|
+
? ((props.width || 200) - initialSpacing) / data.length
|
|
436
|
+
: 60);
|
|
426
437
|
|
|
427
438
|
const xAxisThickness = props.xAxisThickness || 1;
|
|
428
439
|
const dataPointsHeight1 =
|
|
@@ -2941,14 +2952,20 @@ export const LineChart = (props: propTypes) => {
|
|
|
2941
2952
|
{isAnimated
|
|
2942
2953
|
? renderAnimatedLabel(
|
|
2943
2954
|
index,
|
|
2944
|
-
item.label
|
|
2945
|
-
|
|
2955
|
+
item.label ||
|
|
2956
|
+
(props.xAxisLabelTexts && props.xAxisLabelTexts[index]
|
|
2957
|
+
? props.xAxisLabelTexts[index]
|
|
2958
|
+
: ''),
|
|
2959
|
+
item.labelTextStyle || props.xAxisLabelTextStyle,
|
|
2946
2960
|
item.labelComponent,
|
|
2947
2961
|
)
|
|
2948
2962
|
: renderLabel(
|
|
2949
2963
|
index,
|
|
2950
|
-
item.label
|
|
2951
|
-
|
|
2964
|
+
item.label ||
|
|
2965
|
+
(props.xAxisLabelTexts && props.xAxisLabelTexts[index]
|
|
2966
|
+
? props.xAxisLabelTexts[index]
|
|
2967
|
+
: ''),
|
|
2968
|
+
item.labelTextStyle || props.xAxisLabelTextStyle,
|
|
2952
2969
|
item.labelComponent,
|
|
2953
2970
|
)}
|
|
2954
2971
|
{/* {renderLabel(index, item.label, item.labelTextStyle)} */}
|