From 1ccc363678c7f175c2437efcac946e1511cec7a9 Mon Sep 17 00:00:00 2001 From: Julia Friesel <julia.friesel@gmail.com> Date: Sat, 11 Aug 2018 19:22:13 +0200 Subject: [PATCH] Re-add fhm line --- components/chart/chart.js | 30 +++++++++++++++--------------- components/chart/config.js | 2 +- components/chart/day-column.js | 33 ++++++++++++++------------------- components/chart/styles.js | 2 +- 4 files changed, 31 insertions(+), 36 deletions(-) diff --git a/components/chart/chart.js b/components/chart/chart.js index 9393407b..dcc5be84 100644 --- a/components/chart/chart.js +++ b/components/chart/chart.js @@ -10,21 +10,6 @@ import config from './config' const yAxisView = <View {...styles.yAxis}>{yAxis.labels}</View> -function getInfoForNeighborColumns(index, cols) { - const ret = {} - const right = index > 0 ? cols[index - 1] : undefined - const left = index < cols.length - 1 ? cols[index + 1] : undefined - if (right && right.y) { - ret.rightY = right.y - ret.rightTemperatureExclude = right.temperatureExclude - } - if (left && left.y) { - ret.leftY = left.y - ret.leftTemperatureExclude = left.temperatureExclude - } - return ret -} - export default class CycleChart extends Component { constructor(props) { super(props) @@ -109,4 +94,19 @@ function getPreviousDays(n) { const earlierDate = new Date(today - (range.DAY * n)) return range(earlierDate, today).reverse() +} + +function getInfoForNeighborColumns(index, cols) { + const ret = {} + const right = index > 0 ? cols[index - 1] : undefined + const left = index < cols.length - 1 ? cols[index + 1] : undefined + if (right && right.y) { + ret.rightY = right.y + ret.rightTemperatureExclude = right.temperatureExclude + } + if (left && left.y) { + ret.leftY = left.y + ret.leftTemperatureExclude = left.temperatureExclude + } + return ret } \ No newline at end of file diff --git a/components/chart/config.js b/components/chart/config.js index 573ff2bb..39d8a51b 100644 --- a/components/chart/config.js +++ b/components/chart/config.js @@ -3,7 +3,7 @@ const config = { columnWidth: 30, temperatureScale: { low: 35, - high: 40 + high: 38 }, xAxisRangeInDays: 1000 } diff --git a/components/chart/day-column.js b/components/chart/day-column.js index 299db751..325960bb 100644 --- a/components/chart/day-column.js +++ b/components/chart/day-column.js @@ -9,7 +9,7 @@ import { getOrCreateCycleDay } from '../../db' import cycleModule from '../../lib/cycle' import setUpFertilityStatusFunc from './nfp-lines' import { horizontalGrid } from './y-axis' -//import slowlog from 'react-native-slowlog' +// import slowlog from 'react-native-slowlog' const getCycleDayNumber = cycleModule().getCycleDayNumber const label = styles.column.label @@ -18,7 +18,7 @@ const getFhmAndLtlInfo = setUpFertilityStatusFunc() export default class DayColumn extends Component { constructor(props) { super(props) - //slowlog(this, /.*/, {threshold: 30}) + // slowlog(this, /.*/, {threshold: 30}) } makeDayColumn(data, index) { const { @@ -58,22 +58,18 @@ export default class DayColumn extends Component { ) } columnElements.push(cycleDayLabel, dateLabel, horizontalGrid) - // {nfpLineInfo.drawFhmLine ? - // <Line - // x1={0 + styles.nfpLine.strokeWidth / 2} - // y1="20" - // x2={0 + styles.nfpLine.strokeWidth / 2} - // y2={config.chartHeight - 20} - // {...styles.nfpLine} - // /> : null} - // />) - // <Path {...styles.bleedingIcon} - // d="M15 3 - // Q16.5 6.8 25 18 - // A12.8 12.8 0 1 1 5 18 - // Q13.5 6.8 15 3z" /> - // : null} + if(nfpLineInfo.drawFhmLine) { + console.log('jappens') + const fhmLine = (<View + position = 'absolute' + top={100} + width={styles.nfpLine.strokeWidth} + height={200} + {...styles.nfpLine} + />) + columnElements.push(fhmLine) + } // {nfpLineInfo.drawLtlAt ? // <Line @@ -105,8 +101,7 @@ export default class DayColumn extends Component { onPress: () => { this.passDateToDayView(dateString) }, - activeOpacity: 0., - + activeOpacity: 0.8 }, columnElements ) diff --git a/components/chart/styles.js b/components/chart/styles.js index c7be9805..6c7fb81b 100644 --- a/components/chart/styles.js +++ b/components/chart/styles.js @@ -82,7 +82,7 @@ const styles = { borderStyle: 'solid' }, nfpLine: { - stroke: '#00b159', + backgroundColor: '#00b159', strokeWidth: 3 } } -- GitLab