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