From 59ff6ce7df96a9a2d3032ddb42839ba12fa26fc8 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Fri, 10 Feb 2012 12:35:42 -0500 Subject: [PATCH] Added percentage label to course overview progress --HG-- branch : bridger-dev --- profile_graphs.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/profile_graphs.js b/profile_graphs.js index 43e15937d9..171cacc7f3 100644 --- a/profile_graphs.js +++ b/profile_graphs.js @@ -88,15 +88,16 @@ $(function () { totalWeight = 0.0 sectionIndex = 0 totalScore = 0.0 + overviewBarX = tickIndex %> %for section in grade_summary: <% weighted_score = section['totalscore']['score'] * section['weight'] - summary_text = "{0} - {1:.0%} of possible {2:.0%}".format(section['category'], weighted_score, section['weight']) + summary_text = "{0} - {1:.0%} of a possible {2:.0%}".format(section['category'], weighted_score, section['weight']) %> %if section['totalscore']['score'] > 0: series.push({label: "${section['category']} - Weighted", - data: [[${tickIndex}, ${weighted_score}]], + data: [[${overviewBarX}, ${weighted_score}]], color: colors[${sectionIndex}].toString(), }); %endif @@ -124,9 +125,16 @@ $(function () { legend: {show: false}, }; - if ($("#grade-detail-graph").length > 0) { - $.plot($("#grade-detail-graph"), series, options); + var $grade_detail_graph = $("#grade-detail-graph"); + if ($grade_detail_graph.length > 0) { + var plot = $.plot($grade_detail_graph, series, options); + + var o = plot.pointOffset({x: ${overviewBarX} , y: ${totalScore}}); + $grade_detail_graph.append('
${"{:.0%}".format(totalScore)}
'); } + + + var previousPoint = null; $("#grade-detail-graph").bind("plothover", function (event, pos, item) {