ajax call for history chart
This commit is contained in:
@@ -5,11 +5,23 @@
|
|||||||
{% block title %}Rowsandall {% endblock %}
|
{% block title %}Rowsandall {% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
<div id="id_css_res">
|
||||||
<ul class="main-content">
|
|
||||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.css" type="text/css" />
|
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.4.min.css" type="text/css" />
|
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.4.min.css" type="text/css" />
|
||||||
<script async="true" src="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.js"></script>
|
</div>
|
||||||
|
<div id="id_js_res">
|
||||||
|
<script src="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.js"></script>
|
||||||
|
<script src="https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.4.min.js"></script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script async="true" type="text/javascript">
|
||||||
|
Bokeh.set_log_level("info");
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="id_script">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="main-content">
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<h1>History for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
<h1>History for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
</li>
|
</li>
|
||||||
@@ -62,7 +74,9 @@
|
|||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<div>{{ totalscript|safe }}{{ totaldiv|safe }}</div>
|
<div id="id_chart">
|
||||||
|
{{ totaldiv|safe }}
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% for ddict in typedicts %}
|
{% for ddict in typedicts %}
|
||||||
@@ -103,6 +117,30 @@
|
|||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
<script type='text/javascript'
|
||||||
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function($) {
|
||||||
|
console.log('loading script for chart');
|
||||||
|
|
||||||
|
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/history/user/{{ rower.user.id }}/data/', function(json) {
|
||||||
|
|
||||||
|
var script = json.script;
|
||||||
|
var div = json.div;
|
||||||
|
$("#id_sitready").remove();
|
||||||
|
$("#id_chart").append(div);
|
||||||
|
console.log(div);
|
||||||
|
// $("#id_script").append("<s"+"cript>"+script+"</s"+"cript>");
|
||||||
|
$("#id_script").append(script);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
|
|||||||
@@ -4747,8 +4747,11 @@ def history_view(request,userid=0):
|
|||||||
|
|
||||||
|
|
||||||
# interactive hr pie chart
|
# interactive hr pie chart
|
||||||
|
totalscript = ''
|
||||||
|
totaldiv = get_call()
|
||||||
if typeselect == 'All':
|
if typeselect == 'All':
|
||||||
totalscript,totaldiv = interactive_hr_piechart(df,r,'All Workouts')
|
pass
|
||||||
|
#totalscript,totaldiv = interactive_hr_piechart(df,r,'All Workouts')
|
||||||
else:
|
else:
|
||||||
a_workouts = g_workouts.filter(workouttype=typeselect)
|
a_workouts = g_workouts.filter(workouttype=typeselect)
|
||||||
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
|
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
|
||||||
@@ -4758,7 +4761,7 @@ def history_view(request,userid=0):
|
|||||||
pass
|
pass
|
||||||
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
|
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
|
||||||
ignoreadvanced=True)
|
ignoreadvanced=True)
|
||||||
totalscript, totaldiv = interactive_hr_piechart(ddf,r,mytypes.workouttypes_ordered[typeselect])
|
#totalscript, totaldiv = interactive_hr_piechart(ddf,r,mytypes.workouttypes_ordered[typeselect])
|
||||||
|
|
||||||
# interactive power pie chart
|
# interactive power pie chart
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user