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
80286d55
Commit
80286d55
authored
Aug 31, 2019
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basemap on map load
parent
9df3f432
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
827 additions
and
7 deletions
+827
-7
index.html
public/grijalva/index.html
+2
-1
grijalva_basemap.js
public/js/grijalva_basemap.js
+788
-0
grijalva_charts.js
public/js/grijalva_charts.js
+1
-1
grijalva_functions.js
public/js/grijalva_functions.js
+21
-5
jszip.min.js
public/js/jszip.min.js
+15
-0
No files found.
public/grijalva/index.html
View file @
80286d55
...
@@ -156,8 +156,9 @@
...
@@ -156,8 +156,9 @@
<script
type=
"text/javascript"
src=
"../js/Leaflet.Sync.js"
></script>
<script
type=
"text/javascript"
src=
"../js/Leaflet.Sync.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js"
></script>
<script
src=
"https://npmcdn.com/@turf/turf/turf.min.js"
></script>
<script
src=
"https://npmcdn.com/@turf/turf/turf.min.js"
></script>
<script
type=
"text/javascript"
src=
"../js/jszip.min.js"
></script>
<script
src=
"../js/grijalva_functions.js"
></script>
<script
src=
"../js/grijalva_functions.js"
></script>
<script
src=
"../js/grijalva_basemap.js"
></script>
<script
src=
"../js/grijalva_charts.js"
></script>
<script
src=
"../js/grijalva_charts.js"
></script>
<!--<script>
<!--<script>
...
...
public/js/grijalva_basemap.js
0 → 100644
View file @
80286d55
This diff is collapsed.
Click to expand it.
public/js/grijalva_charts.js
View file @
80286d55
...
@@ -303,7 +303,7 @@ function makeIndicatorGraph() {
...
@@ -303,7 +303,7 @@ function makeIndicatorGraph() {
xaxisTicks
.
transition
()
xaxisTicks
.
transition
()
.
duration
(
500
)
.
duration
(
500
)
.
call
(
// FIXME: this call causes a "translate(NaN,0)" ...
.
call
(
d3
.
axisBottom
(
xLine
)
d3
.
axisBottom
(
xLine
)
.
tickValues
(
monthsInGraph
)
.
tickValues
(
monthsInGraph
)
.
tickFormat
(
""
)
.
tickFormat
(
""
)
...
...
public/js/grijalva_functions.js
View file @
80286d55
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*/
*/
/* globals omnivore, Promise, chroma, makeBaseMap, makeIndicatorGraph, getData */
/* globals omnivore, Promise, chroma, makeBaseMap, makeIndicatorGraph, getData */
/* exported
userFiles, userDates, layerControl
*/
/* exported
indicators. userFiles, userDates, timeParse, layerControl, updateCharts
*/
let
timeParse
,
let
timeParse
,
timeFormat
,
timeFormat
,
...
@@ -409,6 +409,7 @@ const populateMap = (mapData) => {
...
@@ -409,6 +409,7 @@ const populateMap = (mapData) => {
};
};
layerControl
=
L
.
control
.
layers
(
baseLayers
,
overlays
).
addTo
(
map
);
layerControl
=
L
.
control
.
layers
(
baseLayers
,
overlays
).
addTo
(
map
);
makeBaseMap
();
// basemap.js
});
});
// Define charts with reusable components
// Define charts with reusable components
...
@@ -443,9 +444,6 @@ const populateMap = (mapData) => {
...
@@ -443,9 +444,6 @@ const populateMap = (mapData) => {
let
option
=
$
(
"#indicatorSelect"
).
val
();
// option selected from dropdrown
let
option
=
$
(
"#indicatorSelect"
).
val
();
// option selected from dropdrown
d3
.
select
(
indicatorVars
[
option
].
container
).
select
(
"svg text.title"
).
classed
(
"active"
,
true
);
d3
.
select
(
indicatorVars
[
option
].
container
).
select
(
"svg text.title"
).
classed
(
"active"
,
true
);
});
});
// TODO: basemap
//makeBaseMap(); // basemap.js
}
}
const
updateMap
=
(
mapData
)
=>
{
const
updateMap
=
(
mapData
)
=>
{
...
@@ -502,7 +500,25 @@ const updateMap = (mapData) => {
...
@@ -502,7 +500,25 @@ const updateMap = (mapData) => {
updateCharts
();
updateCharts
();
}
}
const
updateCharts
=
()
=>
{
const
updateCharts
=
async
()
=>
{
// TODO: get data inside drawn polygons
// if user has drawn polygons, update chart with data inside selection
//if (drawnItems.getBounds().isValid()) {
/*if (drawnItems.toGeoJSON().features.length != 0) {
//console.time("selection");
let selectionData = await getDataInSelection();
//console.timeEnd("selection");
indicators.forEach( indicator => {
indicatorVars[indicator].chart.data(await summarizeData(selectionData, indicator));
});
} else {
// otherwise use all data
indicators.forEach( indicator => {
indicatorVars[indicator].chart.data( await getData(indicator));
});
}*/
indicators
.
map
(
async
(
indicator
)
=>
{
indicators
.
map
(
async
(
indicator
)
=>
{
indicatorVars
[
indicator
].
chart
.
data
(
await
getData
(
indicator
));
indicatorVars
[
indicator
].
chart
.
data
(
await
getData
(
indicator
));
});
});
...
...
public/js/jszip.min.js
0 → 100644
View file @
80286d55
This diff is collapsed.
Click to expand it.
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