React Base Fiddle (JSX)
Starting point for creating JSFiddles with React.
HTML
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<!--ahmeturganci-->
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
Babel + JSX
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
FlatList,
Dimensions
} from 'react-native';
import Data from './data'
var service = new Data()
import {
LineChart,
} from 'react-native-chart-kit';
export default class App extends Component {
constructor(props) {
super(props)
this.state = {
records: []
}
}
render() {
return (
<View style={styles.container}>
<LineChart
onDataPointClick={()=>{console.log('masoud')}}
data={{
labels: ['January', 'February', 'March', 'April', 'May', 'June'],
datasets: [{
data: [
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100
]
}]
}}
width={Dimensions.get('window').width} // from react-native
height={Dimensions.get('window').height}
height={220}
chartConfig={{
backgroundColor: '#e26a00',
backgroundGradientFrom: '#fb8c00',
backgroundGradientTo: '#ffa726',
decimalPlaces: 2, // optional, defaults to 2dp
color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
style: {
borderRadius: 16
}
}}
style={{
}}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});