Commit 6f0f2678 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added average score line to progress graph

parent b264aeca
avg = 0
avg += value for [label, value] in window.data
avg /= window.data.length
$.jqplot 'plot', [window.data], $.jqplot 'plot', [window.data],
title: window.text.title title: window.text.title
axes: axes:
...@@ -11,3 +15,16 @@ $.jqplot 'plot', [window.data], ...@@ -11,3 +15,16 @@ $.jqplot 'plot', [window.data],
seriesDefaults: seriesDefaults:
markerOptions: markerOptions:
size: 20 size: 20
canvasOverlay:
show: true
objects: [
horizontalLine:
name: 'avg'
y: avg
lineWidth: 1
color: '#b5b5b5'
shadow: false
showTooltip: true
tooltipFormatString: 'avg: %2$.4f'
showTooltipPrecision: .1
]
...@@ -158,8 +158,8 @@ msgstr "%d meter" ...@@ -158,8 +158,8 @@ msgstr "%d meter"
msgid "YYYY-MM-DD" msgid "YYYY-MM-DD"
msgstr "JJJJ-MM-DD" msgstr "JJJJ-MM-DD"
msgid "Average score over time" msgid "Average arrow score over time"
msgstr "Gemiddelde score over tijd" msgstr "Gemiddelde pijlscore over tijd"
msgid "Progress graph" msgid "Progress graph"
msgstr "Voortgangsgrafiek" msgstr "Voortgangsgrafiek"
......
{extends "../layout.latte"} {extends "../layout.latte"}
{block head}
<link rel="stylesheet" type="text/css" href="jqplot/jquery.jqplot.min.css" />
{/block}
{block content} {block content}
<div id="plot" class="plot"></div> <div id="plot" class="plot"></div>
{$form} {$form}
...@@ -9,6 +13,7 @@ ...@@ -9,6 +13,7 @@
<script type="text/javascript" src="jqplot/jquery.jqplot.min.js"></script> <script type="text/javascript" src="jqplot/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="jqplot/plugins/jqplot.highlighter.min.js"></script> <script type="text/javascript" src="jqplot/plugins/jqplot.highlighter.min.js"></script>
<script type="text/javascript" src="jqplot/plugins/jqplot.dateAxisRenderer.min.js"></script> <script type="text/javascript" src="jqplot/plugins/jqplot.dateAxisRenderer.min.js"></script>
<script type="text/javascript" src="jqplot/plugins/jqplot.canvasOverlay.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
window.data = [ window.data = [
{foreach $matches as $match} {foreach $matches as $match}
...@@ -16,12 +21,8 @@ ...@@ -16,12 +21,8 @@
{/foreach} {/foreach}
]; ];
window.text = { window.text = {
title: {_'Average score over time'} title: {_'Average arrow score over time'}
}; };
</script> </script>
<script type="text/javascript" src="js/plot.js"></script> <script type="text/javascript" src="js/plot.js"></script>
{/block} {/block}
{block head}
<link rel="stylesheet" type="text/css" href="jqplot/jquery.jqplot.min.css" />
{/block}
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