int legend_right ;
/* Default font size for the plot. */
- int font_size;
+ double font_size;
struct chart_colour fill_colour;
geom->title_bottom = 0.920 * length;
geom->legend_left = 0.810 * width;
geom->legend_right = width;
- geom->font_size = 10;
+ geom->font_size = 15.0;
geom->fill_colour.red = 255;
geom->fill_colour.green = 0;
20);
cairo_move_to (cr, centreline + 10, y);
- chart_label (cr, 'l', 'c', ds_cstr (&outlier->label));
+ chart_label (cr, 'l', 'c', geom->font_size, ds_cstr (&outlier->label));
}
static void
cairo_line_to (cr, left_label, label_y);
cairo_stroke (cr);
cairo_move_to (cr, left_label, label_y + 5);
- chart_label (cr, 'l', 'x', ds_cstr (&pie->slices[i].label));
+ chart_label (cr, 'l', 'x', geom->font_size,
+ ds_cstr (&pie->slices[i].label));
}
else
{
cairo_line_to (cr, right_label, label_y);
cairo_stroke (cr);
cairo_move_to (cr, right_label, label_y + 5);
- chart_label (cr, 'r', 'x', ds_cstr (&pie->slices[i].label));
+ chart_label (cr, 'r', 'x', geom->font_size,
+ ds_cstr (&pie->slices[i].label));
}
angle += segment_angle;
}
void
-chart_label (cairo_t *cr, int horz_justify, int vert_justify,
+chart_label (cairo_t *cr, int horz_justify, int vert_justify, double font_size,
const char *string)
{
PangoFontDescription *desc;
cairo_new_path (cr);
return;
}
- pango_font_description_set_absolute_size (desc, 15 * PANGO_SCALE);
+ pango_font_description_set_absolute_size (desc, font_size * PANGO_SCALE);
cairo_save (cr);
cairo_get_current_point (cr, &x, &y);
va_start (ap, label);
s = xvasprintf (label, ap);
if (orientation == TICK_ABSCISSA)
- chart_label (cr, 'c', 't', s);
+ chart_label (cr, 'c', 't', geom->font_size, s);
else if (orientation == TICK_ORDINATE)
{
if (fabs (position) < DBL_EPSILON)
cairo_rel_move_to (cr, 0, 10);
- chart_label (cr, 'r', 'c', s);
+ chart_label (cr, 'r', 'c', geom->font_size, s);
}
free (s);
va_end (ap);
char *s;
cairo_save (cr);
- // pl_ffontsize_r (cr, geom->font_size * 1.5); /* XXX */
cairo_move_to (cr, geom->data_left, geom->title_bottom);
va_start(ap, title);
s = xvasprintf (title, ap);
- chart_label (cr, 'l', 'x', s);
+ chart_label (cr, 'l', 'x', geom->font_size * 1.5, s);
free (s);
va_end (ap);
const char *label)
{
cairo_move_to (cr, geom->data_left, geom->abscissa_top);
- chart_label (cr, 'l', 't', label);
+ chart_label (cr, 'l', 't', geom->font_size, label);
}
/* Write the ordinate label */
cairo_translate (cr, -geom->data_bottom, -geom->ordinate_right);
cairo_move_to (cr, 0, 0);
cairo_rotate (cr, M_PI / 2.0);
- chart_label (cr, 'l', 'x', label);
+ chart_label (cr, 'l', 'x', geom->font_size, label);
cairo_restore (cr);
}
double size);
void chart_label (cairo_t *, int horz_justify, int vert_justify,
- const char *);
+ double font_size, const char *);
/* Draw a tick mark at position
If label is non zero, then print it at the tick mark
{
char *buf = xasprintf ("N = %.2f", n);
cairo_move_to (cr, geom->legend_left, y);
- chart_label (cr, 'l', 'b', buf);
+ chart_label (cr, 'l', 'b', geom->font_size, buf);
y += geom->font_size * 1.5;
free (buf);
}
{
char *buf = xasprintf ("Mean = %.1f", mean);
cairo_move_to (cr,geom->legend_left, y);
- chart_label (cr, 'l', 'b', buf);
+ chart_label (cr, 'l', 'b', geom->font_size, buf);
y += geom->font_size * 1.5;
free (buf);
}
{
char *buf = xasprintf ("Std. Dev = %.2f", stddev);
cairo_move_to (cr, geom->legend_left, y);
- chart_label (cr, 'l', 'b', buf);
+ chart_label (cr, 'l', 'b', geom->font_size, buf);
free (buf);
}