1. Chris Leonello
  2. jqplot
Issue #1 open

JQPlot throws exception if all y coordinates are equal

created an issue

JQPlot fails on the following dataset

[[[1244337000000, 10], [1244337300000, 10], [1244337600000, 10], [1244337900000, 10], [1244338200000, 10]]];

However it works as long as at least one y coordinate is different

[[[1244337000000, 10], [1244337300000, 10], [1244337600000, 10], [1244337900000, 10], [1244338200000, 11]]];

The exception being thrown is as follows:

uncaught exception: An invalid or illegal string was specified (NS_ERROR_DOM_SYNTAX_ERR) [Break on this error] ctx.moveTo(bx, by);

Comments (9)

  1. friflaj
    • changed status to open

    I tried your testcase and it does indeed work. The graph that I can't get to work is at http://gist.github.com/230198

    I'm seting the status back to open, not to be a nuisance but I'm not getting any mail feedback from bitbucket. If you do get updates for added comments, I'll not wantonly touch the status again.

  2. Chris Leonello repo owner

    For your y2axis, you've specified a min and a max both equal to 0. That is causing the problem. If any axis min is set equal to axis max, whether 0 or any other value, the plot will crash. jqPlot doesn't have any trouble with y values being all the same, however.

    I could add some logic to check for this condition (axis min = axis max), however it would only occur if the user deliberately specifies min the same as max. When autoscaling, jqPlot already corrects for this condition.

    I'm going to change this to an enhancement.

  3. friflaj

    Thanks, this neatly solves my problem. I simply set max to 1 in those instances where I would have set it to 0.

    The reason I explicitly set the max is because I have two chart lines against different Y scales, and one chart line that plots the ideal for both. The only way I can do that is to make sure the chart lines each start and end at the actual edges of the graph.

  4. Chris Leonello repo owner

    You could set it to 0.1 (or 0.01) or some similar small value. You just can't have the plot axis minimum and maximum be the same value. It is impossible to create a plot in that fashion.

  5. Log in to comment