X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcharts%2Fbarchart.h;h=dabf61b05036861d84b6307ab4fec151a3833ef6;hb=97fb55e07cac602cbca57ce8005de5c8a67a73cc;hp=ea6c27e0796a246c025cd2e3a835abafb6a56766;hpb=6e44fb76d15ebc34122753b8a7a7d4a1b82bcb43;p=pspp diff --git a/src/output/charts/barchart.h b/src/output/charts/barchart.h index ea6c27e079..dabf61b050 100644 --- a/src/output/charts/barchart.h +++ b/src/output/charts/barchart.h @@ -18,19 +18,64 @@ #define BARCHART_H #include "libpspp/str.h" +#include "libpspp/hmap.h" +#include "data/value.h" #include "output/chart-item.h" + +struct category +{ + struct hmap_node node; + 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 */ +}; + + struct barchart { struct chart_item chart_item; - struct slice *bars; - int n_bars; + + /* The categories */ + struct freq **cats; + + /* The total number of categories (regardless of level) */ + int n_nzcats; + + /* The number of primary categories */ + int n_pcats; + + /* The largest count of all the categories */ double largest; + + /* The label for the ordinate (vertical axis) */ char *ylabel; + + /* The variables holding the categorical values */ + const struct variable **var; + int n_vars; + + int widths[2]; + + /* A hash table of struct category indexed by VAL */ + struct hmap primaries; + + /* 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 */ + struct category **ss; }; -struct chart_item *barchart_create (const char *title, const char *ylabel, - const struct slice *, int n_bars); + +struct variable; +struct freq; + +struct chart_item *barchart_create (const struct variable **, int n_vars, + const char *ylabel, + struct freq *const *, int n_cats); /* This boilerplate for barchart, a subclass of chart_item, was autogenerated by mk-class-boilerplate. */