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
1f060ebd
Commit
1f060ebd
authored
Jan 29, 2021
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update bar chart title on area hover
parent
82e4c682
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
cuerpos_functions.js
public/js/cuerpos_functions.js
+5
-3
No files found.
public/js/cuerpos_functions.js
View file @
1f060ebd
...
@@ -587,7 +587,6 @@ const makeCharts = () => {
...
@@ -587,7 +587,6 @@ const makeCharts = () => {
// RADAR CHART
// RADAR CHART
// async queries for each date that has been loaded
// async queries for each date that has been loaded
const
queries
=
userFiles
.
map
(
async
(
mes
,
i
)
=>
{
const
queries
=
userFiles
.
map
(
async
(
mes
,
i
)
=>
{
//let query = `${baseUrl}/query/${mes}?columns=sum(areacpo)/10000 value1,sum(perimcpo) value2, sum(dimfrcpo) value3`;
let
query
=
`
${
baseUrl
}
/query/
${
mes
}
?columns=sum(areacpo)/10000 area`
;
let
query
=
`
${
baseUrl
}
/query/
${
mes
}
?columns=sum(areacpo)/10000 area`
;
const
queryData
=
await
d3
.
json
(
query
);
const
queryData
=
await
d3
.
json
(
query
);
queryData
[
0
].
date
=
new
Date
(
userDates
[
i
]);
queryData
[
0
].
date
=
new
Date
(
userDates
[
i
]);
...
@@ -600,7 +599,6 @@ const makeCharts = () => {
...
@@ -600,7 +599,6 @@ const makeCharts = () => {
// 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
(
data
=>
{
Promise
.
all
(
queries
).
then
(
data
=>
{
radarData
.
sort
((
a
,
b
)
=>
(
a
.
date
>
b
.
date
)
?
1
:
-
1
);
radarData
.
sort
((
a
,
b
)
=>
(
a
.
date
>
b
.
date
)
?
1
:
-
1
);
// TODO: maybe make this a function so it can be used to update chart when changing dates
let
radarChartData
=
[];
let
radarChartData
=
[];
monthArray
.
forEach
(
(
month
,
index
)
=>
{
monthArray
.
forEach
(
(
month
,
index
)
=>
{
let
element
=
{};
let
element
=
{};
...
@@ -633,7 +631,6 @@ const makeCharts = () => {
...
@@ -633,7 +631,6 @@ const makeCharts = () => {
Promise
.
all
(
queries_ls
).
then
(
data
=>
{
Promise
.
all
(
queries_ls
).
then
(
data
=>
{
// unnest andd flatten data object for further processing
// unnest andd flatten data object for further processing
let
rawData
=
data
.
map
(
d
=>
Object
.
values
(
d
)[
0
]
).
flat
();
let
rawData
=
data
.
map
(
d
=>
Object
.
values
(
d
)[
0
]
).
flat
();
// TODO: maybe make this a function so it can be used to update chart when changing dates
let
merged
=
[].
concat
.
apply
([],
rawData
);
let
merged
=
[].
concat
.
apply
([],
rawData
);
let
aguaPermanente
=
merged
.
filter
(
d
=>
d
.
descrip
==
"Agua permanente"
);
let
aguaPermanente
=
merged
.
filter
(
d
=>
d
.
descrip
==
"Agua permanente"
);
let
aguaTemporal
=
merged
.
filter
(
d
=>
d
.
descrip
==
"Áreas temporalmente inundadas"
);
let
aguaTemporal
=
merged
.
filter
(
d
=>
d
.
descrip
==
"Áreas temporalmente inundadas"
);
...
@@ -708,6 +705,11 @@ const updateBarChartOnHover = (filterDate, data) => {
...
@@ -708,6 +705,11 @@ const updateBarChartOnHover = (filterDate, data) => {
if
(
popBarsChart
)
{
if
(
popBarsChart
)
{
popBarsChart
.
data
=
cart_pb1
;
popBarsChart
.
data
=
cart_pb1
;
popBarsChart
.
invalidateRawData
();
popBarsChart
.
invalidateRawData
();
// set barChart title when hovering on different bars
let
ye
=
new
Intl
.
DateTimeFormat
(
'es'
,
{
year
:
'numeric'
}).
format
(
filterDate
);
let
mo
=
new
Intl
.
DateTimeFormat
(
'es'
,
{
month
:
'short'
}).
format
(
filterDate
);
popBarsChart
.
titles
.
values
[
0
].
text
=
`Conteo por tipo de cuerpo en
${
mo
}
${
ye
}
`
;
// TODO: update barChart when changing dates on timeDimension?
}
}
}
}
...
...
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