Added Boxplots to the EXAMINE subcommand repertoire
[pspp-builds.git] / src / chart.h
index aaf7abc850437baf9e24dd283ef48ada7dfa8ffb..eec5bff5b847a1d6d3b679c28156919c1b8651bd 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <stdio.h>
 #include <plot.h>
+#include <gsl/gsl_histogram.h>
+
 #include "var.h"
 
 
@@ -59,7 +61,7 @@ struct chart {
 
   char fill_colour[10];
 
-  /* Stuff Particular to Cartesians */
+  /* Stuff Particular to Cartesians (and Boxplots ) */
   double ordinate_scale;
   double abscissa_scale;
   double x_min;
@@ -75,6 +77,7 @@ int  chart_initialise(struct chart *ch);
 void chart_finalise(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);
@@ -113,17 +116,35 @@ 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) ;
+
+
 
 
-double chart_rounded_tick(double tick);
+
+struct slice {
+  const char *label;
+  double magnetude;
+};
+
 
 
-void draw_piechart(struct chart *ch, const struct variable *v);
+
+/* Draw a piechart */
+void piechart_plot(const char *title,
+                  const struct slice *slices, int n_slices);
 
 void draw_scatterplot(struct chart *ch);
 
@@ -131,15 +152,31 @@ 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, double tick);
+                       double min, double max, int ticks);
 
 void chart_write_yscale(struct chart *ch, 
-                       double min, double max, double tick);
+                       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 boxplot_draw_yscale(struct chart *ch , double y_max, double y_min);
 
 
 enum CHART_DIM