Issue #482 resolved

"undefined" error message when plotting a chart with no data

tomasc
created an issue

Browsers: Firefox 8.0 and Google Chrome 15.0.874.121 m, Windows 7 x64

jqPlot version: 1.0.0b2_r1049

I've found a bug in the error handling for when {{{$.jqplot.config.catchErrors = true}}} and the chart to be plotted has no data.

{{{ $.jqplot.config.catchErrors = true; var chart = $.jqplot('chart', [[]], {}); }}}

In the source for jquery.jqplot.js at line 219: {{{ if ($.jqplot.config.catchErrors) { try { plot.init(target, _data, _options); plot.draw(); plot.themeEngine.init.call(plot); return plot; } catch(e) { var msg = $.jqplot.config.errorMessage || e.message; }}} When plotting a chart with no data, it triggers the catch(e) in the try/catch. {{{e}}} is set to "No Data", and since {{{$.jqplot.config.errorMessage}}} is not defined, it attempts to display e.message which is "undefined" because e is just a string ("No Data").

Comments (5)

  1. Log in to comment