diff --git a/src/js/audio.js b/src/js/audio.js index 53b1850b..e0e81ccf 100644 --- a/src/js/audio.js +++ b/src/js/audio.js @@ -121,6 +121,7 @@ class Audio { panning = 0; } } else if (constants.chartType == 'heat') { + if (!plot.data || !plot.data[position.y]) return; rawFreq = plot.data[position.y][position.x]; rawPanning = position.x; frequency = this.SlideBetween( diff --git a/src/js/controls.js b/src/js/controls.js index 9152bfe9..243cf141 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -569,6 +569,10 @@ class Control { constants.autoplayId = setInterval(function () { position.x += step; + if (!plot || !plot.plotData) { + constants.KillAutoplay(); + return; + } if (position.x < 0 || plot.plotData.length - 1 < position.x) { constants.KillAutoplay(); lockPosition(); @@ -1724,6 +1728,7 @@ class Control { } constants.autoplayId = setInterval(function () { + if (!plot) return; if ( dir == 'left' || dir == 'right' || @@ -2499,6 +2504,10 @@ class Control { constants.autoplayId = setInterval(function () { position.x += step; + if (!plot || !plot.plotData) { + constants.KillAutoplay(); + return; + } if (position.x < 0 || plot.plotData.length - 1 < position.x) { constants.KillAutoplay(); lockPosition(); @@ -2872,6 +2881,10 @@ class Control { dir == 'reverse-right' ) { position.x += step; + if (!plot || !plot.plotData) { + constants.KillAutoplay(); + return; + } if (position.x < 0 || plot.plotData.length - 1 < position.x) { constants.KillAutoplay(); lockPosition(); diff --git a/src/js/heatmap.js b/src/js/heatmap.js index ec00fc99..65f71272 100644 --- a/src/js/heatmap.js +++ b/src/js/heatmap.js @@ -389,7 +389,7 @@ class HeatMapRect { var rect = document.createElementNS(svgns, 'rect'); rect.setAttribute('id', 'highlight_rect'); rect.setAttribute('x', this.x); - rect.setAttribute('y', this.y); + rect.setAttribute('y', this.y === undefined ? 0 : this.y); rect.setAttribute('width', this.width); rect.setAttribute('height', this.height); rect.setAttribute('stroke', constants.colorSelected); diff --git a/src/js/scatterplot.js b/src/js/scatterplot.js index b2b01526..0fe53ec6 100644 --- a/src/js/scatterplot.js +++ b/src/js/scatterplot.js @@ -462,6 +462,10 @@ class ScatterPlot { constants.sepPlayId = setInterval( function () { // play this tone + if (!audio || !audio.playTone) { + clearInterval(constants.sepPlayId); + return; + } audio.playTone(); // and then set up for the next one @@ -477,6 +481,10 @@ class ScatterPlot { ); // play all tones at the same time } else if (constants.chartType == 'smooth') { // best fit smooth layer + if (!audio || !audio.playTone) { + clearInterval(constants.sepPlayId); + return; + } audio.playTone(); } } @@ -520,7 +528,7 @@ class ScatterPlot { if (elIndex > -1) { data = singleMaidr.data[elIndex]; } else { - data = singleMaidr.data + data = singleMaidr.data; } if (xyFormat == 'object') { for (let i = 0; i < data.length; i++) { @@ -714,7 +722,9 @@ class Layer0Point { plot.plotPoints[this.circleIndex[i]] instanceof SVGUseElement || plot.plotPoints[this.circleIndex[i]] instanceof SVGCircleElement ) { - y = plot.plotPoints[this.circleIndex[i]].getAttribute(plot.prefix + 'y'); + y = plot.plotPoints[this.circleIndex[i]].getAttribute( + plot.prefix + 'y' + ); } point.setAttribute('cy', y);