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
60ec2c25
Commit
60ec2c25
authored
Sep 02, 2019
by
Tania Gómez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.geoint.mx/tapiamcclung/pgserver
into dev
parents
774823df
5ce9c017
Changes
1
Hide 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 @
60ec2c25
...
...
@@ -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
];
...
...
@@ -162,7 +169,9 @@ 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();
...
...
@@ -249,7 +258,7 @@ function makeIndicatorGraph() {
return
d
[
displayName
];
});
maxDate
=
d3
.
timeDay
.
offset
(
maxDate
,
15
)
// get next month to get correct x-axis alignment
// update axes' domain
xLine
.
domain
([
minDate
,
maxDate
])
//.nice()
...
...
@@ -568,4 +577,4 @@ function makeIndicatorGraph() {
};
return
chart
;
}
\ No newline at end of file
}
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