Line chart fails when all Y-values are the same

Posted by dimitryb 
Line chart fails when all Y-values are the same
October 21, 2009 06:17PM
Example usage:
chart.setDataArray([[1,0],[2,0],[3,0]]);

Firebug spits out an error:
An invalid or illegal string was specified" code: "12

It's not because all Y-values are zeroes. I get the same error for any other value.

Thoughts? We're steps away from ordering a site license for ourselves and contacting you for an even bigger license for a client.
Re: Line chart fails when all Y-values are the same
October 22, 2009 11:13AM
Can you please show us more of the code? Are there any parameters you are using? Also mentioning the browser you are using might be useful (though I guess it's firefox). Thanks!

Sabin

--------------------
JS Charts - Created by Smartketer LLC



Edited 1 time(s). Last edit at 10/22/2009 11:13AM by sabinmunteanu.
Re: Line chart fails when all Y-values are the same
October 22, 2009 01:41PM
Sabin - Thanks for getting back to me. I've narrowed it down to one method that causes the error:

var myChart = new JSChart('element', 'line');
myChart.setDataArray([[1,0],[2,0],[3,0]]);
myChart.setAxisValuesNumberY(10); // This is the bad guy. Without this method, the line renders fine.
myChart.draw();

Any ideas? I'd like to have a consistent graph with 10 y-axis lines at all times, so it would be nice to still have the possibility calling that method.

Thanks so much
Re: Line chart fails when all Y-values are the same
October 22, 2009 02:14PM
As a follow up, can I set a min and max of the Y-axis?

As an example, I'm trying to display a graph of ad impressions. So if all ad impressions over last 30 days are 0, I get negative values on the chart. Obviously, this dataset can never be below 0, so it's misleading to the end-user to see negative values on the y-axis.

Also, as I understand, there is no way currently to display negative values, so I don't see a reason to have negative values on the y-axis.

Thanks so much,
Dimitry
Re: Line chart fails when all Y-values are the same
October 23, 2009 11:58AM
There is no actual support for negative values, in the way that we have made no complete tests - the user could try now negative numbers in the data series, in the parameters, but we cannot yet guarantee that it will work as expected.

You can use setIntervalStartY() and setIntervalEndY() to set the lower and upper limits for the Y axis.

Sabin

--------------------
JS Charts - Created by Smartketer LLC
Re: Line chart fails when all Y-values are the same
October 23, 2009 12:05PM
We just released a new version (download). One the changes is addressing right this issue, the error should no longer appear in your charts if you are using the same parameters. Using setIntervalEndY() would have worked for the old script too, but there are a few other important changes like faster rendering in IE.

Sabin

--------------------
JS Charts - Created by Smartketer LLC
Re: Line chart fails when all Y-values are the same
October 23, 2009 01:58PM
Thank you so much. Wonderful support!
Re: Line chart fails when all Y-values are the same
October 23, 2009 02:05PM
Glad to help smiling smiley

Sabin

--------------------
JS Charts - Created by Smartketer LLC
Sorry, you do not have permission to post/reply in this forum.