output: Refactor implementation of charts.
[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 #include <stdio.h>
18 #include <stdarg.h>
19 #include <string.h>
20 #include <stdio.h>
21 #include <float.h>
22 #include <assert.h>
23 #include <math.h>
24
25
26 #include <math/chart-geometry.h>
27 #include <output/chart.h>
28
29 #include <libpspp/compiler.h>
30 #include <libpspp/str.h>
31 #include <output/manager.h>
32 #include <output/output.h>
33
34 #include "xalloc.h"
35
36 #ifndef PLOT_CHART_H
37 #define PLOT_CHART_H
38
39 #define N_CHART_COLOURS 9
40 extern const char *const data_colour[];
41
42 enum tick_orientation
43   {
44     TICK_ABSCISSA=0,
45     TICK_ORDINATE
46   };
47
48 struct chart_geometry;
49
50
51 /* Draw a tick mark at position
52    If label is non zero, then print it at the tick mark
53 */
54 void draw_tick(plPlotter *, const struct chart_geometry *,
55           enum tick_orientation orientation,
56           double position,
57                const char *label, ...)
58   PRINTF_FORMAT (5, 6);
59
60
61 /* Write the title on a chart*/
62 void   chart_write_title(plPlotter *, const struct chart_geometry *,
63                          const char *title, ...)
64   PRINTF_FORMAT (3, 4);
65
66
67 /* Set the scale for the abscissa */
68 void  chart_write_xscale(plPlotter *, struct chart_geometry *,
69                          double min, double max, int ticks);
70
71
72 /* Set the scale for the ordinate */
73 void  chart_write_yscale(plPlotter *, struct chart_geometry *,
74                          double smin, double smax, int ticks);
75
76 void chart_write_xlabel(plPlotter *, const struct chart_geometry *,
77                         const char *label) ;
78
79 /* Write the ordinate label */
80 void  chart_write_ylabel(plPlotter *, const struct chart_geometry *,
81                          const char *label);
82
83 #endif