projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ROC: Improve error messages and coding style.
[pspp]
/
src
/
output
/
charts
/
barchart.h
diff --git
a/src/output/charts/barchart.h
b/src/output/charts/barchart.h
index dabf61b05036861d84b6307ab4fec151a3833ef6..df27304c568149930637eb2cfa80b62c97c73688 100644
(file)
--- a/
src/output/charts/barchart.h
+++ b/
src/output/charts/barchart.h
@@
-20,7
+20,7
@@
#include "libpspp/str.h"
#include "libpspp/hmap.h"
#include "data/value.h"
#include "libpspp/str.h"
#include "libpspp/hmap.h"
#include "data/value.h"
-#include "output/chart
-item
.h"
+#include "output/chart.h"
struct category
struct category
@@
-29,12
+29,16
@@
struct category
int idx; /* Unique zero based index */
struct string label; /* The label to be displayed for this category */
union value val; /* The value of this category */
int idx; /* Unique zero based index */
struct string label; /* The label to be displayed for this category */
union value val; /* The value of this category */
+ int width; /* The width of VAL */
};
struct barchart
{
};
struct barchart
{
- struct chart_item chart_item;
+ struct chart chart;
+
+ /* Should the chart be displayed as percentages */
+ bool percent;
/* The categories */
struct freq **cats;
/* The categories */
struct freq **cats;
@@
-48,6
+52,9
@@
struct barchart
/* The largest count of all the categories */
double largest;
/* The largest count of all the categories */
double largest;
+ /* The sum of all the counts */
+ double total_count;
+
/* The label for the ordinate (vertical axis) */
char *ylabel;
/* The label for the ordinate (vertical axis) */
char *ylabel;
@@
-63,9
+70,8
@@
struct barchart
/* A hash table of struct category indexed by VAL */
struct hmap secondaries;
/* A hash table of struct category indexed by VAL */
struct hmap secondaries;
-
- /* A array of pointers to the members of the above hmap,
- sorted by VAL */
+ /* A array of pointers to the members of the above hmap,
+ (the secondaries) sorted by VAL */
struct category **ss;
};
struct category **ss;
};
@@
-73,21
+79,21
@@
struct barchart
struct variable;
struct freq;
struct variable;
struct freq;
-struct chart
_item
*barchart_create (const struct variable **, int n_vars,
- const char *ylabel,
+struct chart *barchart_create (const struct variable **, int n_vars,
+ const char *ylabel,
bool percent,
struct freq *const *, int n_cats);
\f
struct freq *const *, int n_cats);
\f
-/* This boilerplate for barchart, a subclass of chart
_item
, was
+/* This boilerplate for barchart, a subclass of chart, was
autogenerated by mk-class-boilerplate. */
#include <assert.h>
#include "libpspp/cast.h"
autogenerated by mk-class-boilerplate. */
#include <assert.h>
#include "libpspp/cast.h"
-extern const struct chart_
item_
class barchart_class;
+extern const struct chart_class barchart_class;
/* Returns true if SUPER is a barchart, otherwise false. */
static inline bool
/* Returns true if SUPER is a barchart, otherwise false. */
static inline bool
-is_barchart (const struct chart
_item
*super)
+is_barchart (const struct chart *super)
{
return super->class == &barchart_class;
}
{
return super->class == &barchart_class;
}
@@
-95,24
+101,24
@@
is_barchart (const struct chart_item *super)
/* Returns SUPER converted to barchart. SUPER must be a barchart, as
reported by is_barchart. */
static inline struct barchart *
/* Returns SUPER converted to barchart. SUPER must be a barchart, as
reported by is_barchart. */
static inline struct barchart *
-to_barchart (const struct chart
_item
*super)
+to_barchart (const struct chart *super)
{
assert (is_barchart (super));
{
assert (is_barchart (super));
- return UP_CAST (super, struct barchart, chart
_item
);
+ return UP_CAST (super, struct barchart, chart);
}
}
-/* Returns INSTANCE converted to chart
_item
. */
-static inline struct chart
_item
*
+/* Returns INSTANCE converted to chart. */
+static inline struct chart *
barchart_super (const struct barchart *instance)
{
barchart_super (const struct barchart *instance)
{
- return CONST_CAST (struct chart
_item *, &instance->chart_item
);
+ return CONST_CAST (struct chart
*, &instance->chart
);
}
/* Increments INSTANCE's reference count and returns INSTANCE. */
static inline struct barchart *
barchart_ref (const struct barchart *instance)
{
}
/* Increments INSTANCE's reference count and returns INSTANCE. */
static inline struct barchart *
barchart_ref (const struct barchart *instance)
{
- return to_barchart (chart_
item_ref (&instance->chart_item
));
+ return to_barchart (chart_
ref (&instance->chart
));
}
/* Decrements INSTANCE's reference count, then destroys INSTANCE if
}
/* Decrements INSTANCE's reference count, then destroys INSTANCE if
@@
-120,7
+126,7
@@
barchart_ref (const struct barchart *instance)
static inline void
barchart_unref (struct barchart *instance)
{
static inline void
barchart_unref (struct barchart *instance)
{
- chart_
item_unref (&instance->chart_item
);
+ chart_
unref (&instance->chart
);
}
/* Returns true if INSTANCE's reference count is greater than 1,
}
/* Returns true if INSTANCE's reference count is greater than 1,
@@
-128,13
+134,13
@@
barchart_unref (struct barchart *instance)
static inline bool
barchart_is_shared (const struct barchart *instance)
{
static inline bool
barchart_is_shared (const struct barchart *instance)
{
- return chart_i
tem_is_shared (&instance->chart_item
);
+ return chart_i
s_shared (&instance->chart
);
}
static inline void
barchart_submit (struct barchart *instance)
{
}
static inline void
barchart_submit (struct barchart *instance)
{
- chart_
item_submit (&instance->chart_item
);
+ chart_
submit (&instance->chart
);
}
\f
#endif /* output/charts/barchart.h */
}
\f
#endif /* output/charts/barchart.h */