TABLEID, ROWID, COLID, LAYERROWID, LAYERCOLID are OK for ROWLABELS=OPPOSITE
[pspp] / src / output / charts / scatterplot.h
index e95562bbad9150d7032e9fadb24920d6dfff6f96..cf549e9c1db5daaded9c43a3d96f432fd7123ecb 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2014 Free Software Foundation, Inc.
+   Copyright (C) 2014, 2015 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #ifndef OUTPUT_CHARTS_SCATTERPLOT_H
 #define OUTPUT_CHARTS_SCATTERPLOT_H 1
 
-#include "output/chart-item.h"
+#include "output/chart.h"
+
+/* Indices for the scatterplot_proto members */
+enum
+  {
+    SP_IDX_X,    /* x value */
+    SP_IDX_Y,    /* y value */
+    SP_IDX_BY,   /* graph category for xy plot */
+  };
 
 /* A  scatterplot. */
 struct scatterplot_chart
   {
-    struct chart_item chart_item;
+    struct chart chart;
     struct casereader *data;
-    const struct variable *xvar, *yvar, *byvar;
+    struct variable *byvar;
+    char *xlabel;
+    char *ylabel;
 
     double y_min, y_max;
     double x_min, x_max;
@@ -35,25 +45,25 @@ struct scatterplot_chart
   };
 
 struct scatterplot_chart *
-scatterplot_create (const struct casereader *, 
-                   const struct variable *, 
-                   const struct variable *,
+scatterplot_create (struct casereader *,
+                   const char *xlabel,
+                   const char *ylabel,
                    const struct variable *,
                    bool *,
                    const char *label,
                    double xmin, double xmax, double ymin, double ymax);
 \f
-/* This boilerplate for scatterplot_chart, a subclass of chart_item, was
+/* This boilerplate for scatterplot_chart, a subclass of chart, was
    autogenerated by mk-class-boilerplate. */
 
 #include <assert.h>
 #include "libpspp/cast.h"
 
-extern const struct chart_item_class scatterplot_chart_class;
+extern const struct chart_class scatterplot_chart_class;
 
 /* Returns true if SUPER is a scatterplot_chart, otherwise false. */
 static inline bool
-is_scatterplot_chart (const struct chart_item *super)
+is_scatterplot_chart (const struct chart *super)
 {
   return super->class == &scatterplot_chart_class;
 }
@@ -61,24 +71,24 @@ is_scatterplot_chart (const struct chart_item *super)
 /* Returns SUPER converted to scatterplot_chart.  SUPER must be a scatterplot_chart, as
    reported by is_scatterplot_chart. */
 static inline struct scatterplot_chart *
-to_scatterplot_chart (const struct chart_item *super)
+to_scatterplot_chart (const struct chart *super)
 {
   assert (is_scatterplot_chart (super));
-  return UP_CAST (super, struct scatterplot_chart, chart_item);
+  return UP_CAST (super, struct scatterplot_chart, chart);
 }
 
-/* Returns INSTANCE converted to chart_item. */
-static inline struct chart_item *
+/* Returns INSTANCE converted to chart. */
+static inline struct chart *
 scatterplot_chart_super (const struct scatterplot_chart *instance)
 {
-  return CONST_CAST (struct chart_item *, &instance->chart_item);
+  return CONST_CAST (struct chart *, &instance->chart);
 }
 
 /* Increments INSTANCE's reference count and returns INSTANCE. */
 static inline struct scatterplot_chart *
 scatterplot_chart_ref (const struct scatterplot_chart *instance)
 {
-  return to_scatterplot_chart (chart_item_ref (&instance->chart_item));
+  return to_scatterplot_chart (chart_ref (&instance->chart));
 }
 
 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
@@ -86,7 +96,7 @@ scatterplot_chart_ref (const struct scatterplot_chart *instance)
 static inline void
 scatterplot_chart_unref (struct scatterplot_chart *instance)
 {
-  chart_item_unref (&instance->chart_item);
+  chart_unref (&instance->chart);
 }
 
 /* Returns true if INSTANCE's reference count is greater than 1,
@@ -94,13 +104,13 @@ scatterplot_chart_unref (struct scatterplot_chart *instance)
 static inline bool
 scatterplot_chart_is_shared (const struct scatterplot_chart *instance)
 {
-  return chart_item_is_shared (&instance->chart_item);
+  return chart_is_shared (&instance->chart);
 }
 
 static inline void
 scatterplot_chart_submit (struct scatterplot_chart *instance)
 {
-  chart_item_submit (&instance->chart_item);
+  chart_submit (&instance->chart);
 }
 \f
 #endif /* output/charts/scatterplot.h */