{% extends "base.html" %}
{% load staticfiles %}
{% load rowerfilters %}

{% block title %}Compare Workouts {% endblock %}

{% block content %}

	<script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
	<script async="true" type="text/javascript">
    Bokeh.set_log_level("info");
	</script>

	{{ interactiveplot |safe }}

    <script>
    // Set things up to resize the plot on a window resize. You can play with
    // the arguments of resize_width_height() to change the plot's behavior.
    var plot_resize_setup = function () {
        var plotid = Object.keys(Bokeh.index)[0]; // assume we have just one plot
        var plot = Bokeh.index[plotid];
        var plotresizer = function() {
            // arguments: use width, use height, maintain aspect ratio
            plot.resize_width_height(true, true, false);
        };
        window.addEventListener('resize', plotresizer);
        plotresizer();
    };
    window.addEventListener('load', plot_resize_setup);
    </script>
    <style>
    /* Need this to get the page in "desktop mode"; not having an infinite height.*/
    html, body {height: 100%; margin:5px;}
    </style>


<div id="other" class="grid_12 alpha">
	<div class="grid_2 alpha suffix_10">
		<a class="button blue small" 
		href="/rowers/workout/compare/{{ id2 }}/{{ id1 }}/{{ xparam }}/{{ yparam }}">Swap Workouts</a>
	</div>
</div>

<p>&nbsp;</p>

<div id="plotbuttons" class="grid_12 alpha">
	<div id="x-axis" class="grid_6 alpha">
		<div class="grid_2 alpha">
		<a class="button blue small" href="/rowers/workout/compare/{{ id1 }}/{{ id2 }}/time/{{ yparam }}">Time</a>
		</div>
		<div class="grid_2 suffix_2 omega">
		<a class="button blue small" href="/rowers/workout/compare/{{ id1 }}/{{ id2 }}/distance/{{ yparam }}">Distance</a>
		</div>
	</div>

	<div id="y-axis" class="grid_6 omega">
		<div class="grid_2 alpha">
		<a class="button blue small" href="/rowers/workout/compare/{{ id1 }}/{{ id2 }}/{{ xparam }}/pace">Pace</a>
		</div>
		<div class="grid_2">
		<a class="button blue small" href="/rowers/workout/compare/{{ id1 }}/{{ id2 }}/{{ xparam }}/hr">Heart Rate</a>
		</div>
		<div class="grid_2 omega">
		<a class="button blue small" href="/rowers/workout/compare/{{ id1 }}/{{ id2 }}/{{ xparam }}/spm">SPM</a>
		</div>
	</div>

</div>

<div id="theplot" class="grid_12 alpha">


    {{ the_div|safe }}

</div>

{% endblock %}