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
71e4c6d1
Commit
71e4c6d1
authored
5 years ago
by
mashazyu
Browse files
Options
Downloads
Patches
Plain Diff
Introduces ChartLine component
parent
03a235d8
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/chart-line.js
+28
-0
28 additions, 0 deletions
components/chart/chart-line.js
components/chart/day-column.js
+12
-24
12 additions, 24 deletions
components/chart/day-column.js
with
40 additions
and
24 deletions
components/chart/chart-line.js
0 → 100644
+
28
−
0
View file @
71e4c6d1
import
React
from
'
react
'
import
PropTypes
from
'
prop-types
'
import
{
Shape
}
from
'
react-native/Libraries/ART/ReactNativeART
'
import
styles
from
'
./styles
'
const
ChartLine
=
({
path
,
isNfpLine
=
false
})
=>
{
const
strokeStyle
=
isNfpLine
?
styles
.
nfpLine
.
stroke
:
styles
.
column
.
stroke
.
color
const
strokeWidth
=
isNfpLine
?
styles
.
nfpLine
.
strokeWidth
:
styles
.
column
.
stroke
.
width
return
(
<
Shape
stroke
=
{
strokeStyle
}
strokeWidth
=
{
strokeWidth
}
d
=
{
path
}
/
>
)
}
ChartLine
.
propTypes
=
{
path
:
PropTypes
.
object
,
isNfpLine
:
PropTypes
.
bool
,
}
export
default
ChartLine
This diff is collapsed.
Click to expand it.
components/chart/day-column.js
+
12
−
24
View file @
71e4c6d1
...
@@ -4,9 +4,7 @@ import {
...
@@ -4,9 +4,7 @@ import {
}
from
'
react-native
'
}
from
'
react-native
'
import
{
import
{
Surface
,
Surface
,
Group
as
G
,
Path
Path
,
Shape
}
from
'
react-native/Libraries/ART/ReactNativeART
'
}
from
'
react-native/Libraries/ART/ReactNativeART
'
import
{
connect
}
from
'
react-redux
'
import
{
connect
}
from
'
react-redux
'
...
@@ -21,6 +19,7 @@ import { getCycleDay } from '../../db'
...
@@ -21,6 +19,7 @@ import { getCycleDay } from '../../db'
import
DotAndLine
from
'
./dot-and-line
'
import
DotAndLine
from
'
./dot-and-line
'
import
SymptomCell
from
'
./symptom-cell
'
import
SymptomCell
from
'
./symptom-cell
'
import
ChartLine
from
'
./chart-line
'
import
{
normalizeToScale
}
from
'
../helpers/chart
'
import
{
normalizeToScale
}
from
'
../helpers/chart
'
...
@@ -151,13 +150,12 @@ class DayColumn extends Component {
...
@@ -151,13 +150,12 @@ class DayColumn extends Component {
xAxisHeight
}
=
this
.
props
xAxisHeight
}
=
this
.
props
if
(
this
.
fhmAndLtl
.
drawLtlAt
)
{
if
(
this
.
fhmAndLtl
.
drawLtlAt
)
{
const
ltlLine
=
(
<
Shape
const
ltlLine
=
(
<
ChartLine
stroke
=
{
styles
.
nfpLine
.
stroke
}
path
=
{
new
Path
()
strokeWidth
=
{
styles
.
nfpLine
.
strokeWidth
}
d
=
{
new
Path
()
.
moveTo
(
0
,
this
.
fhmAndLtl
.
drawLtlAt
)
.
moveTo
(
0
,
this
.
fhmAndLtl
.
drawLtlAt
)
.
lineTo
(
config
.
columnWidth
,
this
.
fhmAndLtl
.
drawLtlAt
)
.
lineTo
(
config
.
columnWidth
,
this
.
fhmAndLtl
.
drawLtlAt
)
}
}
isNfpLine
=
{
true
}
key
=
'
ltl
'
key
=
'
ltl
'
/>
)
/>
)
columnElements
.
push
(
ltlLine
)
columnElements
.
push
(
ltlLine
)
...
@@ -165,11 +163,9 @@ class DayColumn extends Component {
...
@@ -165,11 +163,9 @@ class DayColumn extends Component {
if
(
this
.
fhmAndLtl
.
drawFhmLine
)
{
if
(
this
.
fhmAndLtl
.
drawFhmLine
)
{
const
x
=
styles
.
nfpLine
.
strokeWidth
/
2
const
x
=
styles
.
nfpLine
.
strokeWidth
/
2
const
fhmLine
=
(
<
Shape
const
fhmLine
=
(
<
ChartLine
fill
=
"
red
"
path
=
{
new
Path
().
moveTo
(
x
,
x
).
lineTo
(
x
,
columnHeight
)}
stroke
=
{
styles
.
nfpLine
.
stroke
}
isNfpLine
=
{
true
}
strokeWidth
=
{
styles
.
nfpLine
.
strokeWidth
}
d
=
{
new
Path
().
moveTo
(
x
,
x
).
lineTo
(
x
,
columnHeight
)}
key
=
'
fhm
'
key
=
'
fhm
'
/>
)
/>
)
columnElements
.
push
(
fhmLine
)
columnElements
.
push
(
fhmLine
)
...
@@ -215,17 +211,6 @@ class DayColumn extends Component {
...
@@ -215,17 +211,6 @@ class DayColumn extends Component {
<
/Text
>
<
/Text
>
)
)
const
column
=
(
<
G
>
<
Shape
stroke
=
{
styles
.
column
.
stroke
.
color
}
strokeWidth
=
{
styles
.
column
.
stroke
.
width
}
d
=
{
new
Path
().
lineTo
(
0
,
chartHeight
)}
/
>
{
columnElements
}
<
/G
>
)
return
(
return
(
<
TouchableOpacity
<
TouchableOpacity
onPress
=
{()
=>
this
.
onDaySelect
(
dateString
)}
onPress
=
{()
=>
this
.
onDaySelect
(
dateString
)}
...
@@ -248,7 +233,10 @@ class DayColumn extends Component {
...
@@ -248,7 +233,10 @@ class DayColumn extends Component {
)}
)}
<
Surface
width
=
{
config
.
columnWidth
}
height
=
{
columnHeight
}
>
<
Surface
width
=
{
config
.
columnWidth
}
height
=
{
columnHeight
}
>
{
column
}
<
ChartLine
path
=
{
new
Path
().
lineTo
(
0
,
chartHeight
)}
/
>
{
columnElements
}
<
/Surface
>
<
/Surface
>
<
View
style
=
{{
height
:
xAxisHeight
}}
>
<
View
style
=
{{
height
:
xAxisHeight
}}
>
...
...
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