react-native-gifted-charts 1.2.34 → 1.2.35

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.34",
3
+ "version": "1.2.35",
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": [
@@ -1,5 +1,6 @@
1
1
  import React, {Component} from 'react';
2
2
  import {View, TouchableOpacity, Text, ColorValue} from 'react-native';
3
+ import LinearGradient from 'react-native-linear-gradient';
3
4
  import Svg, {Defs, Rect} from 'react-native-svg';
4
5
  import {Style} from 'util';
5
6
 
@@ -41,6 +42,8 @@ type Props = {
41
42
  selectedIndex: number;
42
43
  setSelectedIndex: Function;
43
44
  activeOpacity: number;
45
+ showGradient?: Boolean;
46
+ gradientColor?: any;
44
47
  stackData: Array<itemType>;
45
48
  };
46
49
  type itemType = {
@@ -53,6 +56,9 @@ type itemType = {
53
56
  topLabelComponent?: Function;
54
57
  topLabelContainerStyle?: any;
55
58
  disablePress?: any;
59
+ color?: ColorValue;
60
+ showGradient?: Boolean;
61
+ gradientColor?: any;
56
62
  capThickness?: number;
57
63
  capColor?: ColorValue;
58
64
  capRadius?: number;
@@ -60,6 +66,7 @@ type itemType = {
60
66
  borderRadius?: number;
61
67
  stacks?: Array<any>;
62
68
  barBackgroundPattern?: Function;
69
+ barBorderRadius?: Number;
63
70
  patternId?: String;
64
71
  };
65
72
  const RenderStackBars = (props: Props) => {
@@ -179,7 +186,7 @@ const RenderStackBars = (props: Props) => {
179
186
  (Math.abs(stackItem.value) * (containerHeight || 200)) /
180
187
  (maxValue || 200) -
181
188
  (stackItem.marginBottom || 0),
182
- backgroundColor: stackItem.color || 'black',
189
+ backgroundColor: stackItem.color || props.color || 'black',
183
190
  borderRadius:
184
191
  stackItem.borderRadius || props.barBorderRadius || 0,
185
192
  },
@@ -193,6 +200,33 @@ const RenderStackBars = (props: Props) => {
193
200
  stackItem.borderBottomRightRadius || 0,
194
201
  },
195
202
  ]}>
203
+ {stackItem.showGradient ||
204
+ item.showGradient ||
205
+ props.showGradient ? (
206
+ <LinearGradient
207
+ style={[
208
+ {
209
+ position: 'absolute',
210
+ width: '100%',
211
+ height: '100%',
212
+ borderRadius:
213
+ stackItem.barBorderRadius ||
214
+ item.barBorderRadius ||
215
+ props.barBorderRadius ||
216
+ 0,
217
+ },
218
+ ]}
219
+ start={{x: 0, y: 0}}
220
+ end={{x: 0, y: 1}}
221
+ colors={[
222
+ stackItem.gradientColor ||
223
+ item.gradientColor ||
224
+ props.gradientColor ||
225
+ 'white',
226
+ stackItem.color || item.color || props.color || 'black',
227
+ ]}
228
+ />
229
+ ) : null}
196
230
  {stackItem.innerBarComponent && stackItem.innerBarComponent()}
197
231
  </TouchableOpacity>
198
232
  );
@@ -113,6 +113,7 @@ type PropTypes = {
113
113
  disablePress?: boolean;
114
114
 
115
115
  frontColor?: ColorValue;
116
+ color?: ColorValue;
116
117
  sideColor?: ColorValue;
117
118
  topColor?: ColorValue;
118
119
  gradientColor?: ColorValue;
@@ -1521,6 +1522,9 @@ export const BarChart = (props: PropTypes) => {
1521
1522
  horizontal={horizontal}
1522
1523
  intactTopLabel={intactTopLabel}
1523
1524
  barBorderRadius={props.barBorderRadius}
1525
+ color={props.color}
1526
+ showGradient={props.showGradient}
1527
+ gradientColor={props.gradientColor}
1524
1528
  barBackgroundPattern={props.barBackgroundPattern}
1525
1529
  patternId={props.patternId}
1526
1530
  label={
package/src/todos.md CHANGED
@@ -1,6 +1,7 @@
1
1
  ## Features
2
2
 
3
3
  1. Fix the issue with pointers in Line/Area charts on Android https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/177
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
 
@@ -14,6 +15,7 @@
14
15
  8. Prepare a doc for xAxisLabelTexts and xAxisLabelTextStyle in Bar, Line And Area Charts
15
16
  9. Prepare a doc for vertical lines to explain noOfVerticalLines and verticalLinesSpacing props. https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/205
16
17
  10. Prepare a doc for negative marginBottom instead of marginTop for x axis labels. https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/190
18
+ 11. Prepare a doc for LineChartBicolor https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/221
17
19
 
18
20
 
19
21
  ## Architecture Enhancement