Lines Matching refs:bg
237 static void draw_bars(struct graph *bg, cairo_t *cr, struct graph_label *lb,
247 range = (double) bg->ydim * 0.80; /* FIXME */
256 y2 = bg->ydim * 0.90;
436 void bar_graph_draw(struct graph *bg, cairo_t *cr)
446 cairo_translate(cr, bg->xoffset, bg->yoffset);
447 graph_draw_common(bg, cr, &x1, &y1, &x2, &y2);
449 nlabels = count_labels(bg);
456 mindata = find_min_data(bg);
460 maxdata = find_max_data(bg);
463 draw_centered_text(cr, bg->font,
469 maxdata = graph_draw_y_ticks(bg, cr, x1, y1, x2, y2, mindata, maxdata, 10, 1);
471 flist_for_each(entry, &bg->label_list) {
477 label_offset = bg->xdim * 0.1 + space_per_label * (double) i + space_per_label * 0.1;
478 draw_bars(bg, cr, lb, label_offset, bar_width, mindata, maxdata);
479 // draw_centered_text(cr, label_offset + (bar_width / 2.0 + bar_width * 0.1), bg->ydim * 0.93,
480 draw_centered_text(cr, bg->font, x1 + space_per_label * (i + 0.5), bg->ydim * 0.93,
621 void graph_title(struct graph *bg, const char *title)
623 setstring(&bg->title, title);
626 void graph_x_title(struct graph *bg, const char *title)
628 setstring(&bg->xtitle, title);
631 void graph_y_title(struct graph *bg, const char *title)
633 setstring(&bg->ytitle, title);
636 static struct graph_label *graph_find_label(struct graph *bg,
642 flist_for_each(entry, &bg->label_list) {
652 graph_label_t graph_add_label(struct graph *bg, const char *label)
656 i = graph_find_label(bg, label);
661 i->parent = bg;
663 flist_add_tail(&i->list, &bg->label_list);
788 int graph_add_data(struct graph *bg, graph_label_t label, const double value)
815 int graph_add_xy_data(struct graph *bg, graph_label_t label,
821 if (bg->dont_graph_all_zeroes && y == 0.0 && !graph_nonzero_y(i))
895 void graph_free(struct graph *bg)
897 free(bg->title);
898 free(bg->xtitle);
899 free(bg->ytitle);
900 graph_free_labels(bg);