Commit 419ef7f1 authored by Rodrigo Tapia-McClung's avatar Rodrigo Tapia-McClung

Minor fixes on names

parent 89c8ea79
......@@ -5,7 +5,7 @@
* January 2021
*/
/* globals updateBarChart, barChartData, am4charts, am4core, am4themes_animated, yearList */
/* globals updateBarChartOnHover, barChartData, am4charts, am4core, am4themes_animated, yearList */
/* export makeRadarChart, makeLineChart, makeAreaChart, makeBarChart */
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -176,7 +176,7 @@ const makeRadarChart = (data, months, years) => {
/* Create and configure series */
let seriesColor = ["#F98293", "#2AC2BB", "#FDA259"];
years.forEach( (year, i) => {
makeRadarSeries(radialChart, year, "month", year, seriesColor[i]);
makeRadarSeries(radarChart, year, "month", year, seriesColor[i]);
});
radarChart.scrollbarX = new am4core.Scrollbar();
......@@ -323,7 +323,7 @@ const makeAreaChart = (data) => {
// only update chart when dates in cursor change month
if (filterDate.valueOf() != previousDate.valueOf()) {
previousDate = filterDate;
updateBarChart(filterDate, barChartData); // FIXME: when calling this update, bar chart may not exist yet
updateBarChartOnHover(filterDate, barChartData); // FIXME: when calling this update, bar chart may not exist yet
}
});
}
......
......@@ -60,10 +60,8 @@ d3.json("https://unpkg.com/d3-time-format@2.1.1/locale/es-MX.json").then(async l
makeCharts();
});
const sortInitialDateAscending = (a, b) => {
// Dates will be cast to numbers automagically:
return a - b;
}
const sortInitialDateAscending = (a, b) => a - b;
// Dates will be cast to numbers automagically:
const baseUrl = new URL(`/data`, window.location.href).href;
......@@ -77,7 +75,7 @@ const setupDates = () => {
let table = layer.f_table_name.split("cuerpos_")[1];
dateArray.push(timeParse(table)); // convert filenames to dates
}
})
});
dateArray = dateArray.sort(sortInitialDateAscending); // order dates
dateMin = d3.min(dateArray);
......@@ -171,7 +169,7 @@ const populateDates = (dates) => { // fill out date pickers with available dates
$("#startHeader").remove();
$("#initial-backdrop").remove();
$("#indicatorSelect").parent().remove();
$("#mainContainer")[0].style.setProperty("display", "flex", "important")
$("#mainContainer")[0].style.setProperty("display", "flex", "important");
$("#mexmap").show();
// When closing final-date, either setup or update map
......@@ -188,7 +186,7 @@ const populateDates = (dates) => { // fill out date pickers with available dates
$("#ui-datepicker-div").toggleClass("hide-calendar", $(el).is("[data-calendar=\"false\"]"));
}
});
})
});
}
const setupMap = (dates) => {
......@@ -415,7 +413,7 @@ const updateMap = (mapData) => {
let newTile = mapboxLayer(monthYear);
glmap.getMapboxMap().addLayer(newTile);
if (monthYear == userFiles[0]) {
glmap.getMapboxMap().setPaintProperty(monthYear, "fill-opacity", 0.7)
glmap.getMapboxMap().setPaintProperty(monthYear, "fill-opacity", 0.7);
}
}
});
......@@ -678,15 +676,15 @@ const makeCharts = () => {
// wait for all queries to complete and set barChartData to its response
Promise.all(queries_pb).then((d) => {
barChartData = [].concat.apply([], d);
// set initial date to january 2016
// set initial date to first date
let filterDate = new Date(userDates[0]);
makeBarChart(barChartData);
updateBarChart(filterDate, barChartData);
updateBarChartOnHover(filterDate, barChartData);
});
// end bars
}
const updateBarChart = (filterDate, data) => {
const updateBarChartOnHover = (filterDate, data) => {
let popBarsChart = am4core.registry.baseSprites.find(c => c.htmlContainer.id === "dimfrcpo-graph");
let areclass = data.filter(d => d.date.valueOf() == filterDate.valueOf());
let elementpb = {},
......@@ -729,7 +727,7 @@ const updateCharts = () => {
resolve(queryData[0]);
});
}
})
});
// wait for all queries to complete and then set chart data
Promise.all(queries).then( () => {
......@@ -755,4 +753,5 @@ const updateCharts = () => {
radarChart.invalidateRawData();
});
// update line 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