react-native-chart
react-native-chart copied to clipboard
Line in chart not showing
On OS X El Capitan version 10.11.5 (15F34)
node --version v6.0.0 nam --v v6.2.2 react-native-cli: 1.0.0 react-native: 0.28.0 watchman --v 4.5.0 xcode 7.3.1
I have this code using react-native-chart:
const styles = StyleSheet.create({
parent: {
flex: 1,
backgroundColor: colors.MAIN_BACKGROUND_COLOR
},
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
chart: {
width: 300,
height: 300
}
});
progression = [[0,1], [1,3], [3,7], [4,9], [5, -10]];
return (
<View style={styles.parent}>
<View style={styles.container}>
<Chart
style={styles.chart}
data={progression}
type="line"
/>
</View>
</View>);
The problem is that the axis are displayed fine but the line with the progression is not displayed. If I change the type to "bar" or "pie" works fine, but not for "line".
Still having this problem. I'm using react-native-chart version 1.0.8-beta.
When I have line type this is the result of the chart (no line showing):
But if I change to bar type, this is the result:
+1, i'm having the same issue.
Hey Laura,
After looking at other open issues I found something that works!
<Chart
style={styles.chart}
data={data}
verticalGridStep={5}
showDataPoint={true}
type="line"
/>
Looks like showDataPoint is false by default, if you set it to true explicitly it'll render on iOS. It'll be a good workaround for now
I'll be on a plane tomorrow, so I'll have time to investigate these issues. Thanks.
@anthonyalayo it's working with showDataPoint={true} as you said so thank you very much. @tomauty thank you for your work in this project
As a generic FYI — I am no longer able to maintain this library. I recommend checking out victory-native as it's much more maintained.