1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2004 Free Software Foundation, Inc.
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.
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.
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/>. */
28 #include <libpspp/str.h>
29 #include <libpspp/alloc.h>
33 extern struct som_table_class tab_table_class;
39 struct outp_driver *d;
41 d = outp_drivers (NULL);
45 chart = xmalloc (sizeof *chart);
46 d->class->initialise_chart(d, chart);
53 if (pl_openpl_r (chart->lp) < 0) /* open Plotter */
56 pl_fspace_r (chart->lp, 0.0, 0.0, 1000.0, 1000.0); /* set coordinate system */
57 pl_flinewidth_r (chart->lp, 0.25); /* set line thickness */
58 pl_pencolorname_r (chart->lp, "black");
60 pl_erase_r (chart->lp); /* erase graphics display */
61 pl_filltype_r(chart->lp,0);
63 pl_savestate_r(chart->lp);
65 /* Set default chartetry */
66 chart->data_top = 900;
67 chart->data_right = 800;
68 chart->data_bottom = 120;
69 chart->data_left = 150;
70 chart->abscissa_top = 70;
71 chart->ordinate_right = 120;
72 chart->title_bottom = 920;
73 chart->legend_left = 810;
74 chart->legend_right = 1000;
76 strcpy(chart->fill_colour,"red");
78 /* Get default font size */
79 if ( !chart->font_size)
80 chart->font_size = pl_fontsize_r(chart->lp, -1);
82 /* Draw the data area */
84 chart->data_left, chart->data_bottom,
85 chart->data_right, chart->data_top);
91 chart_submit(struct chart *chart)
94 struct outp_driver *d;
99 pl_restorestate_r(chart->lp);
101 s.class = &tab_table_class;
106 if (pl_closepl_r (chart->lp) < 0) /* close Plotter */
108 fprintf (stderr, "Couldn't close Plotter\n");
111 pl_deletepl_r(chart->lp);
113 pl_deleteplparams(chart->pl_params);
115 d = outp_drivers (NULL);
116 d->class->finalise_chart(d, chart);