added boat speed gauge
This commit is contained in:
@@ -155,7 +155,7 @@ rowingmetrics = (
|
||||
'verbose_name': 'Drive Length (m)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 2.5,
|
||||
'mode':'both',
|
||||
'mode':'rower',
|
||||
'type': 'pro',
|
||||
'group':'stroke'}),
|
||||
|
||||
|
||||
@@ -174,6 +174,9 @@
|
||||
{% for id, metric in metrics.items %}
|
||||
document.getElementById("{{ id }}").innerHTML = {{ id }}_now;
|
||||
{% endfor %}
|
||||
{% for group in metricsgroups %}
|
||||
set_{{ group }}();
|
||||
{% endfor %}
|
||||
// gauge.set(catch_now);
|
||||
try {
|
||||
var newLatLng = new L.LatLng(lat, lon);
|
||||
@@ -239,33 +242,11 @@
|
||||
</span> {{ metric.unit }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
<!-- <li class="grid_2">
|
||||
<canvas id="angles"></canvas>
|
||||
<script type="text/javascript" src="https://bernii.github.io/gauge.js/dist/gauge.js"></script>
|
||||
<script>
|
||||
|
||||
var opts = {
|
||||
lines: 12,
|
||||
angle: 0.15,
|
||||
lineWidth: 0.44,
|
||||
pointer: {
|
||||
length: 0.9,
|
||||
strokeWidth: 0.035,
|
||||
color: '#000000'
|
||||
},
|
||||
limitMax: 'false',
|
||||
// percentColors: [[0.0, "#a9d70b" ], [0.50, "#a9d70b"], [1.0, "#a9d70b"]], // !!!!
|
||||
strokeColor: '#E0E0E0',
|
||||
generateGradient: true
|
||||
};
|
||||
var target = document.getElementById('angles');
|
||||
var gauge = new Gauge(target).setOptions(opts);
|
||||
gauge.maxValue = 90;
|
||||
gauge.minValue = -90;
|
||||
gauge.animationSpeed = 5;
|
||||
gauge.set(-75);
|
||||
</script>
|
||||
</li> -->
|
||||
{% for group in metricsgroups %}
|
||||
<li class="grid_2">
|
||||
<canvas id="{{ group }}"></canvas>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<p> </p>
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
@@ -360,6 +341,8 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="https://bernii.github.io/gauge.js/dist/gauge.js"></script>
|
||||
<script type="text/javascript" src="{% static 'js/videogauges.js' %}"></script>
|
||||
{% endlanguage %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -138,6 +138,7 @@ def workout_video_view(request,id=''):
|
||||
|
||||
]
|
||||
|
||||
|
||||
return render(request,
|
||||
'embedded_video.html',
|
||||
{
|
||||
@@ -154,6 +155,7 @@ def workout_video_view(request,id=''):
|
||||
'metrics':metrics,
|
||||
'locked': True,
|
||||
'metricsform':metricsform,
|
||||
'metricsgroups': metricsgroups,
|
||||
})
|
||||
|
||||
|
||||
@@ -261,6 +263,7 @@ def workout_video_create_view(request,id=0):
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'maxtime':maxtime,
|
||||
'metrics':metrics,
|
||||
'metricsgroups': metricsgroups,
|
||||
'locked': False,
|
||||
})
|
||||
|
||||
|
||||
60
static/js/videogauges.js
Normal file
60
static/js/videogauges.js
Normal file
@@ -0,0 +1,60 @@
|
||||
// var opts = {
|
||||
// lines: 12,
|
||||
// angle: 0.15,
|
||||
// lineWidth: 0.44,
|
||||
// pointer: {
|
||||
// length: 0.9,
|
||||
// strokeWidth: 0.035,
|
||||
// color: '#000000'
|
||||
// },
|
||||
// limitMax: 'false',
|
||||
// // percentColors: [[0.0, "#a9d70b" ], [0.50, "#a9d70b"], [1.0, "#a9d70b"]], // !!!!
|
||||
// strokeColor: '#E0E0E0',
|
||||
// generateGradient: true
|
||||
// };
|
||||
// var target = document.getElementById('angles');
|
||||
// var gauge = new Gauge(target).setOptions(opts);
|
||||
// gauge.maxValue = 90;
|
||||
// gauge.minValue = -90;
|
||||
// gauge.animationSpeed = 5;
|
||||
// gauge.set(-75);
|
||||
|
||||
// https://github.com/bernii/gauge.js/issues/193
|
||||
|
||||
|
||||
var opts = {
|
||||
angle: 0, // The span of the gauge arc
|
||||
lineWidth: 0.2, // The line thickness
|
||||
radiusScale: 0.89, // Relative radius
|
||||
pointer: {
|
||||
length: 0.54, // // Relative to gauge radius
|
||||
strokeWidth: 0.053, // The thickness
|
||||
color: '#000000' // Fill color
|
||||
},
|
||||
limitMax: false, // If false, max value increases automatically if value > maxValue
|
||||
limitMin: false, // If true, the min value of the gauge will be fixed
|
||||
colorStart: '#6FADCF', // Colors
|
||||
colorStop: '#8FC0DA', // just experiment with them
|
||||
strokeColor: '#E0E0E0', // to see which ones work best for you
|
||||
generateGradient: true,
|
||||
highDpiSupport: true, // High resolution support
|
||||
staticZones: [
|
||||
{strokeStyle: "#00FF00", min: 0, max: 1}, // Red from 100 to 60
|
||||
{strokeStyle: "#0000FF", min: 1, max: 2}, // Yellow
|
||||
{strokeStyle: "#00FFFF", min: 2, max: 3}, // Green
|
||||
{strokeStyle: "#FFDD00", min: 3, max: 5}, // Yellow
|
||||
{strokeStyle: "#FF0000", min: 5, max: 6} // Red
|
||||
],
|
||||
|
||||
};
|
||||
var target = document.getElementById('basic'); // your canvas element
|
||||
var gaugeboatspeed = new Gauge(target).setOptions(opts); // create sexy gauge!
|
||||
gaugeboatspeed.maxValue = 6; // set max gauge value
|
||||
gaugeboatspeed.setMinValue(0); // Prefer setter over gauge.minValue = 0
|
||||
gaugeboatspeed.animationSpeed = 50; // set animation speed (32 is default value)
|
||||
gaugeboatspeed.set(0); // set actual value
|
||||
|
||||
// Define set_basic(values) so that gauges can be set by metricsgroups
|
||||
function set_basic() {
|
||||
gaugeboatspeed.set(boatspeed_now);
|
||||
}
|
||||
Reference in New Issue
Block a user