limit the number of variables in barchart from crosstabs #58968
[pspp] / src / language / stats / crosstabs.q
index 0665b75e6f74bf1cc3d9355ff3477ff6546b5532..e8739bc1bf438d2616fcbde50c8986bbeae77912 100644 (file)
@@ -782,10 +782,11 @@ postcalc (struct crosstabs_proc *proc)
         }
       if (proc->barchart)
         {
-          const struct variable **vars = xcalloc (xt->n_vars, sizeof *vars);
-          for (size_t i = 0; i < xt->n_vars; i++)
+          int n_vars = (xt->n_vars > 2 ? 2 : xt->n_vars);
+          const struct variable **vars = xcalloc (n_vars, sizeof *vars);
+          for (size_t i = 0; i < n_vars; i++)
             vars[i] = xt->vars[i].var;
-          chart_item_submit (barchart_create (vars, xt->n_vars, _("Count"),
+          chart_item_submit (barchart_create (vars, n_vars, _("Count"),
                                               false,
                                               xt->entries, xt->n_entries));
           free (vars);
@@ -1097,7 +1098,7 @@ output_crosstabulation (struct crosstabs_proc *proc, struct crosstabulation *xt)
       if (!pivot_table_is_empty (risk))
         pivot_table_submit (risk);
       else
-        pivot_table_destroy (risk);
+        pivot_table_unref (risk);
     }
 
   if (direct)
@@ -1243,7 +1244,8 @@ create_crosstab_table (struct crosstabs_proc *proc, struct crosstabulation *xt,
       free (s);
     }
   struct pivot_table *table = pivot_table_create__ (
-    pivot_value_new_user_text_nocopy (ds_steal_cstr (&title)));
+    pivot_value_new_user_text_nocopy (ds_steal_cstr (&title)),
+    "Crosstabulation");
   pivot_table_set_weight_format (table, &proc->weight_format);
   table->omit_empty = true;
 
@@ -1362,6 +1364,7 @@ create_risk_table (struct crosstabulation *xt,
     risk, PIVOT_AXIS_COLUMN, N_("Values"),
     N_("Value"), PIVOT_RC_OTHER);
   pivot_category_create_group (
+  /* xgettext:no-c-format */
     values->root, N_("95% Confidence Interval"),
     N_("Lower"), PIVOT_RC_OTHER,
     N_("Upper"), PIVOT_RC_OTHER);
@@ -1409,7 +1412,7 @@ create_direct_table (struct crosstabulation *xt)
     N_("Value"), PIVOT_RC_OTHER,
     N_("Asymp. Std. Error"), PIVOT_RC_OTHER,
     N_("Approx. T"), PIVOT_RC_OTHER,
-    N_("Approx Sig."), PIVOT_RC_SIGNIFICANCE);
+    N_("Approx. Sig."), PIVOT_RC_SIGNIFICANCE);
 
   struct pivot_dimension *statistics = pivot_dimension_create (
     direct, PIVOT_AXIS_ROW, N_("Statistics"));