Logo Search packages:      
Sourcecode: ygraph version File versions  Download package

gint axis_calc_width ( Axis axis  ) 

Calculate the amount of space needed by an axis according to the text in its labels.

Parameters:
axis The axis to be measured.
Returns:
The width (in pixels) of the axis.

Definition at line 315 of file axis.c.

References axis_get_text_width(), _Axis::font, _Axis::orientation, _Tick::str, and _Axis::ticks.

Referenced by axis_create().

{
  GArray* ticks;
  Tick *tick;
  gint width;
  gint nticks;
  gint i;

  ticks = axis->ticks;
  nticks = ticks->len;

  width = 0;
  for (i=0; i<nticks; ++i)
    {
      tick = g_array_index(ticks, Tick*, i);
      width = MAX(width, axis_get_text_width(axis->font, tick->str, 
                                             axis->orientation));
    }
  return width;
}


Generated by  Doxygen 1.6.0   Back to index