X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcairo-chart.h;h=f02fd4efac9ef80a9007ce3429203891ae772181;hb=1c02620baa5dd413e3284071f6a5184c1e77bf40;hp=1a23dd179329cde657b12a98cd6c5f1ef1c8b05b;hpb=81579d9e9f994fb2908f50af41c3eb033d216e58;p=pspp diff --git a/src/output/cairo-chart.h b/src/output/cairo-chart.h index 1a23dd1793..f02fd4efac 100644 --- a/src/output/cairo-chart.h +++ b/src/output/cairo-chart.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009, 2011 Free Software Foundation, Inc. + Copyright (C) 2009, 2011, 2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ #include "libpspp/compiler.h" struct chart_item; +struct cell_color; struct xrchart_colour { @@ -31,17 +32,24 @@ struct xrchart_colour uint8_t blue; }; +struct xrchart_axis +{ + int data_max; + int data_min; + + double scale; + double min; + double max; +}; + /* The geometry of a chart. */ struct xrchart_geometry { - int data_top; - int data_right; - int data_bottom; - int data_left; + /* Bottom of the abscissa segment */ + int abscissa_bottom; - int abscissa_top; - - int ordinate_right; + /* Left of the ordinate segment */ + int ordinate_left; int title_bottom; @@ -57,12 +65,9 @@ struct xrchart_geometry struct xrchart_colour fill_colour; /* Stuff particular to cartesians and boxplots. */ - double ordinate_scale; - double abscissa_scale; - double x_min; - double x_max; - double y_min; - double y_max; + struct xrchart_axis axis[2]; + + /* True iff a path is currently being drawn */ bool in_path; }; @@ -70,13 +75,13 @@ void xrchart_geometry_init (cairo_t *, struct xrchart_geometry *, double width, double length); void xrchart_geometry_free (cairo_t *, struct xrchart_geometry *); -#define XRCHART_N_COLOURS 9 +#define XRCHART_N_COLOURS 27 extern const struct xrchart_colour data_colour[]; enum tick_orientation { - TICK_ABSCISSA=0, - TICK_ORDINATE + SCALE_ABSCISSA=0, + SCALE_ORDINATE }; enum xrmarker_type @@ -92,13 +97,19 @@ void xrchart_draw_marker (cairo_t *, double x, double y, enum xrmarker_type, void xrchart_label (cairo_t *, int horz_justify, int vert_justify, double font_size, const char *); +void xrchart_label_rotate (cairo_t *cr, int horz_justify, int vert_justify, + double font_size, const char *string, double angle); + + /* Draw a tick mark at position If label is non zero, then print it at the tick mark */ void draw_tick (cairo_t *, const struct xrchart_geometry *, - enum tick_orientation orientation, double position, + enum tick_orientation orientation, + bool rotated, + double position, const char *label, ...) - PRINTF_FORMAT (5, 6); + PRINTF_FORMAT (6, 7); /* Write the title on a chart*/ @@ -107,13 +118,12 @@ void xrchart_write_title (cairo_t *, const struct xrchart_geometry *, PRINTF_FORMAT (3, 4); /* Set the scale for the abscissa */ -void xrchart_write_xscale (cairo_t *, struct xrchart_geometry *, - double min, double max, int ticks); - +bool xrchart_write_xscale (cairo_t *, struct xrchart_geometry *, + double min, double max) WARN_UNUSED_RESULT; /* Set the scale for the ordinate */ -void xrchart_write_yscale (cairo_t *, struct xrchart_geometry *, - double smin, double smax, int ticks); +bool xrchart_write_yscale (cairo_t *, struct xrchart_geometry *, + double smin, double smax) WARN_UNUSED_RESULT; void xrchart_write_xlabel (cairo_t *, const struct xrchart_geometry *, const char *label) ; @@ -155,11 +165,36 @@ void xrchart_draw_roc (const struct chart_item *, cairo_t *, struct xrchart_geometry *); void xrchart_draw_piechart (const struct chart_item *, cairo_t *, struct xrchart_geometry *); +void xrchart_draw_barchart (const struct chart_item *, cairo_t *, + struct xrchart_geometry *); void xrchart_draw_histogram (const struct chart_item *, cairo_t *, struct xrchart_geometry *); void xrchart_draw_np_plot (const struct chart_item *, cairo_t *, struct xrchart_geometry *); void xrchart_draw_scree (const struct chart_item *, cairo_t *, struct xrchart_geometry *); +void xrchart_draw_spreadlevel (const struct chart_item *, cairo_t *, + struct xrchart_geometry *); +void xrchart_draw_scatterplot (const struct chart_item *, cairo_t *, + struct xrchart_geometry *); + +void xr_draw_chart (const struct chart_item *, cairo_t *, + double width, double height); + +cairo_surface_t *xr_draw_image_chart (const struct chart_item *, + const struct cell_color *fg, + const struct cell_color *bg); +char *xr_write_png_image (cairo_surface_t *, + const char *file_name_template, int number); + +char *xr_draw_png_chart (const struct chart_item *, + const char *file_name_template, int number, + const struct cell_color *fg, + const struct cell_color *bg); + +char *xr_draw_eps_chart (const struct chart_item *item, + const char *file_name_template, int number, + const struct cell_color *fg, + const struct cell_color *bg); #endif /* output/cairo-chart.h */