projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fri Feb 11 00:08:36 2005 Ben Pfaff <blp@gnu.org>
[pspp]
/
src
/
box-whisker.c
diff --git
a/src/box-whisker.c
b/src/box-whisker.c
index 2600e8aa6c6d5b02b17155a5ada939683f3b3a20..773de80984d4405d74d6af6f4b661f5631a7d633 100644
(file)
--- a/
src/box-whisker.c
+++ b/
src/box-whisker.c
@@
-20,6
+20,7
@@
#include "chart.h"
#include <math.h>
#include "chart.h"
#include <math.h>
+#include <assert.h>
#include "misc.h"
#include "factor_stats.h"
#include "misc.h"
#include "factor_stats.h"
@@
-74,16
+75,13
@@
boxplot_draw_boxplot(struct chart *ch,
double box_centre,
double box_width,
struct metrics *m,
double box_centre,
double box_width,
struct metrics *m,
- /*
- const double hinge[3],
- struct weighted_value **wvp,
- int n_data,
- */
const char *name)
{
double whisker[2];
int i;
const char *name)
{
double whisker[2];
int i;
+ assert(m);
+
const double *hinge = m->hinge;
struct weighted_value **wvp = m->wvp;
const double *hinge = m->hinge;
struct weighted_value **wvp = m->wvp;
@@
-104,6
+102,10
@@
boxplot_draw_boxplot(struct chart *ch,
const double box_top =
ch->data_bottom + ( hinge[2] - ch->y_min ) * ch->ordinate_scale;
const double box_top =
ch->data_bottom + ( hinge[2] - ch->y_min ) * ch->ordinate_scale;
+ /* Can't really draw a boxplot if there's no data */
+ if ( n_data == 0 )
+ return ;
+
whisker[1] = hinge[2];
whisker[0] = wvp[0]->v.f;
whisker[1] = hinge[2];
whisker[0] = wvp[0]->v.f;