diff --git a/wrapper/telemetry-wrapper.js b/wrapper/telemetry-wrapper.js index 6567b42..9390c05 100644 --- a/wrapper/telemetry-wrapper.js +++ b/wrapper/telemetry-wrapper.js @@ -143,6 +143,12 @@ window.TelemetryWrapper.go = function (params, element) { evolutionsByKey[keycount.key] = oldEvolutionsByKey[keycount.key]); } + if (!Object.keys(evolutionsByKey).length) { + // Uh-oh, there's no data for the provided params. Bail! + showError('No data to graph', params, element); + return; + } + Object.keys(evolutionsByKey).forEach(key => { var evolutions = evolutionsByKey[key]; if (!evolutions.length) { @@ -562,6 +568,13 @@ window.TelemetryWrapper.go = function (params, element) { return filterOptions; } + function showError(msg, params, element) { + var msgEl = document.createElement('pre'); + msgEl.className = 'graph-container error'; + msgEl.textContent = msg + '\n' + JSON.stringify(params, ' ', 2); + element.appendChild(msgEl); + } + function formatNumber(number) { // lifted from dist.js if (number == Infinity) { return 'Infinity'; } // TODO: i18n?