charts: Use numeric colors instead of color names.
[pspp-builds.git] / src / output / chart-provider.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 OUTPUT_CHART_PROVIDER_H
18 #define OUTPUT_CHART_PROVIDER_H 1
19
20 #include <stdbool.h>
21 #include <stdint.h>
22 #include <output/chart.h>
23
24 struct chart_colour
25   {
26     uint8_t red;
27     uint8_t green;
28     uint8_t blue;
29   };
30
31 struct chart_class
32   {
33     void (*draw) (const struct chart *, plPlotter *);
34     void (*destroy) (struct chart *);
35   };
36
37 struct chart
38   {
39     const struct chart_class *class;
40     int ref_cnt;
41   };
42
43 void chart_init (struct chart *, const struct chart_class *);
44 bool chart_create_file (const char *type, const char *file_name_tmpl,
45                         int number, plPlotterParams *,
46                         char **file_namep, plPlotter **lpp);
47
48 /* The geometry of a chart. */
49 struct chart_geometry
50   {
51     int data_top   ;
52     int data_right ;
53     int data_bottom;
54     int data_left  ;
55
56     int abscissa_top;
57
58     int ordinate_right ;
59
60     int title_bottom ;
61
62     int legend_left ;
63     int legend_right ;
64
65     /* Default font size for the plot (if zero, then use plotter default) */
66     int font_size;
67
68     struct chart_colour fill_colour;
69
70     /* Stuff Particular to Cartesians (and Boxplots ) */
71     double ordinate_scale;
72     double abscissa_scale;
73     double x_min;
74     double x_max;
75     double y_min;
76     double y_max;
77   };
78
79 void chart_geometry_init (plPlotter *, struct chart_geometry *);
80 void chart_geometry_free (plPlotter *);
81
82 #endif /* output/chart-provider.h */