changes y-ticks and labels, cycle day display and colors of symbols

This commit is contained in:
tina
2018-09-03 20:21:05 +02:00
parent dd380cf9ba
commit 4d5658119a
5 changed files with 62 additions and 27 deletions
+2 -2
View File
@@ -73,7 +73,7 @@ export default class DayColumn extends Component {
const shortDate = dateString.split('-').slice(1).join('-')
const cycleDayLabel = (
<Text style={label.number}>
{cycleDayNumber}
{cycleDayNumber ? cycleDayNumber : ' '}
</Text>)
const dateLabel = (
<Text style = {label.date}>
@@ -120,7 +120,7 @@ export default class DayColumn extends Component {
<Icon
name='drop'
size={18}
color='#900'
color={styles.bleedingIconShades[bleeding]}
key='bleeding'
/>
}
+27 -19
View File
@@ -1,26 +1,33 @@
import config from '../../config'
import {primaryColor, shadesOfRed} from '../../styles/index'
const colorTemperatur = '#765285'
const colorTemperaturLight = '#a67fb5'
const dotWidth = 10
const lineWidth = 2
const colorLtl = '#feb47b'
const styles = {
curve: {
borderStyle: 'solid',
borderColor: '#ffc425',
borderWidth: 2,
borderColor: colorTemperatur,
borderWidth: lineWidth,
},
curveExcluded: {
borderColor: 'lightgrey',
borderWidth: 2,
borderStyle: 'solid'
borderColor: colorTemperaturLight,
borderWidth: lineWidth,
borderStyle: 'dotted'
},
curveDots: {
backgroundColor: '#00aedb',
width: 12,
height: 12,
backgroundColor: colorTemperatur,
width: dotWidth,
height: dotWidth,
borderRadius: 50
},
curveDotsExcluded: {
backgroundColor: 'lightgrey',
width: 12,
height: 12,
backgroundColor: colorTemperaturLight,
width: dotWidth,
height: dotWidth,
borderRadius: 50
},
column: {
@@ -31,7 +38,7 @@ const styles = {
fontWeight: '100'
},
number: {
color: '#00b159',
color: primaryColor,
fontSize: 13,
textAlign: 'center'
}
@@ -49,17 +56,18 @@ const styles = {
x: 6,
y: 3
},
bleedingIconShades: shadesOfRed,
mucusIcon: {
width: 12,
height: 12,
borderRadius: 50,
},
mucusIconShades: [
'#cc99cc',
'#bf7fbf',
'#b266b2',
'#a64ca6',
'#993299'
'#fef0e4',
'#fee1ca',
'#fed2af',
'#fec395',
'#feb47b'
],
yAxis: {
width: config.columnWidth,
@@ -83,8 +91,8 @@ const styles = {
left: config.columnWidth
},
nfpLine: {
borderColor: '#00b159',
borderWidth: 2,
borderColor: colorLtl,
borderWidth: lineWidth,
borderStyle: 'solid'
},
symptomRow: {
+28 -4
View File
@@ -7,18 +7,35 @@ import { scaleObservable } from '../../local-storage'
export function makeYAxisLabels(columnHeight) {
const units = config.temperatureScale.units
const scaleMax = scaleObservable.value.max
const scaleMin = scaleObservable.value.min
const style = styles.yAxisLabel
return getTickPositions(columnHeight).map((y, i) => {
// this eyeballing is sadly necessary because RN does not
// support percentage values for transforms, which we'd need
// to reliably place the label vertically centered to the grid
if (scaleMax - i * units === 37) console.log(y)
let tickLabelDistance
let tickUnit
if (scaleMax - scaleMin <= 3) {
tickLabelDistance = 2
tickUnit = 1
} else if (scaleMax - scaleMin <= 5) {
tickLabelDistance = 2
tickUnit = 2
} else {
tickLabelDistance = 5
tickUnit = 5
}
if (scaleMax - i * tickUnit * units === 37) console.log(y)
const tick = scaleMax - i * tickUnit * units
const tickLabel = tick * 10 % 10 ? tick.toString() : tick.toString() + '.0'
const showTick = tick * 10 % tickLabelDistance ? false : true
const tickBold = tick * 10 % 5 ? {} : {fontWeight: 'bold'}
return (
<Text
style={[style, {top: y - 8}]}
style={[style, {top: y - 8}, tickBold]}
key={i}>
{scaleMax - i * units}
{showTick && tickLabel}
</Text>
)
})
@@ -41,7 +58,14 @@ function getTickPositions(columnHeight) {
const scaleMin = scaleObservable.value.min
const scaleMax = scaleObservable.value.max
const numberOfTicks = (scaleMax - scaleMin) * (1 / units) + 1
const tickDistance = 1 / (numberOfTicks - 1)
let tickDistance
if (numberOfTicks <= 31) {
tickDistance = 1 / (numberOfTicks - 1)
} else if (numberOfTicks <= 51) {
tickDistance = 2 / (numberOfTicks - 1)
} else {
tickDistance = 5 / (numberOfTicks - 1)
}
const tickPositions = []
for (let i = 0; i < numberOfTicks; i++) {