X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcharts%2Fbarchart-cairo.c;h=00b33fc6b0f182b5fa7f92b6dd97c3e0d5f6af5a;hb=855eaf1506f0ea76a8bbfb3bbfd456524f4edeca;hp=c3cc2f3ca14225c29875e5a8d28b6031345e371d;hpb=389df78f3bf8c730238f4ed5e5ae09d14c7bff5d;p=pspp diff --git a/src/output/charts/barchart-cairo.c b/src/output/charts/barchart-cairo.c index c3cc2f3ca1..00b33fc6b0 100644 --- a/src/output/charts/barchart-cairo.c +++ b/src/output/charts/barchart-cairo.c @@ -43,10 +43,10 @@ abscissa_label (const struct barchart *bc, cairo_t *cr, size_t hash = value_hash (prev, bc->widths[0], 0); HMAP_FOR_EACH_WITH_HASH (foo, struct category, node, hash, &bc->primaries) { - if (value_equal (&foo->val, prev, bc->widths[0])) + if (value_equal (&foo->val, prev, bc->widths[0])) break; } - + draw_tick (cr, geom, SCALE_ABSCISSA, false, x_pos - (width * n_last_cat) / 2.0, "%s", ds_cstr (&foo->label)); @@ -67,10 +67,9 @@ xrchart_draw_barchart (const struct chart_item *chart_item, cairo_t *cr, xrchart_write_ylabel (cr, geom, bc->ylabel); xrchart_write_xlabel (cr, geom, chart_item_get_title (chart_item)); - if (bc->percent) - xrchart_write_yscale (cr, geom, 0, bc->largest * 100.0 / bc->total_count ); - else - xrchart_write_yscale (cr, geom, 0, bc->largest); + if (! xrchart_write_yscale (cr, geom, 0, + bc->percent ? bc->largest * 100.0 / bc->total_count : bc->largest)) + return; const double abscale = geom->axis[SCALE_ABSCISSA].data_max - geom->axis[SCALE_ABSCISSA].data_min; const double width = abscale / (double) (bc->n_nzcats + bc->n_pcats); @@ -82,7 +81,7 @@ xrchart_draw_barchart (const struct chart_item *chart_item, cairo_t *cr, { const int blob_size = 13; const int height = blob_size * (hmap_count (&bc->secondaries) * 2); - + cairo_rectangle (cr, geom->axis[SCALE_ABSCISSA].data_max + 10, geom->axis[SCALE_ORDINATE].data_max - height, @@ -95,10 +94,10 @@ xrchart_draw_barchart (const struct chart_item *chart_item, cairo_t *cr, { const struct category *foo = bc->ss[i]; - cairo_move_to (cr, + cairo_move_to (cr, geom->axis[SCALE_ABSCISSA].data_max + (1.5 * blob_size) + 20, geom->axis[SCALE_ORDINATE].data_max - ypos); - + xrchart_label (cr, 'l', 'b', geom->font_size, ds_cstr (&foo->label)); cairo_rectangle (cr, @@ -114,7 +113,7 @@ xrchart_draw_barchart (const struct chart_item *chart_item, cairo_t *cr, cairo_fill_preserve (cr); cairo_restore (cr); - + cairo_stroke (cr); ypos += blob_size * 2;