Commit 60ec2c25 authored by Tania Gómez's avatar Tania Gómez

Merge branch 'dev' of http://gitlab.geoint.mx/tapiamcclung/pgserver into dev

parents 774823df 5ce9c017
......@@ -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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment