Skip to content
Snippets Groups Projects
Commit a35d757f authored by Sofiya Tepikin's avatar Sofiya Tepikin
Browse files

Merge branch 'fix-chart-dots-and-lines' into 'rebased-redesign'

Fix chart dots and lines

See merge request bloodyhealth/drip!327
parents 17266d46 2fb20c00
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ import AppText from '../common/app-text' ...@@ -7,7 +7,7 @@ import AppText from '../common/app-text'
import cycleModule from '../../lib/cycle' import cycleModule from '../../lib/cycle'
import { getOrdinalSuffix } from '../helpers/home' import { getOrdinalSuffix } from '../helpers/home'
import { Containers, Typography } from '../../styles' import { Containers, Typography, Sizes } from '../../styles'
const CycleDayLabel = ({ height, date }) => { const CycleDayLabel = ({ height, date }) => {
const cycleDayNumber = cycleModule().getCycleDayNumber(date) const cycleDayNumber = cycleModule().getCycleDayNumber(date)
...@@ -50,7 +50,7 @@ const styles = StyleSheet.create({ ...@@ -50,7 +50,7 @@ const styles = StyleSheet.create({
}, },
text: { text: {
...Typography.label, ...Typography.label,
fontSize: 12 fontSize: Sizes.small,
}, },
textBold: { textBold: {
...Typography.labelBold ...Typography.labelBold
......
...@@ -40,14 +40,14 @@ export default class DotAndLine extends Component { ...@@ -40,14 +40,14 @@ export default class DotAndLine extends Component {
const middleY = ((leftY - y) / 2) + y const middleY = ((leftY - y) / 2) + y
excludeLeftLine = leftTemperatureExclude || exclude excludeLeftLine = leftTemperatureExclude || exclude
lineLeft = new Path() lineLeft = new Path()
.moveTo(CHART_COLUMN_MIDDLE - CHART_DOT_RADIUS, y) .moveTo(CHART_COLUMN_MIDDLE, y)
.lineTo(0, middleY) .lineTo(0, middleY)
} }
if (rightY) { if (rightY) {
const middleY = ((y - rightY) / 2) + rightY const middleY = ((y - rightY) / 2) + rightY
excludeRightLine = rightTemperatureExclude || exclude excludeRightLine = rightTemperatureExclude || exclude
lineRight = new Path() lineRight = new Path()
.moveTo(CHART_COLUMN_MIDDLE + CHART_DOT_RADIUS, y) .moveTo(CHART_COLUMN_MIDDLE, y)
.lineTo(CHART_COLUMN_WIDTH, middleY) .lineTo(CHART_COLUMN_WIDTH, middleY)
} }
...@@ -74,7 +74,13 @@ export default class DotAndLine extends Component { ...@@ -74,7 +74,13 @@ export default class DotAndLine extends Component {
strokeWidth={CHART_STROKE_WIDTH} strokeWidth={CHART_STROKE_WIDTH}
key={y + CHART_DOT_RADIUS} key={y + CHART_DOT_RADIUS}
/> />
<Shape d={dot} stroke={dotColor} strokeWidth={CHART_STROKE_WIDTH} key='dot' /> <Shape
d={dot}
stroke={dotColor}
strokeWidth={CHART_STROKE_WIDTH}
fill="white"
key='dot'
/>
</React.Fragment> </React.Fragment>
) )
} }
......
...@@ -28,13 +28,13 @@ Tick.propTypes = { ...@@ -28,13 +28,13 @@ Tick.propTypes = {
const text = { const text = {
right: 4,
lineHeight: Sizes.base, lineHeight: Sizes.base,
textAlign: 'right', right: 4,
textAlignVertical: 'center' textAlign: 'right'
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
justifyContent: 'center',
position: 'absolute', position: 'absolute',
right: 0, right: 0,
width: 40 width: 40
......
...@@ -7,8 +7,11 @@ import { getCycleDay, getAmountOfCycleDays } from '../../db' ...@@ -7,8 +7,11 @@ import { getCycleDay, getAmountOfCycleDays } from '../../db'
//YAxis helpers //YAxis helpers
export function normalizeToScale(temp, columnHeight) { export function normalizeToScale(temp, columnHeight) {
const scale = scaleObservable.value const unit = unitObservable.value
const valueRelativeToScale = (scale.max - temp) / (scale.max - scale.min) //Add 1 tick above the max value to display on chart
const scaleMax = scaleObservable.value.max + unit
const scaleMin = scaleObservable.value.min - unit
const valueRelativeToScale = (scaleMax - temp) / (scaleMax - scaleMin)
return getAbsoluteValue(valueRelativeToScale, columnHeight) return getAbsoluteValue(valueRelativeToScale, columnHeight)
} }
...@@ -286,4 +289,4 @@ export function nfpLines() { ...@@ -286,4 +289,4 @@ export function nfpLines() {
return ret return ret
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment