Commit f2c1f4e5 by Chris Rodriguez

Leveraging flot to updating output, cleaner

parent 5e423414
...@@ -123,12 +123,14 @@ $(function () { ...@@ -123,12 +123,14 @@ $(function () {
if (series[k]['data'].length > 1) { if (series[k]['data'].length > 1) {
for (var m = 0; m < series[k]['data'].length; m++) { for (var m = 0; m < series[k]['data'].length; m++) {
s = {}; s = {};
s.data = m;
s.tick = series[k]['data'][m][0]; s.tick = series[k]['data'][m][0];
s.label = series[k]['label']; s.label = series[k]['label'];
series_order_object.push(s); series_order_object.push(s);
} }
} else { } else {
s = {}; s = {};
s.data = m;
s.tick = series[k]['data'][0][0]; s.tick = series[k]['data'][0][0];
s.label = series[k]['label']; s.label = series[k]['label'];
series_order_object.push(s); series_order_object.push(s);
...@@ -140,41 +142,6 @@ $(function () { ...@@ -140,41 +142,6 @@ $(function () {
return a.tick-b.tick; return a.tick-b.tick;
}); });
// add a new description property with the additional context
for (var n = 0; n < series_order_object.length; n++) {
if (detail_tooltips[series_order_object[n].label].length > 1) {
series_order_object[n].description = detail_tooltips[series_order_object[n].label][c];
if (droppedScores[0]) {
for (var m = 0; m < droppedScores[0].length; m++) {
if (series_order_object[n].tick === droppedScores[0][m]) {
series_order_object[n].description = series_order_object[n].description + ' ' + detail_tooltips["Dropped Scores"][0];
}
}
c++;
}
} else {
series_order_object[n].description = detail_tooltips[series_order_object[n].label][0];
if (droppedScores[0]) {
for (var m = 0; m < droppedScores[0].length; m++) {
if (series_order_object[n].tick === droppedScores[0][m]) {
series_order_object[n].description = series_order_object[n].description + ' ' + detail_tooltips["Dropped Scores"][0];
}
}
}
}
}
// update the ticks output to include the additional context from series_order_object
for (var i = 0; i < ticks.length; i++) {
if (series_order_object[i]) {
ticks[i][1] = '<span aria-hidden="true">' + ticks[i][1] + '</span> ' + '<span class="sr">' + series_order_object[i].description + '</span>';
}
}
// console.log(series)
console.log(series_order_object);
// console.log(droppedScores);
// console.log(detail_tooltips);
// hide the vertical axis since they are audibly lacking context // hide the vertical axis since they are audibly lacking context
for (var i = 0; i < grade_cutoff_ticks.length; i++) { for (var i = 0; i < grade_cutoff_ticks.length; i++) {
grade_cutoff_ticks[i][1] = '<span aria-hidden="true">' + grade_cutoff_ticks[i][1] + '</span>'; grade_cutoff_ticks[i][1] = '<span aria-hidden="true">' + grade_cutoff_ticks[i][1] + '</span>';
...@@ -211,7 +178,14 @@ $(function () { ...@@ -211,7 +178,14 @@ $(function () {
tickLength: 0, tickLength: 0,
min: 0.0, min: 0.0,
max: ${tickIndex - sectionSpacer}, max: ${tickIndex - sectionSpacer},
ticks: ticks, ticks: function() {
for (var i = 0; i < ticks.length; i++) {
if (series_order_object[i] && series_order_object[i].tick) {
ticks[i][1] = '<span class="aria-hidden=true">' + ticks[i][1] + '</span><span class="sr">' + detail_tooltips[series_order_object[i].label][series_order_object[i].data] + '</span>';
}
}
return ticks;
},
labelAngle: 90 labelAngle: 90
}, },
yaxis: { yaxis: {
...@@ -242,7 +216,7 @@ $(function () { ...@@ -242,7 +216,7 @@ $(function () {
} }
var previousPoint = null; var previousPoint = null;
$grade_detail_graph.bind("plothover", function (event, pos, item) { $grade_detail_graph.bind("plothover", function (event, pos, item) {
$("#x").text(pos.x.toFixed(2)); $("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2)); $("#y").text(pos.y.toFixed(2));
...@@ -256,7 +230,6 @@ $(function () { ...@@ -256,7 +230,6 @@ $(function () {
var series_tooltips = detail_tooltips[item.series.label]; var series_tooltips = detail_tooltips[item.series.label];
if (item.dataIndex < series_tooltips.length) { if (item.dataIndex < series_tooltips.length) {
var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2); var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, series_tooltips[item.dataIndex]); showTooltip(item.pageX, item.pageY, series_tooltips[item.dataIndex]);
} }
} }
......
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