output: Use Cairo and Pango to draw charts, instead of libplot.
[pspp-builds.git] / src / output / charts / plot-chart.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2004, 2009 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef PLOT_CHART_H
18 #define PLOT_CHART_H
19
20 #include <cairo/cairo.h>
21 #include <stdio.h>
22 #include <stdarg.h>
23 #include <string.h>
24 #include <stdio.h>
25 #include <float.h>
26 #include <assert.h>
27 #include <math.h>
28
29
30 #include <math/chart-geometry.h>
31 #include <output/chart.h>
32 #include <output/chart-provider.h>
33
34 #include <libpspp/compiler.h>
35 #include <libpspp/str.h>
36 #include <output/manager.h>
37 #include <output/output.h>
38
39 #define N_CHART_COLOURS 9
40 extern const struct chart_colour data_colour[];
41
42 enum tick_orientation
43   {
44     TICK_ABSCISSA=0,
45     TICK_ORDINATE
46   };
47
48 struct chart_geometry;
49
50
51 enum marker_type
52   {
53     MARKER_CIRCLE,              /* Hollow circle. */
54     MARKER_ASTERISK,            /* Asterisk (*). */
55     MARKER_SQUARE               /* Hollow square. */
56   };
57
58 void chart_draw_marker (cairo_t *, double x, double y, enum marker_type,
59                         double size);
60
61 void chart_label (cairo_t *, int horz_justify, int vert_justify,
62                   const char *);
63
64 /* Draw a tick mark at position
65    If label is non zero, then print it at the tick mark
66 */
67 void draw_tick(cairo_t *, const struct chart_geometry *,
68           enum tick_orientation orientation,
69           double position,
70                const char *label, ...)
71   PRINTF_FORMAT (5, 6);
72
73
74 /* Write the title on a chart*/
75 void   chart_write_title(cairo_t *, const struct chart_geometry *,
76                          const char *title, ...)
77   PRINTF_FORMAT (3, 4);
78
79
80 /* Set the scale for the abscissa */
81 void  chart_write_xscale(cairo_t *, struct chart_geometry *,
82                          double min, double max, int ticks);
83
84
85 /* Set the scale for the ordinate */
86 void  chart_write_yscale(cairo_t *, struct chart_geometry *,
87                          double smin, double smax, int ticks);
88
89 void chart_write_xlabel(cairo_t *, const struct chart_geometry *,
90                         const char *label) ;
91
92 /* Write the ordinate label */
93 void  chart_write_ylabel(cairo_t *, const struct chart_geometry *,
94                          const char *label);
95
96 #endif