Re: How to most efficiently add points to a dataset?
"Adrian E. Feiguin" <[email protected]> Mon, 29 Nov 2004 14:56:13 -0600
| Newsgroups | gmane.comp.scigraphica.gtkextra |
|---|---|
| Message-ID | <[email protected]> |
Hi Al, Look at the "update" function in testrealtime.c, that's a more efficient way to do it. Let me know if you find any mem. leaks. Good luck with that. Saludos, <ADRIAN> Al Hooton wrote: >On Sun, 2004-11-28 at 21:18 -0800, Al Hooton wrote: > > >> All, >> >> I have a situation where I need to start out putting a dataset in a >>plot that has a single point, then add a subsequent point every several >>seconds. Each point is calculated so it is only one pixel to the left >> >> > > >Sorry for the second post, the "left" above should "right". I'm growing >this plot of points from left to right. > > > > >>of the point before it. There are no connectors, just an ever-growing >>dataset of points. >> >> Currently, I do this as such: >> >>INIT: >>canvas = gtk_plot_canvas_new(....) >>plot = gtk_plot_new_with_size(.....) >>plotChild = gtk_plot_canvas_plot_new(plot) >>gtk_plot_canvas_put_child(canvas, plotChild, ......) >>dataset = gtk_plot_data_new(...) >>gtk_plot_add_data(plot, dataset) >>gtk_plot_data_set_points(dataset, X, Y, D, ......) >> >>(Above, there is only a single point in X, Y and D) >> >> >>EACH TIME I NEED TO ADD A POINT, EVERY FEW SECONDS: >>gtk_plot_remove_data(plot, dataset) >>dataset = gtk_plot_data_new(...) >>gtk_plot_add_data(plot, dataset) >>gtk_plot_data_set_points(dataset, X, Y, D, ......) >> >>Above, X, Y, and D grow by one point each time >> >>-------------- >> >>This works, for a while, but after I get 50 to 100 points in the >>datasets, it starts getting very slow. At a certain point, the UI >>process in my app (which is running this code) starts consuming all the >>processor just trying to deal with me constantly ripping datasets out of >>the plot and replacing them. >> >>I have been through the gtkextra-2 code, and I can't see a better way, >>but I *know* there has to be one! Can anybody provide a pointer to a >>better way of doing this? >> >>Thanks! >> >>-Al >> >> >> >> >> >>------------------------------------------------------- >>SF email is sponsored by - The IT Product Guide >>Read honest & candid reviews on hundreds of IT Products from real users. >>Discover which products truly live up to the hype. Start reading now. >>http://productguide.itmanagersjournal.com/ >>_______________________________________________ >>Scigraphica-gtkextra mailing list >>[email protected] >>https://lists.sourceforge.net/lists/listinfo/scigraphica-gtkextra >> >> >><!DSPAM:41aab17488457536213661> >> >> > > > >------------------------------------------------------- >SF email is sponsored by - The IT Product Guide >Read honest & candid reviews on hundreds of IT Products from real users. >Discover which products truly live up to the hype. Start reading now. >http://productguide.itmanagersjournal.com/ >_______________________________________________ >Scigraphica-gtkextra mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/scigraphica-gtkextra > > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/