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

void legend_create ( Plot plot  ) 

Create a new legend structure given a plot window and its corresponding data content.

Parameters:
plot The Plot for which the legend is being created.
Note:
The Legend structure should be freed when it is no longer needed (eg. when the plot window is destroyed).

Definition at line 174 of file legend.c.

References _Plot::data, _Legend::font, _Legend::gc, _Legend::height, _Plot::legend, legend_calc_height(), legend_calc_width(), legend_free(), legend_set_names(), legend_set_position(), _Legend::names, _Legend::pixmap, _Legend::position, _Legend::rebuild, and _Legend::width.

Referenced by legend_draw(), plot_data_append(), and plot_data_init().

{
  Legend* legend;

  if (plot->data == NULL)
    return;

  if (plot->legend != NULL)
    legend_free(plot->legend);

  legend = g_malloc(sizeof(Legend));

  legend->pixmap = NULL;
  legend->gc=NULL;
  legend->names=NULL;
  legend_set_names(legend, plot);
  legend->font = gdk_font_load(DEFAULT_LEGEND_FONT);
  legend->width = legend_calc_width(legend);
  legend->height = legend_calc_height(legend);
  legend->position = legend_set_position(legend);
  legend->rebuild = FALSE;

  plot->legend = legend;
}


Generated by  Doxygen 1.6.0   Back to index