output-item: Collapse the inheritance hierarchy into a single struct.
[pspp] / src / language / stats / roc.c
index f18964a56298876275958a24e2adbc7e26eb4168..b3f8e91e47da59645d04f83cfa75ae66a4f3ff88 100644 (file)
@@ -33,7 +33,6 @@
 #include "language/lexer/variable-parser.h"
 #include "libpspp/misc.h"
 #include "math/sort.h"
-#include "output/chart-item.h"
 #include "output/charts/roc-chart.h"
 #include "output/pivot-table.h"
 
@@ -1094,6 +1093,13 @@ show_coords (struct roc_state *rs, const struct cmd_roc *roc)
          const double sp = case_data_idx (cc, ROC_TN)->f /
            (case_data_idx (cc, ROC_TN)->f + case_data_idx (cc, ROC_FP)->f);
 
+          if (coord_idx >= n_coords)
+            {
+              assert (coord_idx == n_coords);
+              pivot_category_create_leaf (
+                coordinates->root, pivot_value_new_integer (++n_coords));
+            }
+
           pivot_table_put3 (
             table, 0, coord_idx, var_idx,
             pivot_value_new_var_value (roc->vars[i],
@@ -1106,16 +1112,9 @@ show_coords (struct roc_state *rs, const struct cmd_roc *roc)
           coord_idx++;
        }
 
-      if (coord_idx > n_coords)
-        n_coords = coord_idx;
-
       casereader_destroy (r);
     }
 
-  for (size_t i = 0; i < n_coords; i++)
-    pivot_category_create_leaf (coordinates->root,
-                                pivot_value_new_integer (i + 1));
-
   pivot_table_submit (table);
 }