Issue 54 - Fix lint errors

This commit is contained in:
perryharlock
2013-11-11 15:53:28 +00:00
parent e6ab5c21a0
commit c82d8475bd
2 changed files with 34 additions and 30 deletions

View File

@@ -17,15 +17,15 @@ $(document).ready(function(){
hoverable: true hoverable: true
}, },
xaxis: { xaxis: {
mode: "categories", mode: 'categories',
tickLength: 0 tickLength: 0
}, },
lines: { lines: {
lineWidth: 3 lineWidth: 3
}, },
grid: { grid: {
backgroundColor: "#fff", backgroundColor: '#fff',
borderColor: "#808080", borderColor: '#808080',
hoverable: true, hoverable: true,
clickable: true, clickable: true,
borderWidth: { borderWidth: {
@@ -36,7 +36,7 @@ $(document).ready(function(){
} }
}, },
selection: { selection: {
mode: "x" mode: 'x'
} }
}; };
@@ -132,9 +132,9 @@ $(document).ready(function(){
function getData() { function getData() {
return [ return [
{ color: "rgb(231, 76, 60)", label: "Errors", data: data.error }, { color: 'rgb(231, 76, 60)', label: 'Errors', data: data.error },
{ color: "rgb(243, 156, 18)", label: "Warnings", data: data.warning }, { color: 'rgb(243, 156, 18)', label: 'Warnings', data: data.warning },
{ color: "rgb(52, 152, 219)", label: "Notices", data: data.notice } { color: 'rgb(52, 152, 219)', label: 'Notices', data: data.notice }
]; ];
} }
@@ -142,7 +142,7 @@ $(document).ready(function(){
zoomResetButton.toggleClass('hidden'); zoomResetButton.toggleClass('hidden');
} }
graphContainer.bind("plotselected", function (event, ranges) { graphContainer.bind('plotselected', function (event, ranges) {
// clamp the zooming to prevent eternal zoom // clamp the zooming to prevent eternal zoom
if (ranges.xaxis.to - ranges.xaxis.from < 0.00001) { if (ranges.xaxis.to - ranges.xaxis.from < 0.00001) {
ranges.xaxis.to = ranges.xaxis.from + 0.00001; ranges.xaxis.to = ranges.xaxis.from + 0.00001;
@@ -167,15 +167,20 @@ $(document).ready(function(){
$.each(datasets, function(key, val) { $.each(datasets, function(key, val) {
var lowerCaseValue = (val.label.substring(0, val.label.length - 1)).toLowerCase(); var lowerCaseValue = (val.label.substring(0, val.label.length - 1)).toLowerCase();
choiceContainer.append("<li class='text-center "+ lowerCaseValue +"'><label for='id" + key + "'><input type='checkbox' name='" + key + "' checked='checked' id='id" + key + "'/><span class='stat-type'>" + val.label + "</span></label></li>"); choiceContainer.append('<li class="text-center '+
lowerCaseValue +'"><label for="id' + key +
'"><input type="checkbox" name="' + key +
'" checked="checked" id="id' + key +
'"/><span class="stat-type">' + val.label +
'</span></label></li>');
}); });
choiceContainer.find("input").click(plotAccordingToChoices); choiceContainer.find('input').click(plotAccordingToChoices);
function plotAccordingToChoices() { function plotAccordingToChoices() {
var data = []; var data = [];
choiceContainer.find("input:checked").each(function () { choiceContainer.find('input:checked').each(function () {
var key = $(this).attr("name"); var key = $(this).attr('name');
if (key && datasets[key]) { if (key && datasets[key]) {
data.push(datasets[key]); data.push(datasets[key]);
} }
@@ -187,24 +192,23 @@ $(document).ready(function(){
} }
function showTooltip(x, y, contents) { function showTooltip(x, y, contents) {
$("<div data-role='tooltip' class='tooltip in'><div class='tooltip-inner'>" + contents + "</div></div>").css({ $('<div data-role="tooltip" class="tooltip in"><div class="tooltip-inner">' +
top: y + 5, contents +
left: x + 5 '</div></div>').css({top: y + 5,left: x + 5}).appendTo('body').fadeIn(200);
}).appendTo("body").fadeIn(200);
} }
var previousPoint = null; var previousPoint = null;
graphContainer.bind("plothover", function (event, pos, item) { graphContainer.bind('plothover', function (event, pos, item) {
if (item) { if (item) {
if (previousPoint != item.dataIndex) { if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex; previousPoint = item.dataIndex;
$("[data-role='tooltip']").remove(); $('[data-role="tooltip"]').remove();
var y = item.datapoint[1].toFixed(0); var y = item.datapoint[1].toFixed(0);
var contents = "<h6 class='crunch'>" + y + " " + item.series.label + "</h6>"; var contents = '<h6 class="crunch">' + y + ' ' + item.series.label + '</h6>';
showTooltip(item.pageX, item.pageY, contents); showTooltip(item.pageX, item.pageY, contents);
} }
} else { } else {
$("[data-role='tooltip']").remove(); $('[data-role="tooltip"]').remove();
previousPoint = null; previousPoint = null;
} }
}); });

File diff suppressed because one or more lines are too long