1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2014 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/>. */
17 #ifndef OUTPUT_CHARTS_SCATTERPLOT_H
18 #define OUTPUT_CHARTS_SCATTERPLOT_H 1
20 #include "output/chart-item.h"
23 struct scatterplot_chart
25 struct chart_item chart_item;
26 struct casereader *data;
27 const struct variable *xvar, *yvar, *byvar;
31 /* If the number of distinct values of byvar */
32 /* exceeds a certain limit, the warning flag */
33 /* is activated after the chart is drawn */
37 struct scatterplot_chart *
38 scatterplot_create (const struct casereader *,
39 const struct variable *,
40 const struct variable *,
41 const struct variable *,
44 double xmin, double xmax, double ymin, double ymax);
46 /* This boilerplate for scatterplot_chart, a subclass of chart_item, was
47 autogenerated by mk-class-boilerplate. */
50 #include "libpspp/cast.h"
52 extern const struct chart_item_class scatterplot_chart_class;
54 /* Returns true if SUPER is a scatterplot_chart, otherwise false. */
56 is_scatterplot_chart (const struct chart_item *super)
58 return super->class == &scatterplot_chart_class;
61 /* Returns SUPER converted to scatterplot_chart. SUPER must be a scatterplot_chart, as
62 reported by is_scatterplot_chart. */
63 static inline struct scatterplot_chart *
64 to_scatterplot_chart (const struct chart_item *super)
66 assert (is_scatterplot_chart (super));
67 return UP_CAST (super, struct scatterplot_chart, chart_item);
70 /* Returns INSTANCE converted to chart_item. */
71 static inline struct chart_item *
72 scatterplot_chart_super (const struct scatterplot_chart *instance)
74 return CONST_CAST (struct chart_item *, &instance->chart_item);
77 /* Increments INSTANCE's reference count and returns INSTANCE. */
78 static inline struct scatterplot_chart *
79 scatterplot_chart_ref (const struct scatterplot_chart *instance)
81 return to_scatterplot_chart (chart_item_ref (&instance->chart_item));
84 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
85 the reference count is now zero. */
87 scatterplot_chart_unref (struct scatterplot_chart *instance)
89 chart_item_unref (&instance->chart_item);
92 /* Returns true if INSTANCE's reference count is greater than 1,
95 scatterplot_chart_is_shared (const struct scatterplot_chart *instance)
97 return chart_item_is_shared (&instance->chart_item);
101 scatterplot_chart_submit (struct scatterplot_chart *instance)
103 chart_item_submit (&instance->chart_item);
106 #endif /* output/charts/scatterplot.h */