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