1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2014, 2015 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/>. */
19 #include "output/charts/scatterplot.h"
21 #include <gsl/gsl_cdf.h>
23 #include "data/casereader.h"
24 #include "libpspp/cast.h"
25 #include "output/chart-item-provider.h"
27 #include "gl/minmax.h"
29 /* Creates a scatterplot */
30 struct scatterplot_chart *
31 scatterplot_create (const struct casereader *reader,
34 const struct variable *byvar,
37 double xmin, double xmax, double ymin, double ymax)
39 struct scatterplot_chart *spc;
41 spc = xzalloc (sizeof *spc);
42 chart_item_init (&spc->chart_item, &scatterplot_chart_class, label);
51 spc->xlabel = xstrdup (xlabel);
52 spc->ylabel = xstrdup (ylabel);
53 spc->byvar = byvar != NULL ? var_clone (byvar) : NULL;
55 spc->byvar_overflow = byvar_overflow;
61 scatterplot_chart_destroy (struct chart_item *chart_item)
63 struct scatterplot_chart *spc = to_scatterplot_chart (chart_item);
64 casereader_destroy (spc->data);
68 var_destroy (spc->byvar);
72 const struct chart_item_class scatterplot_chart_class =
74 scatterplot_chart_destroy