extends y-axis with placeholders for symptom symbols and date labels
This commit is contained in:
@@ -137,6 +137,7 @@ export default class CycleChart extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
console.log(this.symptomRowSymptoms)
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
onLayout={this.onLayout}
|
onLayout={this.onLayout}
|
||||||
@@ -149,15 +150,54 @@ export default class CycleChart extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{this.state.chartHeight && this.state.chartLoaded &&
|
{this.state.chartHeight && this.state.chartLoaded &&
|
||||||
|
<View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
styles.yAxis,
|
||||||
|
{
|
||||||
|
height: this.symptomRowHeight,
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{this.symptomRowSymptoms.map(symptomName => {
|
||||||
|
return <View key={symptomName} style={{flex: 1}}>
|
||||||
|
<AppText>{symptomName[0]}</AppText>
|
||||||
|
</View>
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</View>
|
||||||
<View
|
<View
|
||||||
style={[styles.yAxis, {
|
style={[styles.yAxis, {
|
||||||
height: this.columnHeight,
|
height: this.columnHeight,
|
||||||
marginTop: this.symptomRowHeight
|
|
||||||
}]}
|
}]}
|
||||||
>
|
>
|
||||||
{makeYAxisLabels(this.columnHeight)}
|
{makeYAxisLabels(this.columnHeight)}
|
||||||
|
</View>
|
||||||
|
<View style={[
|
||||||
|
styles.yAxis,
|
||||||
|
{
|
||||||
|
height: this.xAxisHeight
|
||||||
|
}
|
||||||
|
]}>
|
||||||
|
<AppText style = {[
|
||||||
|
styles.column.label.number,
|
||||||
|
{
|
||||||
|
textAlign: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
fontSize: Math.ceil(styles.column.label.number.fontSize / 2)
|
||||||
|
}
|
||||||
|
]}>{'Cycle\nday'}</AppText>
|
||||||
|
<AppText style={[
|
||||||
|
styles.column.label.date,
|
||||||
|
{
|
||||||
|
textAlign: 'center',
|
||||||
|
justifyContent: 'center'
|
||||||
|
}
|
||||||
|
]}>{'Date'}</AppText>
|
||||||
|
</View>
|
||||||
</View>}
|
</View>}
|
||||||
|
|
||||||
|
|
||||||
{this.state.chartHeight && this.state.chartLoaded &&
|
{this.state.chartHeight && this.state.chartLoaded &&
|
||||||
makeHorizontalGrid(this.columnHeight, this.symptomRowHeight)
|
makeHorizontalGrid(this.columnHeight, this.symptomRowHeight)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,15 +69,15 @@ const styles = {
|
|||||||
],
|
],
|
||||||
yAxis: {
|
yAxis: {
|
||||||
width: 27,
|
width: 27,
|
||||||
borderRightWidth: 0.5,
|
borderRightWidth: 1,
|
||||||
borderColor: 'lightgrey',
|
borderColor: 'lightgrey',
|
||||||
borderStyle: 'solid'
|
borderStyle: 'solid'
|
||||||
},
|
},
|
||||||
yAxisLabel: {
|
yAxisLabel: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
left: 3,
|
right: 2,
|
||||||
color: 'grey',
|
color: 'grey',
|
||||||
fontSize: 11,
|
fontSize: 9,
|
||||||
textAlign: 'left'
|
textAlign: 'left'
|
||||||
},
|
},
|
||||||
horizontalGrid: {
|
horizontalGrid: {
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ export function makeYAxisLabels(columnHeight) {
|
|||||||
let tickBold
|
let tickBold
|
||||||
if (units === 0.1) {
|
if (units === 0.1) {
|
||||||
showTick = (tick * 10 % 2) ? false : true
|
showTick = (tick * 10 % 2) ? false : true
|
||||||
tickBold = tick * 10 % 5 ? {} : {fontWeight: 'bold'}
|
tickBold = tick * 10 % 5 ? {} : {fontWeight: 'bold', fontSize: 11}
|
||||||
} else {
|
} else {
|
||||||
showTick = (tick * 10 % 5) ? false : true
|
showTick = (tick * 10 % 5) ? false : true
|
||||||
tickBold = tick * 10 % 10 ? {} : {fontWeight: 'bold'}
|
tickBold = tick * 10 % 10 ? {} : {fontWeight: 'bold', fontSize: 11}
|
||||||
}
|
}
|
||||||
// this eyeballing is sadly necessary because RN does not
|
// this eyeballing is sadly necessary because RN does not
|
||||||
// support percentage values for transforms, which we'd need
|
// support percentage values for transforms, which we'd need
|
||||||
|
|||||||
Reference in New Issue
Block a user