Removed course overview graph, (course detail graph still remains).
This commit is contained in:
@@ -90,8 +90,7 @@ $(function() {
|
||||
<h1>Course Progress</h1>
|
||||
|
||||
<div id="grade-detail-graph" style="width:650px;height:200px;"></div>
|
||||
<div id="grade-overview-graph" style="width:650px;height:130px;"></div>
|
||||
|
||||
|
||||
<ol>
|
||||
<%
|
||||
lastChapter = None
|
||||
|
||||
@@ -123,83 +123,4 @@ $(function () {
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* ------------------------------- Grade overview graph ------------------------------- */
|
||||
series = [];
|
||||
ticks = [];
|
||||
var markings = [];
|
||||
var overview_tooltips = {};
|
||||
<%
|
||||
totalWeight = 0.0
|
||||
sectionIndex = 0
|
||||
totalScore = 0.0
|
||||
%>
|
||||
%for section in grade_summary:
|
||||
%if section['totalscore']['score'] > 0:
|
||||
series.push({label: "${section['category']}",
|
||||
data: [[${section['totalscore']['score'] * section['weight']}, 1]],
|
||||
color: colors[${sectionIndex}].toString(),
|
||||
##We need at least one to be on xaxis 2 for the second xaxis labels to show up
|
||||
${"xaxis: 2" if sectionIndex % 2 == 0 else ""} });
|
||||
%endif
|
||||
|
||||
ticks.push( [${totalWeight + section['weight'] * 0.5}, "${'{} - {:.0%}'.format(section['category'], section['weight'])}" ] );
|
||||
|
||||
markings.push({xaxis: {from: ${totalWeight}, to: ${totalWeight + section['weight']} }, color:colors[${sectionIndex}].scale("a", 0.6).toString() });
|
||||
|
||||
overview_tooltips["${section['category']}"] = [ "${section['totalscore']['summary']}" ];
|
||||
<%
|
||||
sectionIndex += 1
|
||||
totalWeight += section['weight']
|
||||
totalScore += section['totalscore']['score'] * section['weight']
|
||||
%>
|
||||
%endfor
|
||||
|
||||
options = {
|
||||
series: {stack: 0,
|
||||
lines: {show: false, steps: false },
|
||||
bars: {show: true, barWidth: 0.8, align: 'center', horizontal: true, linewidth:0, fill:1},},
|
||||
xaxis: {min: 0.0, max: 1.0},
|
||||
yaxis: {min: 0.0, max: 2.0, labelWidth:50, ticks:[[1.18,"Grade Totals"]], tickLength: 0},
|
||||
xaxes: [ {ticks: [[0.87, "A 87%"], [0.7, "B 70%"], [0.6, "C 60%"]], position: top},
|
||||
{ticks: ticks }],
|
||||
grid: { markings: markings, hoverable: true, clickable: true, borderWidth: 1},
|
||||
legend: {show: false},
|
||||
};
|
||||
|
||||
var $gradeOverviewGraph = $("#grade-overview-graph");
|
||||
if ($gradeOverviewGraph.length > 0) {
|
||||
var plot = $.plot($gradeOverviewGraph, series, options);
|
||||
|
||||
//Put the percent on the graph
|
||||
var o = plot.pointOffset({x: ${totalScore}, y: 1 });
|
||||
$gradeOverviewGraph.append('<div style="position:absolute;left:' + (o.left + 4) + 'px;top:' + (o.top - 10) + 'px">${"{:.0%}".format(totalScore)}</div>');
|
||||
|
||||
|
||||
$gradeOverviewGraph.bind("plothover", function (event, pos, item) {
|
||||
$("#x").text(pos.x.toFixed(2));
|
||||
$("#y").text(pos.y.toFixed(2));
|
||||
if (item) {
|
||||
if (previousPoint != (item.dataIndex, item.seriesIndex)) {
|
||||
previousPoint = (item.dataIndex, item.seriesIndex);
|
||||
|
||||
$("#tooltip").remove();
|
||||
|
||||
if (item.series.label in overview_tooltips) {
|
||||
var series_tooltips = overview_tooltips[item.series.label];
|
||||
if (item.dataIndex < series_tooltips.length) {
|
||||
var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2);
|
||||
|
||||
showTooltip(item.pageX, item.pageY, series_tooltips[item.dataIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$("#tooltip").remove();
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user