Skip to content

Instantly share code, notes, and snippets.

@marshallmurphy
Created April 18, 2020 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshallmurphy/03554abeade8f1f22fff2e5f4c831572 to your computer and use it in GitHub Desktop.
Save marshallmurphy/03554abeade8f1f22fff2e5f4c831572 to your computer and use it in GitHub Desktop.
// BarGraph/index.js
import React from 'react';
import { StyleSheet, Text, View, Dimensions } from 'react-native';
import Columns from './Columns';
import XAxis from './xAxis';
import YAxis from './yAxis';
export default function BarGraph({ data, color }) {
let width = Dimensions.get('screen').width;
let yAxisHeight = 325;
let xAxisHeight = 30;
let barsHeight = 315;
return (
<View style={styles.main}>
<YAxis
height={yAxisHeight}
width={width} />
<Columns
data={data}
width={width - 10}
height={barsHeight}
color={color} />
<XAxis
width={width - 10}
height={xAxisHeight} />
</View>
);
}
const styles = StyleSheet.create({
main: {
marginVertical: 25,
marginHorizontal: 0,
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment