Skip to content

Commit 4c8de0f

Browse files
author
Emad-salah
authored
More control over the charts styling
I've just added more props for styling the other components in the chart in order to make it more customizable and suitable for other users (this is useful in cases such as where the user wants to make the inner circle thinner/wider or something like that)
1 parent 713a0d8 commit 4c8de0f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { View, Text } from 'react-native';
33
import PropTypes from 'prop-types';
44
import { getStyles } from './rules';
55

6-
const Speedometer = ({ value, totalValue, size, outerColor, innerColor, internalColor, style, showText, text, textStyle, showLabels, labelStyle, showPercent, percentStyle }) => {
6+
const Speedometer = ({ value, totalValue, size, outerColor, innerColor, internalColor, style, innerCircleStyle, outerCircleStyle, halfCircleStyle showText, text, textStyle, showLabels, labelStyle, showPercent, percentStyle }) => {
77
const styles = getStyles(size);
88
const degreesValue = (value > totalValue) ? totalValue : value;
99
const percentValue = parseInt(String((value * 100) / totalValue).split('.')[0]);
@@ -30,9 +30,9 @@ const Speedometer = ({ value, totalValue, size, outerColor, innerColor, internal
3030

3131
return (
3232
<View style={style}>
33-
<View style={[styles.outerCircle, { backgroundColor: outerColor }]}>
34-
<View style={[styles.halfCircle, degressStyle]}/>
35-
<View style={[styles.innerCircle, { backgroundColor: innerColor }]}>
33+
<View style={[styles.outerCircle, { backgroundColor: outerColor }, outerCircleStyle]}>
34+
<View style={[styles.halfCircle, degressStyle, halfCircleStyle]}/>
35+
<View style={[styles.innerCircle, { backgroundColor: innerColor }, innerCircleStyle]}>
3636
{percentElement}
3737
{textElement}
3838
</View>

0 commit comments

Comments
 (0)