Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
3d12e5e4
Commit
3d12e5e4
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
try doing the math
parent
542394df
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/chart/config.js
+1
-1
1 addition, 1 deletion
components/chart/config.js
components/chart/day-column.js
+45
-43
45 additions, 43 deletions
components/chart/day-column.js
with
46 additions
and
44 deletions
components/chart/config.js
+
1
−
1
View file @
3d12e5e4
...
@@ -5,7 +5,7 @@ const config = {
...
@@ -5,7 +5,7 @@ const config = {
low
:
35
,
low
:
35
,
high
:
40
high
:
40
},
},
xAxisRangeInDays
:
5
0
xAxisRangeInDays
:
100
0
}
}
const
margin
=
3
const
margin
=
3
...
...
This diff is collapsed.
Click to expand it.
components/chart/day-column.js
+
45
−
43
View file @
3d12e5e4
...
@@ -9,7 +9,7 @@ import { getOrCreateCycleDay } from '../../db'
...
@@ -9,7 +9,7 @@ import { getOrCreateCycleDay } from '../../db'
import
cycleModule
from
'
../../lib/cycle
'
import
cycleModule
from
'
../../lib/cycle
'
import
setUpFertilityStatusFunc
from
'
./nfp-lines
'
import
setUpFertilityStatusFunc
from
'
./nfp-lines
'
import
{
horizontalGrid
}
from
'
./y-axis
'
import
{
horizontalGrid
}
from
'
./y-axis
'
import
slowlog
from
'
react-native-slowlog
'
//
import slowlog from 'react-native-slowlog'
const
getCycleDayNumber
=
cycleModule
().
getCycleDayNumber
const
getCycleDayNumber
=
cycleModule
().
getCycleDayNumber
const
label
=
styles
.
column
.
label
const
label
=
styles
.
column
.
label
...
@@ -18,7 +18,7 @@ const getFhmAndLtlInfo = setUpFertilityStatusFunc()
...
@@ -18,7 +18,7 @@ const getFhmAndLtlInfo = setUpFertilityStatusFunc()
export
default
class
DayColumn
extends
Component
{
export
default
class
DayColumn
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
slowlog
(
this
,
/.*/
,
{
threshold
:
30
})
//
slowlog(this, /.*/, {threshold: 30})
}
}
makeDayColumn
(
data
,
index
)
{
makeDayColumn
(
data
,
index
)
{
const
{
const
{
...
@@ -68,8 +68,6 @@ export default class DayColumn extends Component {
...
@@ -68,8 +68,6 @@ export default class DayColumn extends Component {
// /> : null}
// /> : null}
// />)
// />)
// onPress: () => this.passDateToDayView(dateString),
// <Path {...styles.bleedingIcon}
// <Path {...styles.bleedingIcon}
// d="M15 3
// d="M15 3
// Q16.5 6.8 25 18
// Q16.5 6.8 25 18
...
@@ -87,7 +85,7 @@ export default class DayColumn extends Component {
...
@@ -87,7 +85,7 @@ export default class DayColumn extends Component {
// /> : null}
// /> : null}
if
(
y
)
{
if
(
y
)
{
columnElements
.
push
(
this
.
drawDotAndLine
s
(
y
,
temperatureExclude
,
index
))
columnElements
.
push
(
...
this
.
drawDotAndLine
(
y
,
temperatureExclude
,
index
))
}
}
// {cycleDay && cycleDay.mucus ?
// {cycleDay && cycleDay.mucus ?
// <Circle
// <Circle
...
@@ -114,55 +112,59 @@ export default class DayColumn extends Component {
...
@@ -114,55 +112,59 @@ export default class DayColumn extends Component {
)
)
}
}
drawDotAndLines
(
currY
,
exclude
)
{
drawDotAndLine
(
currY
,
exclude
)
{
/* <View
width='150%'
borderStyle = 'solid'
borderColor = 'red'
borderWidth = {1}
position = 'absolute'
top={200}
style={{
transform: [{rotateZ: '30deg'}]
}}
/>
) */
let
lineToRight
let
lineToRight
let
lineToLeft
let
lineToLeft
/*
function makeLine(
otherColY, x
, excludeLine) {
function
makeLine
(
leftY
,
rightY
,
leftX
,
excludeLine
)
{
const
middleY = ((otherColY - currY) / 2) + curr
Y
const
heightDiff
=
leftY
-
right
Y
const
target = [x, middleY]
const
angle
=
Math
.
atan2
(
config
.
columnWidth
,
heightDiff
)
const
lineStyle
=
excludeLine
?
styles
.
curveExcluded
:
styles
.
curve
const
lineStyle
=
excludeLine
?
styles
.
curveExcluded
:
styles
.
curve
// hypotenuse
return <Line
const
h
=
(
config
.
columnWidth
/
2
)
/
Math
.
cos
(
angle
)
x1={config.columnMiddle}
const
neededDiff
=
Math
.
sin
(
Math
.
PI
-
(
angle
+
Math
.
PI
/
2
))
*
(
h
/
2
)
y1={currY}
const
projectedX
=
leftX
-
((
h
/
2
)
-
neededDiff
)
x2={target[0]}
console
.
log
(
leftX
)
y2={target[1]}
console
.
log
(
projectedX
)
return
(
<
View
width
=
{
h
}
position
=
'
absolute
'
top
=
{(
leftY
+
rightY
)
/
2
}
left
=
{
projectedX
}
style
=
{{
// the rotation by default rotates from the middle of the line,
// but we want the transform origin to be at its beginning
// react native doesn't have transformOrigin, so we do this manually
transform
:
[
{
rotateZ
:
`
${
angle
}
rad`
}
],
}}
{...
lineStyle
}
{...
lineStyle
}
/>
/>
)
} */
/* if (this.props.rightY) {
const excludedLine = this.props.rightTemperatureExclude || exclude
lineToRight = makeLine(this.props.rightY, config.columnWidth, excludedLine)
}
}
if
(
this
.
props
.
leftY
)
{
if
(
this
.
props
.
leftY
)
{
const
middleY
=
((
this
.
props
.
leftY
-
currY
)
/
2
)
+
currY
const
excludedLine
=
this
.
props
.
leftTemperatureExclude
||
exclude
const
excludedLine
=
this
.
props
.
leftTemperatureExclude
||
exclude
lineToLeft = makeLine(this.props.leftY, 0, excludedLine)
lineToLeft
=
makeLine
(
middleY
,
currY
,
0
,
excludedLine
)
} */
}
if
(
this
.
props
.
rightY
)
{
const
middleY
=
((
currY
-
this
.
props
.
rightY
)
/
2
)
+
this
.
props
.
rightY
const
excludedLine
=
this
.
props
.
rightTemperatureExclude
||
exclude
lineToRight
=
makeLine
(
currY
,
middleY
,
config
.
columnMiddle
,
excludedLine
)
}
const
dotStyle
=
exclude
?
styles
.
curveDotsExcluded
:
styles
.
curveDots
const
dotStyle
=
exclude
?
styles
.
curveDotsExcluded
:
styles
.
curveDots
/* return (<G>
const
dot
=
(
{lineToRight}
<
View
{lineToLeft}
position
=
'
absolute
'
<Circle
top
=
{
currY
-
(
dotStyle
.
height
/
2
)}
cx={config.columnMiddle}
left
=
{
config
.
columnMiddle
-
(
dotStyle
.
width
/
2
)}
cy={currY}
style
=
{
dotStyle
}
{...dotStyle}
/
>
/
>
</G>) */
)
return
[
lineToLeft
,
lineToRight
,
dot
]
}
}
passDateToDayView
(
dateString
)
{
passDateToDayView
(
dateString
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment