9586eb1e068aba5f480b758a79db4463c8ae465a
[pspp-builds.git] / src / output / chart.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2004 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 #include <math/chart-geometry.h>
26 #include <libpspp/str.h>
27 #include "manager.h"
28 #include "output.h"
29
30 #include "xalloc.h"
31
32 #ifndef CHART_H
33 #define CHART_H
34
35 #ifndef NO_CHARTS
36 #include <plot.h>
37 #endif
38
39 struct chart {
40
41 #ifndef NO_CHARTS
42   plPlotter *lp ;
43   plPlotterParams *pl_params;
44 #else
45   void *lp;
46 #endif
47   char *file_name;
48   FILE *file;
49
50   /* The geometry of the chart
51      See diagram at the foot of this file.
52    */
53
54   int data_top   ;
55   int data_right ;
56   int data_bottom;
57   int data_left  ;
58
59   int abscissa_top;
60
61   int ordinate_right ;
62
63   int title_bottom ;
64
65   int legend_left ;
66   int legend_right ;
67
68
69   /* Default font size for the plot (if zero, then use plotter default) */
70   int font_size;
71
72   char fill_colour[10];
73
74   /* Stuff Particular to Cartesians (and Boxplots ) */
75   double ordinate_scale;
76   double abscissa_scale;
77   double x_min;
78   double x_max;
79   double y_min;
80   double y_max;
81 };
82
83
84
85 struct chart * chart_create(void);
86 void chart_submit(struct chart *ch);
87
88 /* Helper functions for output drivers that put each chart into a
89    separate file. */
90 void chart_init_separate (struct chart *, const char *type,
91                           const char *file_name_tmpl, int number);
92
93 void chart_finalise_separate (struct chart *);
94
95 #endif