LSP stats map coordinates (WIP)

This commit is contained in:
cat 2014-04-10 12:57:32 +02:00 committed by Thulinma
parent 6cbf81bdb9
commit d277ef3922
3 changed files with 306 additions and 143 deletions

View file

@ -455,8 +455,19 @@ button[disabled=disabled] {
margin: 0.1em; margin: 0.1em;
padding: 0 0.5em; padding: 0 0.5em;
} }
#graphcontainer .graph > .graphforeground {
width: 100%;
height: 100%;
display: block;
}
#graphcontainer .graph > .graphbackground {
position: absolute;
display: block;
opacity: 0.5;
}
#graphcontainer .graph { #graphcontainer .graph {
height: 250px; height: 400px;
margin: 0 auto;
} }
.legend { .legend {
font-size: 0.8em; font-size: 0.8em;

87
lsp/map.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 841 KiB

View file

@ -1535,6 +1535,69 @@ function showTab(tabName,streamName) {
$('#'+graph.id).children('.graph,.legend').html(''); $('#'+graph.id).children('.graph,.legend').html('');
return; return;
} }
switch (graph.type) {
case 'coords':
//format [lat,long]
var data = [[-54.657438,-65.11675],[49.725719,-1.941553],[-34.425464,172.677617],[76.958669,68.494178],[0,0]];
//correct latitude according to the Miller cylindrical projection
for (var i in data) {
var lat = data[i][0];
var lon = data[i][1];
//to radians
lat = Math.PI * lat / 180;
var y = 1.25 * Math.log(Math.tan(0.25 * Math.PI + 0.4 * lat));
data[i] = [lon,y];
}
console.log(data);
plotsets = [{data:data}];
//make sure the plot area has the correct height/width ratio
if ($('#'+graph.id+' .graphbackground').length == 0) {
var parent = $('#'+graph.id+' .graph');
var mapheight = 2450;
var mapwidth = 3386.08;
parent.height(parent.width()*mapheight/mapwidth);
var placeholder = $('<div>').addClass('graphforeground')
parent.html(
$('<img>').attr('src','map.svg').addClass('graphbackground').width(parent.width).height(parent.height())
).append(
placeholder
);
}
else {
var placeholder = $('#'+graph.id+' .graphforeground');
}
plot = $.plot(
placeholder,
plotsets,
{
legend: {show: false},
xaxis: {
show: false,
min: -170,
max: 190
},
yaxis: {
show: false,
min: -2.248101053,
max: 2.073709536
},
series: {
lines: {show: false},
points: {show: true}
},
grid: {
hoverable: true,
margin: 0,
border: 0,
borderWidth: 0,
minBorderMargin: 0
}
}
);
break;
case 'time':
case 'default':
var yaxes = []; var yaxes = [];
var yaxesTemplates = { var yaxesTemplates = {
percentage: { percentage: {
@ -1685,6 +1748,8 @@ function showTab(tabName,streamName) {
} }
} }
); );
break;
} //end of graph type switch
$('#'+graph.id+' .legend').html( $('#'+graph.id+' .legend').html(
$('<div>').addClass('legend-list').addClass('checklist') $('<div>').addClass('legend-list').addClass('checklist')
); );