- int i;
- const struct variable *weight = dict_get_weight (ct->dict);
- const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0;
-
- const int row_headers = 1;
- const int column_headers = 2;
- struct tab_table *table =
- tab_create (row_headers + 2, column_headers + ost->n_vars);
-
- tab_headers (table, row_headers, 0, column_headers, 0);
-
- tab_title (table, _("Frequencies"));
-
- /* Vertical lines inside the box */
- tab_box (table, 1, 0, -1, TAL_1,
- row_headers, 0, tab_nc (table) - 1, tab_nr (table) - 1 );
-
- /* Box around the table */
- tab_box (table, TAL_2, TAL_2, -1, -1,
- 0, 0, tab_nc (table) - 1, tab_nr (table) - 1 );
-
- tab_joint_text (table, 1, 0, 2, 0,
- TAT_TITLE | TAB_CENTER, _("Value"));
-
- tab_text_format (table, 1, 1, 0, _("Success (%.*g)"),
- DBL_DIG + 1, ct->success);
- tab_text_format (table, 2, 1, 0, _("Failure (%.*g)"),
- DBL_DIG + 1, ct->failure);
-
- tab_hline (table, TAL_2, 0, tab_nc (table) - 1, column_headers);
- tab_vline (table, TAL_2, row_headers, 0, tab_nr (table) - 1);
-
- for (i = 0 ; i < ost->n_vars ; ++i)
+ struct pivot_table *table = pivot_table_create (N_("Frequencies"));
+ pivot_table_set_weight_var (table, dict_get_weight (ct->dict));
+
+ char *success = xasprintf (_("Success (%.*g)"), DBL_DIG + 1, ct->success);
+ char *failure = xasprintf (_("Failure (%.*g)"), DBL_DIG + 1, ct->failure);
+ struct pivot_dimension *values = pivot_dimension_create (
+ table, PIVOT_AXIS_COLUMN, N_("Value"),
+ success, PIVOT_RC_COUNT,
+ failure, PIVOT_RC_COUNT);
+ values->root->show_label = true;
+ free (failure);
+ free (success);
+
+ struct pivot_dimension *variables = pivot_dimension_create (
+ table, PIVOT_AXIS_ROW, N_("Variable"));
+
+ for (size_t i = 0 ; i < ost->n_vars ; ++i)