Commit d5aa7532 by Bridger Maxwell

Fixed graph bug that threw error if div didn't exist.

parent 40a6c55b
......@@ -94,7 +94,9 @@ $(function () {
legend: {show: false},
};
if ($("#grade-detail-graph").length > 0) {
$.plot($("#grade-detail-graph"), series, options);
}
var previousPoint = null;
$("#grade-detail-graph").bind("plothover", function (event, pos, item) {
......@@ -167,6 +169,7 @@ $(function () {
};
var $gradeOverviewGraph = $("#grade-overview-graph");
if ($gradeOverviewGraph.length > 0) {
var plot = $.plot($gradeOverviewGraph, series, options);
//Put the percent on the graph
......@@ -174,7 +177,7 @@ $(function () {
$gradeOverviewGraph.append('<div style="position:absolute;left:' + (o.left + 4) + 'px;top:' + (o.top - 10) + 'px">${"{:.0%}".format(totalScore)}</div>');
$("#grade-overview-graph").bind("plothover", function (event, pos, item) {
$gradeOverviewGraph.bind("plothover", function (event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if (item) {
......@@ -198,5 +201,5 @@ $(function () {
previousPoint = null;
}
});
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment