Re: strange behavior...



Hi Zeev,

what auto_rescale does:

It takes the extrema of your values, adds a margin of x percent and calls set_total_limits.

Now, if your values represent a horizontal or vertical line, this leads to zero height or zero width. Thus, if you call auto_rescale while your data is one-dimensional, you will see that warning.

It seems to be a good idea to modify the auto_rescale function so that this effect does not occur anymore. I think I will do that in the next release.

This is what it probably will look like (not yet tested, though):

--------------------------
[...]
   if (extrema_success)
      return extrema_success;
   else
   {
      gfloat width = max_x - min_x;
      gfloat height = max_y - min_y;

      if (width == 0) width = max_x;
      if (height == 0) height = max_y;

      min_x -= border * width;
      max_x += border * width;
      min_y -= border * height;
      max_y += border * height;
   }
[...]
--------------------------

You may want to replace the original code in the gtkdatabox.c file.


Regards,

Roland

z pekar gmail com wrote:
Hi Roland,

I probably didn't understand you right, but it still doesn't work:
just after the creation of the databox widget I set:
gtk_databox_set_total_limits (GTK_DATABOX
(s->getGui()->simulationPage.dataBoxThermosensor), -20, 20, -45, 45);
without zeros (before there were, you are right)
later during main loop iterations I put graphs (which are lines during
first iterations) to the widget and autorescale it - they are displyed
nicely, but unfortunately  with the error message in terminal:
CRITICAL **: gtk_databox_set_total_limits: assertion `left != right &&
top != bottom' failed.

is there smth. to do about it?
thank you
Zeev


On Fri, May 9, 2008 at 9:34 PM, Roland Bock <box2OO6 eudoxos de> wrote:
Hi Zeev,

the message is given, if the vertical or horizontal latitude of your the
limits you set is zero. In such a case, the widget cannot reasonably
derive pixel coordinates from data values (maybe it could perform an
educated guess, but that is not implemented today).

Thus, if you start with a line, you should use
gtk_databox_set_total_limits instead of ...auto_rescale.

Regards,

Roland

z pekar gmail com wrote:
Hi All,
I have recently integrated gtkdatabox into my application and have
following error message as long as the graph that I draw is a line (it
is also not displayed):
CRITICAL **: gtk_databox_set_total_limits: assertion `left != right &&
top != bottom' failed
only after it becomes a curve it starts being displayed and the error
disappears. ( I use following code to display the graphs):

                      graph = gtk_databox_lines_new (recordsNum,
                                                                                      s->getParameters()->getThermosensor(i)->getTimeArray(),
                                                                                      s->getParameters()->getThermosensor(i)->getTemperatureArray(),
                                                                                      &color, 1);
                      gtk_databox_graph_add (GTK_DATABOX
(s->getGui()->simulationPage.dataBoxThermosensor), graph);
                      gtk_databox_auto_rescale (GTK_DATABOX
(s->getGui()->simulationPage.dataBoxThermosensor), 1);

furthermore : gtk_databox_graph_remove_all doesn't seem to always work...
I run a heavy computation in a separate thread(all the changes to gui
happen in main thread using g_idle_add and a callback function) that
uses 100% of CPU - could this fact cause the above mentioned problems?

thank you in advance
Zeev Pekar
_______________________________________________
gtkdatabox-list mailing list
gtkdatabox-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkdatabox-list

_______________________________________________
gtkdatabox-list mailing list
gtkdatabox-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkdatabox-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]