Commit 798300a8 authored by Alexander Basov's avatar Alexander Basov Committed by Matija Obreza

Map of collection sizes in the world

parent 702aa1e9
......@@ -11,8 +11,8 @@
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"undef": true,
"quotmark": "true",
"undef": false,
"unused": true,
"strict": true,
"trailing": true,
......
......@@ -166,6 +166,10 @@ module.exports = function(grunt) {
app : {
src : [ '<%= app.source %>/js/main.js', '<%= app.source %>/js/crophub.js', '<%= app.source %>/js/custom.js' ],
dest : '<%= app.dist %>/js/genesys.js'
},
world : {
src: [ 'bower_components/highmaps-beta/highmaps.src.js', 'bower_components/highcharts/modules/data.src.js', '<%= app.source %>/js/world.js'],
dest : '<%= app.dist %>/js/genesyshighcharts.js'
}
},
autoprefixer : {
......@@ -209,7 +213,8 @@ module.exports = function(grunt) {
files : {
'<%= app.dist %>/js/libraries.min.js' : [ '<%= app.dist %>/js/libraries.js' ],
'<%= app.dist %>/js/genesys.min.js' : [ '<%= app.dist %>/js/genesys.js' ],
'<%= app.dist %>/js/all.min.js' : [ '<%= app.dist %>/js/libraries.js', '<%= app.dist %>/js/genesys.js' ]
'<%= app.dist %>/js/all.min.js' : [ '<%= app.dist %>/js/libraries.js', '<%= app.dist %>/js/genesys.js' ],
'<%= app.dist %>/js/genesyshighcharts.min.js' : [ '<%= app.dist %>/js/genesyshighcharts.js' ]
}
}
},
......
......@@ -15,6 +15,8 @@
"jquery-ui": "~1.11.4",
"dyn-css": "~0.8.1",
"webfont-notosans": "~0.1.0",
"fontawesome": "~4.4.0"
"fontawesome": "~4.4.0",
"highcharts": "~4.1.8",
"highmaps-beta": "highmaps#~1.0.1"
}
}
package org.genesys2.server.servlet.controller;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
public class AccessionsWorldMapController extends BaseController {
@RequestMapping("/charts/collections")
public String chartsCollection(){
return "/charts/collection";
}
@RequestMapping(value = "/data", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
@ResponseBody()
public List<Map<String, Object>> accessionsCollection(){
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> countryInfo = new HashMap<>();
countryInfo.put("code", "AF");
countryInfo.put("country", "Afghanistan");
countryInfo.put("z", 30552);
resultList.add(countryInfo);
countryInfo = new HashMap<>();
countryInfo.put("code", "AL");
countryInfo.put("country", "Albania");
countryInfo.put("z", 28907);
resultList.add(countryInfo);
countryInfo = new HashMap<>();
countryInfo.put("code", "US");
countryInfo.put("country", "USA");
countryInfo.put("z", 289070);
resultList.add(countryInfo);
return resultList;
}
}
This diff is collapsed.
......@@ -52,7 +52,7 @@
<script type="text/javascript" src="<c:url value="/html/js/libraries.js" />"></script>
<script type="text/javascript" src="<c:url value="/html/js/main.js" />"></script>
<script type="text/javascript" src="<c:url value="/html/js/custom.js" />"></script>
<script type="text/javascript" src="<c:url value="/html/js/crophub.js" />"></script>
<script type="text/javascript" src="<c:url value="/html/js/crophub.js" />"></script>
</c:otherwise>
</c:choose>
......@@ -61,3 +61,4 @@
<%--dynCss.config.debug=true;--%>
//enableSessionWarning(${pageContext.session.maxInactiveInterval});
</script>
<%@include file="/WEB-INF/jsp/init.jsp" %>
<html>
<head>
<title></title>
</head>
<body>
<div id="container" style="height: 500px; min-width: 310px; max-width: 800px; margin: 0 auto"></div>
<content tag="javascript">
<script type="text/javascript" src="<c:url value="/html/js/genesyshighcharts.min.js" />"></script>
<script type="text/javascript">
$(function () {
'use strict';
$.getJSON('/data', function (data) {
var mapData = Highcharts.geojson(Highcharts.maps['custom/world']);
$('#container').highcharts('Map', {
chart: {
borderWidth: 1
},
title: {
text: 'Accessions in genebanks around the world'
},
subtitle: {
text: 'Genesys data 2015'
},
legend: {
enabled: false
},
mapNavigation: {
enabled: true,
buttonOptions: {
verticalAlign: 'top'
}
},
series: [{
name: 'Accessions',
mapData: mapData,
color: '#88ba42',
enableMouseTracking: false
}, {
type: 'mapbubble',
mapData: mapData,
name: 'Number of accessions in genebanks',
joinBy: ['iso-a2', 'code'],
data: data,
minSize: 20,
maxSize: '12%',
tooltip: {
pointFormat: '{point.country}: {point.z}'
}
}]
});
});
});
</script>
</content>
</body>
</html>
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