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

Plot* plot_data_init ( GArray *  data  ) 

Initialise a new plot window given a collection of data (eg. at startup or when a new plot window is created).

Parameters:
data The data for the new plot.
Returns:
A new plot structure containing the passed data.
Note:
The returned Plot should be freed when obsolete, but it is also appended to the global plot GArray

Definition at line 423 of file plot_window.c.

References _Plot::current_frame, global_plot_window, ij_dimensions_set(), legend_create(), plot_axes_create(), plot_create(), _Plot::plot_data, plot_line_create(), plot_range_set(), and plot_window_set_title().

Referenced by cmd_line_process(), file_select_read(), file_subtract(), plot_window_derivative(), and plot_window_empty_new().

{
  Plot* plot;
  GArray* current_frame;
  guint i;
  gint f_nbr;

  YDEB("plot_data_init\n");
  
  plot = plot_create(data);

  plot_window_build(plot);

  legend_create(plot);

  plot_range_set(plot, INIT_DATA);
  plot_axes_create(plot);
  ij_dimensions_set(plot);

  plot->plot_data = plot_line_create(plot);

  /*
   * Initialise the current frame array to start at the first frame.
   */
  current_frame = g_array_new(FALSE, FALSE, sizeof(gint));
  f_nbr = FIRST_FRAME;
  for (i=0; i<data->len; ++i)
    g_array_append_val(current_frame, f_nbr);
  plot->current_frame = current_frame;

  plot_window_set_title(plot);

  if (global_plot_window == NULL)
    global_plot_window = g_array_new(FALSE, FALSE, sizeof(Plot*));

  g_array_append_val(global_plot_window, plot);

  return plot;
}


Generated by  Doxygen 1.6.0   Back to index