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
0fbf175e
Commit
0fbf175e
authored
Jan 31, 2021
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix chart divs, names, and containers + radar chart legend
parent
1f060ebd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
25 deletions
+39
-25
index2.html
public/grijalva/index2.html
+17
-9
cuerpos_charts.js
public/js/cuerpos_charts.js
+11
-5
cuerpos_functions.js
public/js/cuerpos_functions.js
+11
-11
No files found.
public/grijalva/index2.html
View file @
0fbf175e
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
<i
class=
"fa fa-spinner2 fa-spin fa-5x loadSpinner"
></i><br>
<i
class=
"fa fa-spinner2 fa-spin fa-5x loadSpinner"
></i><br>
<span
class=
"loadText"
>
Cargando datos...
<br>
<span
class=
"loadText"
>
Cargando datos...
<br>
<span
id=
"wb-fileLoad"
></span>
<span
id=
"wb-fileLoad"
></span>
<span
id=
"basemap-fileLoad"
></span>
<span
id=
"basemap-fileLoad"
></span>
</span>
</span>
</div>
</div>
</div>
</div>
...
@@ -72,19 +72,27 @@
...
@@ -72,19 +72,27 @@
<div
class=
"col-md-6"
id=
"story"
>
<div
class=
"col-md-6"
id=
"story"
>
<div
class=
"loader"
></div>
<div
class=
"loader"
></div>
<div
class=
"row h-50 border-bottom"
>
<div
class=
"row h-50 border-bottom"
>
<div
class=
"col-6 border-right"
id=
"radial_chart"
>
<div
class=
"col-6 border-right"
>
<div
id=
"radial_chart2"
></div>
<div
class=
"row h-100"
>
<div
id=
"radarChart"
></div>
</div>
</div>
</div>
<div
class=
"col-6"
id=
"linesChart"
>
<div
class=
"col-6"
>
<div
id=
"linesChart2"
></div>
<div
class=
"row h-100"
>
<div
id=
"lineChart"
></div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"row h-50"
>
<div
class=
"row h-50"
>
<div
class=
"col-6 border-right"
id=
"stackedAreaChart"
>
<div
class=
"col-6 border-right"
>
<div
id=
"dlccpo-graph2"
></div>
<div
class=
"row h-100"
>
<div
id=
"areaChart"
></div>
</div>
</div>
</div>
<div
class=
"col-6"
id=
"dimfrcpo-graph"
>
<div
class=
"col-6"
>
<div
id=
"dimfrcpo-graph2"
></div>
<div
class=
"row h-100"
>
<div
id=
"barChart"
></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
public/js/cuerpos_charts.js
View file @
0fbf175e
...
@@ -146,7 +146,7 @@ const makeBarSeries = (chart, field, name) => {
...
@@ -146,7 +146,7 @@ const makeBarSeries = (chart, field, name) => {
}
}
const
makeRadarChart
=
(
data
,
months
,
years
)
=>
{
const
makeRadarChart
=
(
data
,
months
,
years
)
=>
{
let
radarChart
=
am4core
.
create
(
"rad
ial_c
hart"
,
am4charts
.
RadarChart
);
let
radarChart
=
am4core
.
create
(
"rad
arC
hart"
,
am4charts
.
RadarChart
);
let
radarTitle
=
radarChart
.
titles
.
create
();
let
radarTitle
=
radarChart
.
titles
.
create
();
radarTitle
.
text
=
"Superficie total por año"
;
radarTitle
.
text
=
"Superficie total por año"
;
...
@@ -196,13 +196,15 @@ const makeRadarChart = (data, months, years) => {
...
@@ -196,13 +196,15 @@ const makeRadarChart = (data, months, years) => {
makeRadarRange
(
radarCategoryAxis
,
"septiembre"
,
"diciembre"
,
radarRangeColors
[
3
],
3
);
makeRadarRange
(
radarCategoryAxis
,
"septiembre"
,
"diciembre"
,
radarRangeColors
[
3
],
3
);
makeRadarRange
(
radarCategoryAxis
,
"diciembre"
,
"diciembre"
,
radarRangeColors
[
0
],
1
);
makeRadarRange
(
radarCategoryAxis
,
"diciembre"
,
"diciembre"
,
radarRangeColors
[
0
],
1
);
radarChart
.
cursor
=
new
am4charts
.
RadarCursor
();
radarChart
.
cursor
=
new
am4charts
.
RadarCursor
();
//FIXME: cursors are offset
// add line legend
// add line legend
radarChart
.
legend
=
new
am4charts
.
Legend
();
radarChart
.
legend
=
new
am4charts
.
Legend
();
//radarChart.legend.fontSize = 10;
//radarChart.legend.fontSize = 10;
radarChart
.
legend
.
fontSize
=
9
;
radarChart
.
legend
.
fontSize
=
9
;
radarChart
.
legend
.
labels
.
template
.
fill
=
am4core
.
color
(
mainTextColor
);
radarChart
.
legend
.
labels
.
template
.
fill
=
am4core
.
color
(
mainTextColor
);
radarChart
.
legend
.
itemContainers
.
template
.
paddingTop
=
0
;
radarChart
.
legend
.
itemContainers
.
template
.
paddingBottom
=
0
;
let
legenddata
=
[{
name
:
"Estiaje"
,
fill
:
am4core
.
color
(
"#595952"
)
},
let
legenddata
=
[{
name
:
"Estiaje"
,
fill
:
am4core
.
color
(
"#595952"
)
},
{
name
:
"Tropical"
,
fill
:
am4core
.
color
(
"#838278"
)
},
{
name
:
"Tropical"
,
fill
:
am4core
.
color
(
"#838278"
)
},
...
@@ -218,11 +220,15 @@ const makeRadarChart = (data, months, years) => {
...
@@ -218,11 +220,15 @@ const makeRadarChart = (data, months, years) => {
let
markerTemplate
=
radarChart
.
legend
.
markers
.
template
;
let
markerTemplate
=
radarChart
.
legend
.
markers
.
template
;
markerTemplate
.
width
=
20
;
markerTemplate
.
width
=
20
;
markerTemplate
.
height
=
20
;
markerTemplate
.
height
=
20
;
radarChart
.
legend
.
itemContainers
.
template
.
paddingTop
=
0
;
radarChart
.
legend
.
itemContainers
.
template
.
paddingRight
=
-
10
;
radarChart
.
legend
.
itemContainers
.
template
.
paddingLeft
=
-
10
;
}
}
const
makeLineChart
=
(
data
)
=>
{
const
makeLineChart
=
(
data
)
=>
{
let
lineChart
=
am4core
.
create
(
"line
s
Chart"
,
am4charts
.
XYChart
);
let
lineChart
=
am4core
.
create
(
"lineChart"
,
am4charts
.
XYChart
);
let
lineTitle
=
lineChart
.
titles
.
create
();
let
lineTitle
=
lineChart
.
titles
.
create
();
lineTitle
.
text
=
"Superficie por tipo de cuerpo"
;
lineTitle
.
text
=
"Superficie por tipo de cuerpo"
;
lineTitle
.
fontSize
=
10
;
lineTitle
.
fontSize
=
10
;
...
@@ -259,7 +265,7 @@ const makeLineChart = (data) => {
...
@@ -259,7 +265,7 @@ const makeLineChart = (data) => {
}
}
const
makeAreaChart
=
(
data
)
=>
{
const
makeAreaChart
=
(
data
)
=>
{
let
areaChart
=
am4core
.
create
(
"
stackedA
reaChart"
,
am4charts
.
XYChart
);
let
areaChart
=
am4core
.
create
(
"
a
reaChart"
,
am4charts
.
XYChart
);
let
areaTitle
=
areaChart
.
titles
.
create
();
let
areaTitle
=
areaChart
.
titles
.
create
();
areaTitle
.
text
=
"Superficie acumulada"
;
areaTitle
.
text
=
"Superficie acumulada"
;
...
@@ -330,7 +336,7 @@ const makeAreaChart = (data) => {
...
@@ -330,7 +336,7 @@ const makeAreaChart = (data) => {
}
}
const
makeBarChart
=
(
data
)
=>
{
const
makeBarChart
=
(
data
)
=>
{
let
barChart
=
am4core
.
create
(
"
dimfrcpo-graph
"
,
am4charts
.
XYChart
);
let
barChart
=
am4core
.
create
(
"
barChart
"
,
am4charts
.
XYChart
);
let
barTitle
=
barChart
.
titles
.
create
();
let
barTitle
=
barChart
.
titles
.
create
();
barTitle
.
text
=
"Conteo por tipo de cuerpo"
;
barTitle
.
text
=
"Conteo por tipo de cuerpo"
;
...
...
public/js/cuerpos_functions.js
View file @
0fbf175e
...
@@ -684,7 +684,7 @@ const makeCharts = () => {
...
@@ -684,7 +684,7 @@ const makeCharts = () => {
// end bars
// end bars
}
}
const
updateBarChartOnHover
=
(
filterDate
,
data
)
=>
{
const
updateBarChartOnHover
=
(
filterDate
,
data
)
=>
{
let
popBarsChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"
dimfrcpo-graph
"
);
let
popBarsChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"
barChart
"
);
let
areclass
=
data
.
filter
(
d
=>
d
.
date
.
valueOf
()
==
filterDate
.
valueOf
());
let
areclass
=
data
.
filter
(
d
=>
d
.
date
.
valueOf
()
==
filterDate
.
valueOf
());
let
elementpb
=
{},
let
elementpb
=
{},
cart_pb
=
[];
cart_pb
=
[];
...
@@ -717,7 +717,7 @@ const updateCharts = () => {
...
@@ -717,7 +717,7 @@ const updateCharts = () => {
yearList
=
[...
new
Set
(
userDates
.
map
(
date
=>
new
Date
(
date
).
getFullYear
()
))];
yearList
=
[...
new
Set
(
userDates
.
map
(
date
=>
new
Date
(
date
).
getFullYear
()
))];
// update radar chart
// update radar chart
let
radarChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"rad
ial_c
hart"
);
let
radarChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"rad
arC
hart"
);
const
queries
=
userDates
.
map
(
async
(
date
,
i
)
=>
{
const
queries
=
userDates
.
map
(
async
(
date
,
i
)
=>
{
// check what month has not been queried before and query it
// check what month has not been queried before and query it
...
@@ -758,8 +758,8 @@ const updateCharts = () => {
...
@@ -758,8 +758,8 @@ const updateCharts = () => {
});
});
// update line + area chart
// update line + area chart
let
line
sChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"lines
Chart"
),
let
line
Chart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"line
Chart"
),
stackedAreaChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"stackedA
reaChart"
);
areaChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"a
reaChart"
);
// extract months as values for which there is data already queried
// extract months as values for which there is data already queried
let
chartMonths
=
lineAreaData
.
map
(
d
=>
parseInt
(
Object
.
keys
(
d
)[
0
])
);
let
chartMonths
=
lineAreaData
.
map
(
d
=>
parseInt
(
Object
.
keys
(
d
)[
0
])
);
...
@@ -804,7 +804,7 @@ const updateCharts = () => {
...
@@ -804,7 +804,7 @@ const updateCharts = () => {
});
});
// update charts ranges
// update charts ranges
let
lineDateAxis
=
line
s
Chart
.
xAxes
.
values
[
0
];
let
lineDateAxis
=
lineChart
.
xAxes
.
values
[
0
];
lineDateAxis
.
axisRanges
.
clear
();
lineDateAxis
.
axisRanges
.
clear
();
makeDateRange
(
lineDateAxis
,
0
,
2
,
"#E1DBC8"
);
makeDateRange
(
lineDateAxis
,
0
,
2
,
"#E1DBC8"
);
makeDateRange
(
lineDateAxis
,
2
,
2
,
"#595952"
);
makeDateRange
(
lineDateAxis
,
2
,
2
,
"#595952"
);
...
@@ -812,7 +812,7 @@ const updateCharts = () => {
...
@@ -812,7 +812,7 @@ const updateCharts = () => {
makeDateRange
(
lineDateAxis
,
8
,
3
,
"#B1AE9F"
);
makeDateRange
(
lineDateAxis
,
8
,
3
,
"#B1AE9F"
);
makeDateRange
(
lineDateAxis
,
11
,
1
,
"#E1DBC8"
);
makeDateRange
(
lineDateAxis
,
11
,
1
,
"#E1DBC8"
);
let
areaDateAxis
=
stackedA
reaChart
.
xAxes
.
values
[
0
];
let
areaDateAxis
=
a
reaChart
.
xAxes
.
values
[
0
];
areaDateAxis
.
axisRanges
.
clear
();
areaDateAxis
.
axisRanges
.
clear
();
makeDateRange
(
areaDateAxis
,
0
,
2
,
"#E1DBC8"
);
makeDateRange
(
areaDateAxis
,
0
,
2
,
"#E1DBC8"
);
makeDateRange
(
areaDateAxis
,
2
,
2
,
"#595952"
);
makeDateRange
(
areaDateAxis
,
2
,
2
,
"#595952"
);
...
@@ -822,15 +822,15 @@ const updateCharts = () => {
...
@@ -822,15 +822,15 @@ const updateCharts = () => {
// updte chart data
// updte chart data
chartData
.
sort
((
a
,
b
)
=>
(
a
.
date
>
b
.
date
)
?
1
:
-
1
);
chartData
.
sort
((
a
,
b
)
=>
(
a
.
date
>
b
.
date
)
?
1
:
-
1
);
line
s
Chart
.
data
=
chartData
;
lineChart
.
data
=
chartData
;
line
s
Chart
.
invalidateRawData
();
lineChart
.
invalidateRawData
();
stackedA
reaChart
.
data
=
chartData
;
a
reaChart
.
data
=
chartData
;
stackedA
reaChart
.
invalidateRawData
();
a
reaChart
.
invalidateRawData
();
});
});
// update bar chart
// update bar chart
let
barChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"
dimfrcpo-graph
"
);
let
barChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"
barChart
"
);
previouslyQueriedMonths
.
sort
((
a
,
b
)
=>
(
a
>
b
)
?
1
:
-
1
);
previouslyQueriedMonths
.
sort
((
a
,
b
)
=>
(
a
>
b
)
?
1
:
-
1
);
// TODO: how to use this previouslyQueriedMonths varr for all charts?
// TODO: how to use this previouslyQueriedMonths varr for all charts?
// If it is set in one chart, it may affect all others.
// If it is set in one chart, it may affect all others.
...
...
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