playing with gauges
This commit is contained in:
@@ -254,7 +254,7 @@ function copyText() {
|
|||||||
// catchangle = ctch[Math.round(datatime)];
|
// catchangle = ctch[Math.round(datatime)];
|
||||||
{% for id, metric in metrics.items %}
|
{% for id, metric in metrics.items %}
|
||||||
{{ id }}_now = {{ id }}_values[Math.round(datatime)];
|
{{ id }}_now = {{ id }}_values[Math.round(datatime)];
|
||||||
// console.log(datatime,{{ id }}_now, "{{ metric.name }}")
|
// console.log(datatime,{{ id }},{{ id }}_now, "{{ metric.name }}")
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
@@ -374,11 +374,21 @@ function copyText() {
|
|||||||
</span> {{ metric.unit }}
|
</span> {{ metric.unit }}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% for group in metricsgroups %}
|
</ul>
|
||||||
<li class="grid_2">
|
<ul class="main-content">
|
||||||
<div id="{{ group }}"></div>
|
{% if 'basic' in metricsgroups %}
|
||||||
|
<li class="grid_1">
|
||||||
|
<div id="basic_spm"></div>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
<li class="grid_1">
|
||||||
|
<div id="basic_boatspeed"></div>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if 'forcepower' in metricsgroups %}
|
||||||
|
<li class="grid_1">
|
||||||
|
<div id="forcepower_power"></div>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
@@ -394,6 +404,22 @@ function copyText() {
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
|
// gauge settings
|
||||||
|
{% if workout.workouttype != 'water' %}
|
||||||
|
speedoptions.max = 7;
|
||||||
|
speedoptions.redTo = 7;
|
||||||
|
speedoptions.majorTicks = ['0','1','2','3','4','5','6','7'];
|
||||||
|
{% endif %}
|
||||||
|
{% if 'forcepower' in metricsgroups %}
|
||||||
|
poweroptions.max = {{ rower.pw_an|add:100|round100 }};
|
||||||
|
poweroptions.greenFrom = {{ rower.pw_ut2 }};
|
||||||
|
poweroptions.greenTo = {{ rower.pw_at }};
|
||||||
|
poweroptions.yellowFrom = {{ rower.pw_at }};
|
||||||
|
poweroptions.yellowTo = {{ rower.pw_an }};
|
||||||
|
poweroptions.redFrom = {{ rower.pw_an }};
|
||||||
|
poweroptions.redTo = {{ rower.pw_an|add:200|round100 }};
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
// cookie reader
|
// cookie reader
|
||||||
function createCookie(name,value,days) {
|
function createCookie(name,value,days) {
|
||||||
if (days) {
|
if (days) {
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ def is_coach(rower,rowers):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def strfdeltah(tdelta):
|
def strfdeltah(tdelta):
|
||||||
hours, rest = divmod(tdelta.seconds,3600)
|
hours, rest = divmod(tdelta.seconds,3600)
|
||||||
minutes,seconds = divmod(rest,60)
|
minutes,seconds = divmod(rest,60)
|
||||||
@@ -762,6 +764,3 @@ def previousworkout(workout,user):
|
|||||||
return encoder.encode_hex(ws[0].id)
|
return encoder.encode_hex(ws[0].id)
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,23 @@
|
|||||||
google.charts.load('current', {'packages':['gauge']});
|
google.charts.load('current', {'packages':['gauge']});
|
||||||
google.charts.setOnLoadCallback(drawSPMChart);
|
google.charts.setOnLoadCallback(drawSPMChart);
|
||||||
|
google.charts.setOnLoadCallback(drawSpeedChart);
|
||||||
|
google.charts.setOnLoadCallback(drawPowerChart);
|
||||||
|
|
||||||
var spmdata = [
|
var spmdata = [
|
||||||
['Label', 'Value'],
|
['Label', 'Value'],
|
||||||
['SPM', 21.0],
|
['SPM', 21.0],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var speeddata = [
|
||||||
|
['Label', 'Value'],
|
||||||
|
['V m/s', 0.0],
|
||||||
|
];
|
||||||
|
|
||||||
|
var powerdata = [
|
||||||
|
['Label','Value'],
|
||||||
|
['PWR',150],
|
||||||
|
]
|
||||||
|
|
||||||
var spmoptions = {
|
var spmoptions = {
|
||||||
min:0, max: 50,
|
min:0, max: 50,
|
||||||
width: 400, height: 120,
|
width: 400, height: 120,
|
||||||
@@ -17,17 +28,42 @@ var spmoptions = {
|
|||||||
minorTicks: 10
|
minorTicks: 10
|
||||||
};
|
};
|
||||||
|
|
||||||
var data = null;
|
var speedoptions = {
|
||||||
|
min:0, max: 6,
|
||||||
|
width: 400, height: 120,
|
||||||
|
greenFrom: 2, greenTo: 4,
|
||||||
|
yellowFrom: 4,yellowTo: 5,
|
||||||
|
redFrom: 5, redTo: 6,
|
||||||
|
majorTicks: ['0','1','2','3','4','5','6'],
|
||||||
|
minorTicks: 10
|
||||||
|
};
|
||||||
|
|
||||||
|
var poweroptions = {
|
||||||
|
min: 0, max: 1000,
|
||||||
|
width: 400, height: 120,
|
||||||
|
greenFrom: 100, greenTo: 200,
|
||||||
|
yellowFrom: 200,yellowTo: 400,
|
||||||
|
redFrom: 400, redTo: 1000,
|
||||||
|
majorTicks: ['0','200','400','600','800','1000'],
|
||||||
|
minorTicks: 5
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var dataspm = null;
|
||||||
|
var dataspeed = null;
|
||||||
var spmchart = null;
|
var spmchart = null;
|
||||||
|
var speedchart = null;
|
||||||
|
var powerchart = null;
|
||||||
|
var datapower = null;
|
||||||
|
|
||||||
// SPM chart
|
// SPM chart
|
||||||
function drawSPMChart() {
|
function drawSPMChart() {
|
||||||
|
|
||||||
data = new google.visualization.arrayToDataTable(spmdata);
|
dataspm = new google.visualization.arrayToDataTable(spmdata);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
spmchart = new google.visualization.Gauge(document.getElementById('basic'));
|
spmchart = new google.visualization.Gauge(document.getElementById('basic_spm'));
|
||||||
|
|
||||||
// spmchart.draw(data, spmoptions);
|
// spmchart.draw(data, spmoptions);
|
||||||
|
|
||||||
@@ -35,8 +71,37 @@ function drawSPMChart() {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var spmchart;
|
// Speed Chart
|
||||||
function set_basic() {
|
function drawSpeedChart() {
|
||||||
data.setCell(0,1,spm_now);
|
dataspeed = new google.visualization.arrayToDataTable(speeddata);
|
||||||
spmchart.draw(data, spmoptions)
|
|
||||||
|
speedchart = new google.visualization.Gauge(document.getElementById('basic_boatspeed'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Power chart
|
||||||
|
function drawPowerChart() {
|
||||||
|
datapower = new google.visualization.arrayToDataTable(powerdata);
|
||||||
|
powerchart = new google.visualization.Gauge(document.getElementById('forcepower_power'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_basic() {
|
||||||
|
dataspm.setCell(0,1,spm_now);
|
||||||
|
spmchart.draw(dataspm, spmoptions);
|
||||||
|
|
||||||
|
dataspeed.setCell(0,1,boatspeed_now);
|
||||||
|
speedchart.draw(dataspeed,speedoptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_athlete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_stroke() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_forcepower() {
|
||||||
|
datapower.setCell(0,1,power_now);
|
||||||
|
powerchart.draw(datapower,poweroptions);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user