Histograms: Rotate labels when there are lots of bins
[pspp] / src / output / cairo-chart.h
index 1a23dd179329cde657b12a98cd6c5f1ef1c8b05b..0864d7e0142e00b45c95b2cec86c5d9b74ddd95b 100644 (file)
@@ -31,17 +31,24 @@ struct xrchart_colour
     uint8_t blue;
   };
 
+struct xrchart_axis
+{
+  int data_max;
+  int data_min;
+
+  double scale;
+  double min;
+  double max;
+};
+
 /* The geometry of a chart. */
 struct xrchart_geometry
   {
-    int data_top;
-    int data_right;
-    int data_bottom;
-    int data_left;
+    /* Bottom of the abscissa segment */
+    int abscissa_bottom;
 
-    int abscissa_top;
-
-    int ordinate_right;
+    /* Left of the ordinate segment */
+    int ordinate_left;
 
     int title_bottom;
 
@@ -57,12 +64,9 @@ struct xrchart_geometry
     struct xrchart_colour fill_colour;
 
     /* Stuff particular to cartesians and boxplots. */
-    double ordinate_scale;
-    double abscissa_scale;
-    double x_min;
-    double x_max;
-    double y_min;
-    double y_max;
+    struct xrchart_axis axis[2];
+
+    /* True iff a path is currently being drawn */
     bool in_path;
   };
 
@@ -75,8 +79,8 @@ extern const struct xrchart_colour data_colour[];
 
 enum tick_orientation
   {
-    TICK_ABSCISSA=0,
-    TICK_ORDINATE
+    SCALE_ABSCISSA=0,
+    SCALE_ORDINATE
   };
 
 enum xrmarker_type
@@ -92,13 +96,19 @@ void xrchart_draw_marker (cairo_t *, double x, double y, enum xrmarker_type,
 void xrchart_label (cairo_t *, int horz_justify, int vert_justify,
                     double font_size, const char *);
 
+void xrchart_label_rotate (cairo_t *cr, int horz_justify, int vert_justify,
+                          double font_size, const char *string, double angle);
+
+
 /* Draw a tick mark at position
    If label is non zero, then print it at the tick mark
 */
 void draw_tick (cairo_t *, const struct xrchart_geometry *,
-                enum tick_orientation orientation, double position,
+                enum tick_orientation orientation,
+               bool rotated,
+               double position,
                 const char *label, ...)
-  PRINTF_FORMAT (5, 6);
+  PRINTF_FORMAT (6, 7);
 
 
 /* Write the title on a chart*/
@@ -161,5 +171,8 @@ void xrchart_draw_np_plot (const struct chart_item *, cairo_t *,
                            struct xrchart_geometry *);
 void xrchart_draw_scree (const struct chart_item *, cairo_t *,
                          struct xrchart_geometry *);
+void xrchart_draw_spreadlevel (const struct chart_item *, cairo_t *,
+                         struct xrchart_geometry *);
+
 
 #endif /* output/cairo-chart.h */