From b376bc09a3639eb4f5cdc0ee39ca2463dfd6d5d9 Mon Sep 17 00:00:00 2001 From: kimth Date: Sun, 23 Sep 2012 18:46:10 -0700 Subject: [PATCH] Arbitrary progress bar coloring --- lms/templates/courseware/progress_graph.js | 25 +++++----------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/lms/templates/courseware/progress_graph.js b/lms/templates/courseware/progress_graph.js index 3b6320daf5..b2fcda67b5 100644 --- a/lms/templates/courseware/progress_graph.js +++ b/lms/templates/courseware/progress_graph.js @@ -19,15 +19,6 @@ $(function () { }).appendTo("body").fadeIn(200); } - function sortGradeCutoffs(obj) { - var arr = []; - for (var prop in obj) - if (obj.hasOwnProperty(prop)) - arr.push({'key': prop, 'value': obj[prop]}); - arr.sort(function(a, b) { return b.value - a.value; }); - return arr.map(function (el) { return el.key; }); - } - /* -------------------------------- Grade detail bars -------------------------------- */ <% @@ -123,19 +114,13 @@ $(function () { series.push( {label: 'Dropped Scores', data: droppedScores, points: {symbol: "cross", show: true, radius: 3}, bars: {show: false}, color: "#333"} ); // Allow for arbitrary grade markers e.g. ['A', 'B', 'C'], ['Pass'], etc. - // by building the grade markers and grid markings from the `grade_cutoffs` object - var grade_cutoffs = JSON.parse('${ json.dumps(grade_cutoffs) }'); - descending_grades = sortGradeCutoffs(grade_cutoffs); + var ascending_grades = grade_cutoff_ticks.map(function (el) { return el[0]; }); + ascending_grades.sort(); - var colors = ['#ddd', '#e9e9e9', '#f3f3f3']; + var colors = ['#f3f3f3', '#e9e9e9', '#ddd']; var markings = []; - var marking_from, marking_to = 1; - for(var i=0; i