Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fordecyt_2019
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rodrigo Tapia-McClung
fordecyt_2019
Commits
b34bf9c4
Commit
b34bf9c4
authored
Sep 06, 2019
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to arrow functions
parent
9bd35625
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
254 additions
and
256 deletions
+254
-256
grijalva_charts.js
public/fordecyt_2019/js/grijalva_charts.js
+254
-256
No files found.
public/fordecyt_2019/js/grijalva_charts.js
View file @
b34bf9c4
...
...
@@ -101,7 +101,8 @@ const summarizeData = (allData, indicator) => {
.
rollup
(
v
=>
{
return
indicator
==
"costa"
||
indicator
==
"df"
?
d3
.
mean
(
v
,
v
=>
v
.
value
)
:
d3
.
sum
(
v
,
v
=>
v
.
value
)
})
.
entries
(
data2
)
// map "key" and "value" from d3.nest().rollup() to date and value
.
map
(
group
=>
{
return
{
.
map
(
group
=>
{
return
{
date
:
new
Date
(
group
.
key
),
value
:
group
.
value
}
...
...
@@ -112,7 +113,7 @@ const summarizeData = (allData, indicator) => {
return
data
;
}
function
makeIndicatorGraph
()
{
const
makeIndicatorGraph
=
()
=>
{
let
data
=
[],
width
=
450
,
...
...
@@ -141,7 +142,7 @@ function makeIndicatorGraph() {
legendContainer
=
"legendZone"
,
updateData
;
function
chart
(
selection
)
{
const
chart
=
selection
=>
{
// get data ranges using values from displayName
minDate
=
d3
.
min
(
data
[
0
].
values
,
d
=>
{
return
d
[
displayName
];
...
...
@@ -152,7 +153,7 @@ function makeIndicatorGraph() {
});
maxDate
=
d3
.
timeDay
.
offset
(
maxDate
,
15
)
// get next month to get correct x-axis alignment
selection
.
each
(
function
()
{
selection
.
each
(
()
=>
{
// add graph svg to selected container on webpage
let
areaSVG
=
selection
...
...
@@ -303,10 +304,9 @@ function makeIndicatorGraph() {
});
$
(
"#explainIndicatorModal"
).
modal
();
});
//});
// update chart
updateData
=
function
()
{
updateData
=
()
=>
{
let
time
=
map
.
timeDimension
.
getCurrentTime
();
// update data ranges using values from displayName and lineVariables
...
...
@@ -349,7 +349,7 @@ function makeIndicatorGraph() {
filteredData
[
i
].
values
.
push
(
v
);
}
});
})
});
// update axes
let
g
=
selection
.
select
(
".lineChart"
);
...
...
@@ -516,10 +516,8 @@ function makeIndicatorGraph() {
.
attr
(
"cy"
,
d
=>
yLine
(
d
.
value
)),
exit
=>
exit
.
remove
()
);
}
});
//});
}
chart
.
width
=
function
(
value
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment