X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fchart.h;h=c0ab0a2063106397e8c13205cb378521c0595f6a;hb=92fb12eb06716d14c05b781f5d9dcde956d77c30;hp=47c6c7d83198983823cac28cf2e60083b602b68a;hpb=02ef5fef5288b80a4822e1006f6cb2b1369a55bd;p=pspp diff --git a/src/chart.h b/src/chart.h index 47c6c7d831..c0ab0a2063 100644 --- a/src/chart.h +++ b/src/chart.h @@ -14,17 +14,22 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef CHART_H #define CHART_H +#include #include -#include +#include #include "var.h" +#ifndef NO_CHARTS +#include +#endif + /* Array of standard colour names */ extern const char *data_colour[]; @@ -32,8 +37,14 @@ extern const char *data_colour[]; struct chart { +#ifndef NO_CHARTS plPlotter *lp ; plPlotterParams *pl_params; +#else + void *lp; +#endif + char *filename; + FILE *file; /* The geometry of the chart See diagram at the foot of this file. @@ -59,17 +70,26 @@ struct chart { char fill_colour[10]; -}; + /* Stuff Particular to Cartesians (and Boxplots ) */ + double ordinate_scale; + double abscissa_scale; + double x_min; + double x_max; + double y_min; + double y_max; +}; -int chart_initialise(struct chart *ch); -void chart_finalise(struct chart *ch); +struct chart * chart_create(void); +void chart_submit(struct chart *ch); +double chart_rounded_tick(double tick); +void chart_write_xlabel(struct chart *ch, const char *label); +void chart_write_ylabel(struct chart *ch, const char *label); -void chart_write_title(struct chart *ch, - const char *title); +void chart_write_title(struct chart *ch, const char *title, ...); enum tick_orientation { TICK_ABSCISSA=0, @@ -103,23 +123,78 @@ struct normal_curve }; -void draw_histogram(struct chart *ch, - const struct variable *v, - const char *title, - struct normal_curve *norm, - int show_normal); +void histogram_write_legend(struct chart *ch, const struct normal_curve *norm); + + +/* Plot a gsl_histogram */ +void histogram_plot(const gsl_histogram *hist, const char *factorname, + const struct normal_curve *norm, short show_normal); + + +/* Create a gsl_histogram and set it's parameters based upon + x_min, x_max and bins. + The caller is responsible for freeing the histogram. +*/ +gsl_histogram * histogram_create(double bins, double x_min, double x_max) ; + + + + + +struct slice { + const char *label; + double magnetude; +}; + + + + +/* Draw a piechart */ +void piechart_plot(const char *title, + const struct slice *slices, int n_slices); + +void draw_scatterplot(struct chart *ch); + + +void draw_lineplot(struct chart *ch); + + +/* Set the scale on chart CH. + The scale extends from MIN to MAX . + TICK is the approximate number of tick marks. +*/ + +void chart_write_xscale(struct chart *ch, + double min, double max, int ticks); + +void chart_write_yscale(struct chart *ch, + double min, double max, int ticks); + + +void chart_datum(struct chart *ch, int dataset, double x, double y); + +struct metrics; + +void boxplot_draw_boxplot(struct chart *ch, + double box_centre, + double box_width, + struct metrics *m, + const char *name); -void draw_piechart(struct chart *ch, const struct variable *v); +void boxplot_draw_yscale(struct chart *ch , double y_max, double y_min); -void draw_scatterplot(struct chart *ch, const char *title, - const char *xlabel, const char *ylabel); +enum CHART_DIM + { + CHART_DIM_X, + CHART_DIM_Y + }; -void draw_lineplot(struct chart *ch, const char *title, - const char *xlabel, const char *ylabel); +void chart_line(struct chart *ch, double slope, double intercept, + double limit1, double limit2, enum CHART_DIM limit_d); #endif