categoricals_get_user_data_by_category_real (cmd->cats, iact_idx, grp);
struct string label;
+
+ if (es[v].histogram == NULL)
+ continue;
+
ds_init_cstr (&label,
var_to_string (cmd->dep_vars[v]));
histogram = freq_tab_to_hist (frq, &vf->tab, vf->var);
- chart_item_submit (histogram_chart_create (
+ if ( histogram)
+ {
+ chart_item_submit (histogram_chart_create (
histogram->gsl_hist, var_to_string(vf->var),
vf->tab.valid_cases,
d[FRQ_MEAN],
d[FRQ_STDDEV],
frq->hist->draw_normal));
- statistic_destroy (&histogram->parent);
+ statistic_destroy (&histogram->parent);
+ }
}
if (frq->pie)
bin_width = chart_rounded_tick (bin_width);
histogram = histogram_create (bin_width, x_min, x_max);
+
+ if ( histogram == NULL)
+ return NULL;
+
for (i = 0; i < ft->n_valid; i++)
{
const struct freq *f = &ft->valid[i];
#include <gsl/gsl_histogram.h>
#include <math.h>
+#include "libpspp/message.h"
#include "libpspp/assertion.h"
#include "libpspp/cast.h"
#include "math/chart-geometry.h"
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
#include "gl/xalloc.h"
void
+1 otherwise. */
short sparse_end = 0;
- assert (max >= min);
-
if (max == min)
- bin_width = 1;
+ {
+ msg (MW, _("Not creating histogram because the data contains less than 2 distinct values"));
+ free (h);
+ return NULL;
+ }
+
+ assert (max > min);
lower_limit = floor (min / half_bin_width) - 1;
upper_limit = floor (max / half_bin_width) + 1;
/PLOT = histogram
.
])
-AT_CHECK([pspp -o pspp.csv examine.sps])
+AT_CHECK([pspp -o pspp.csv examine.sps], [0], [ignore])
dnl Ignore output -- this is just a no-crash check.
AT_CLEANUP
frequencies /x /histogram /STATISTICS=median.
])
-AT_CHECK([pspp -O format=csv frequencies.sps], [0], [dnl
-Table: x
-Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
-,1.00,1,100.00,100.00,100.00
-Total,,1,100.0,100.0,
-
-Table: x
-N,Valid,1
-,Missing,0
-S.E. Kurt,,.00
-,50 (Median),1.00
-])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0], [ignore])
+dnl Ignore output - No crash test.
AT_CLEANUP
# Tests for a bug which caused FREQUENCIES following TEMPORARY to