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
841cdf77
Commit
841cdf77
authored
Sep 02, 2019
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
override flat property
parent
80286d55
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
grijalva_charts.js
public/js/grijalva_charts.js
+13
-4
No files found.
public/js/grijalva_charts.js
View file @
841cdf77
...
...
@@ -43,6 +43,14 @@ const getData = async (indicator) => {
return
data
;
}
Object
.
defineProperty
(
Array
.
prototype
,
'flat'
,
{
value
:
function
(
depth
=
1
)
{
return
this
.
reduce
(
function
(
flat
,
toFlatten
)
{
return
flat
.
concat
((
Array
.
isArray
(
toFlatten
)
&&
(
depth
>
1
))
?
toFlatten
.
flat
(
depth
-
1
)
:
toFlatten
);
},
[]);
}
});
function
makeIndicatorGraph
()
{
let
data
=
[],
...
...
@@ -73,7 +81,6 @@ function makeIndicatorGraph() {
updateData
;
function
chart
(
selection
)
{
// get data ranges using values from displayName
minDate
=
d3
.
min
(
data
[
0
].
values
,
d
=>
{
return
d
[
displayName
];
...
...
@@ -163,6 +170,8 @@ function makeIndicatorGraph() {
// Calculate min and max values of data to define chart y-axis domain
//let minDomain = d3.min(data.map(d => d.values).flat().map(d => d.value));
//console.log("data: ", data.map(d => d.values));
let
maxDomain
=
d3
.
max
(
data
.
map
(
d
=>
d
.
values
).
flat
().
map
(
d
=>
d
.
value
));
yLine
.
domain
([
0
,
maxDomain
]).
nice
();
//yLine.domain([0, d3.max(data[0].values, d => d.value)]).nice();
...
...
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