[jqplot-users] AJAX + jqplot (help with the basics)

4,360 views
Skip to first unread message

U

unread,
May 25, 2010, 4:41:52 AM5/25/10
to jqplot-users
Obviously I am doing something wrong.
I am trying to hook jqplot with streaming data:

plot1 = $.jqplot('chart1', [[]], {
series:[{lineWidth:1, showMarker:false}]]});

So far so good (if I put data in the series it shows fine)

Now I do:

var newData = [1,2,3,4,5];
plot1.series[0].data = newData;
plot1.resetAxesScale();
plot1.replot();

I get an exception: An invalid or illegal string was specified
In the error console, firefox tells me: Error in parsing value for
'left'. Decleration dropped.

I am using:
jquery 1.4.2
jqplot 0.9.7 (jqplot.js jqplot.css both loaded)
firefox 3.6.3

btw - is there a sample page that shows somethign similar in the
examples?

--
You received this message because you are subscribed to the Google Groups "jqplot-users" group.
To post to this group, send email to jqplot...@googlegroups.com.
To unsubscribe from this group, send email to jqplot-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jqplot-users?hl=en.

Chris Leonello

unread,
May 25, 2010, 9:39:47 AM5/25/10
to jqplot...@googlegroups.com
I think you'll need to specify your new data like:

[[1,1],[2,2],[3,3]...]

On initial plot creation you can pass in a 1-D array.  jqPlot internally converts it to a 2-D array like above.  This doesn't happen on .replot().  Alternatively, if this is real pain and if you aren't doing real frequent updates, you could recreate the plot by calling jqplot() again:

$('#chart1').empty();
plot1 = $.jqplot('chart1', [[]], {series:[{lineWidth:1, showMarker:false}]]});

--
Chris Leonello

U

unread,
May 26, 2010, 4:00:48 AM5/26/10
to jqplot-users
that did the trick

> > jqplot-users...@googlegroups.com<jqplot-users%2Bunsubscribe@google groups.com>

Reply all
Reply to author
Forward
0 new messages