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) => { ...@@ -43,6 +43,14 @@ const getData = async (indicator) => {
return data; 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() { function makeIndicatorGraph() {
let data = [], let data = [],
...@@ -73,7 +81,6 @@ function makeIndicatorGraph() { ...@@ -73,7 +81,6 @@ function makeIndicatorGraph() {
updateData; updateData;
function chart(selection) { function chart(selection) {
// get data ranges using values from displayName // get data ranges using values from displayName
minDate = d3.min(data[0].values, d => { minDate = d3.min(data[0].values, d => {
return d[displayName]; return d[displayName];
...@@ -163,6 +170,8 @@ function makeIndicatorGraph() { ...@@ -163,6 +170,8 @@ function makeIndicatorGraph() {
// Calculate min and max values of data to define chart y-axis domain // 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)); //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)); let maxDomain = d3.max(data.map(d => d.values).flat().map(d => d.value));
yLine.domain([0, maxDomain]).nice(); yLine.domain([0, maxDomain]).nice();
//yLine.domain([0, d3.max(data[0].values, d => d.value)]).nice(); //yLine.domain([0, d3.max(data[0].values, d => d.value)]).nice();
......
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