Skip to content

Commit

Permalink
codacy code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSkender committed Sep 7, 2024
1 parent 1f640bf commit a298c9f
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions Client/src/assets/js/chartjs-plugin-crosshair.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ var CrosshairPlugin = {

afterEvent: function (chart, event) {

if (chart.config.options.scales.x.length == 0) {
return
if (chart.config.options.scales.x.length === 0) {
return;
}

let e = event.event;

var xScaleType = chart.config.options.scales.x.type;

if (xScaleType !== 'linear' && xScaleType !== 'time' && xScaleType !== 'category' && xscaleType !== 'logarithmic') {
if (xScaleType !== 'linear' && xScaleType !== 'time' && xScaleType !== 'category' && xScaleType !== 'logarithmic') {
return;
}

Expand Down Expand Up @@ -324,7 +324,7 @@ var CrosshairPlugin = {
chart.update('none');
}
chart.crosshair.dragStarted = false; // cancel zoom in progress
return false;
return;
}
chart.crosshair.suppressUpdate = false;

Expand All @@ -350,10 +350,7 @@ var CrosshairPlugin = {
}

chart.crosshair.x = e.x;


chart.draw();

},

afterDraw: function (chart) {
Expand All @@ -369,8 +366,6 @@ var CrosshairPlugin = {
this.interpolateValues(chart);
this.drawTracePoints(chart);
}

return true;
},

beforeTooltipDraw: function (chart) {
Expand Down Expand Up @@ -475,15 +470,12 @@ var CrosshairPlugin = {
chart.options.scales.x.max = end;

// make a copy of the original data for later restoration

var storeOriginals = (chart.crosshair.originalData.length === 0) ? true : false;


var filterDataset = (chart.config.options.scales.x.type !== 'category');

if (filterDataset) {


for (var datasetIndex = 0; datasetIndex < chart.data.datasets.length; datasetIndex++) {

var newData = [];
Expand Down

0 comments on commit a298c9f

Please sign in to comment.