jqplot redraw problem?

5,474 views
Skip to first unread message

JeongMin Lee

unread,
Oct 5, 2009, 7:36:17 AM10/5/09
to jqplot-users
I wanna change the data of chart and redraw. but I can't make it.

after create plot1(by like this, plot1 = $.jqplot('chart', [line1],
options); - it works perfectly)
i tried these.
1.
plot1.data = [23,31,14,16,15,35,17,16];
plot1.redraw();

2.
data = [23,31,14,16,15,35,17,16];
plot1.init('chart', data, options);
plot1.redraw();

and so on

but no change happens. I just found it can change xaxis and yaxis. but
i wanna change the data line.

I use the version 0.9.4.
anyone can help me?

John L. Cheng

unread,
Oct 5, 2009, 12:04:54 PM10/5/09
to jqplot-users
Can you clear the plot area and draw again?

$('chart').empty();
$.jqplot('chart', newdata, options);

This is the approach I use to toggle series on and off. I am not
aware
of a way to redraw just the series without redrawing everything else.

JeongMin Lee

unread,
Oct 5, 2009, 9:11:29 PM10/5/09
to jqplot...@googlegroups.com
Thank u so much.
It works perfectly as I intend.
I did never think of this way.
I was in hardship by that I can't understand the manual properly due to poor my english.
actually I don't know the meaning of series yet.
u are my life saver.

Thanks a lot again.

Regards,
Sean.

Chris Leonello

unread,
Nov 10, 2009, 2:22:27 PM11/10/09
to jqplot-users
> 1.
> plot1.data = [23,31,14,16,15,35,17,16];
> plot1.redraw();

Note, the proper way to do this would be:

plot1.series[0].data = [[1,23],[2,31],[3,14]...];
plot1.redraw();

redraw() now be default clears the plot area before redrawing.

There is a new method, replot(), that is more robust than redraw. It
has options to re-scale axes. It is in the sources and will be in the
next release.


On Oct 5, 8:11 pm, JeongMin Lee <coolwin...@gmail.com> wrote:
> Thank u so much.It works perfectly as I intend.
> I did never think of this way.
> I was in hardship by that I can't understand the manual properly due to poor
> my english.
> actually I don't know the meaning of series yet.
> u are my life saver.
>
> Thanks a lot again.
>
> Regards,
> Sean.
>

Chris Leonello

unread,
Nov 10, 2009, 2:27:05 PM11/10/09
to jqplot...@googlegroups.com
>>
>> 1.
>> plot1.data = [23,31,14,16,15,35,17,16];
>> plot1.redraw();
>
> Note, the proper way to do this would be:

"proper way" is a misstatement. I should have written "another way"
or "new way". John's method will work just fine and I have
recommended it in the past when users have trouble redrawing a plot.


--
Chris Leonello
Reply all
Reply to author
Forward
0 new messages