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

void zoom_x_range_set ( Plot plot,
gint  i1,
gint  i2 
)

Set the new x-axis ranges after a zoom.

Parameters:
plot The Plot.
i1 One i-coordinate of one end of the zoom box.
i2 One i-coordinate of the other end of the zoom box.

Definition at line 190 of file util.c.

References i_to_x(), and _Plot::x_range.

Referenced by plot_area_zoom_finish().

{
  gint zoom_i_start;
  gint zoom_i_end;
  gdouble range[2];

  /*
   * Make sure that the zoom start and end points are not exactly the same.
   */
  if (i1 == i2)
    {
      zoom_i_start = i1;
      zoom_i_end = i1 + 1;
    }
  /*
   * Make sure that the order is right (start in upper-left, end lower right).
   */
  else if (i1 < i2)
    {
      zoom_i_start = i1;
      zoom_i_end = i2;
    }
  else
    {
      zoom_i_start = i2;
      zoom_i_end = i1;
    }

  range[0] = i_to_x(plot, zoom_i_start);
  range[1] = i_to_x(plot, zoom_i_end);
  
  if ((fabs(range[0]) > -G_MAXDOUBLE) && (range[1]>range[0]))
    {
      plot->x_range[0] = range[0];
      plot->x_range[1] = range[1];
    }
}


Generated by  Doxygen 1.6.0   Back to index