]> git.cworth.org Git - acre/blobdiff - acre.c
Add some distinguishing colors for the datasets
[acre] / acre.c
diff --git a/acre.c b/acre.c
index 1ca05057544f0bef7ce378f05542beb7b7636163..12be71d249952421f0fb17caa956e3cd74377a0f 100644 (file)
--- a/acre.c
+++ b/acre.c
@@ -160,7 +160,7 @@ acre_add_data (acre_t *acre, acre_data_t *data)
 
 #define ACRE_FONT_FAMILY "sans"
 #define ACRE_FONT_SIZE 12
-#define ACRE_TITLE_FONT_SIZE 32
+#define ACRE_TITLE_FONT_SIZE 20
 #define ACRE_PAD (ACRE_FONT_SIZE)
 #define ACRE_TICK_MAJOR_SIZE 6
 #define ACRE_TICK_MINOR_SIZE 3
@@ -502,6 +502,16 @@ _draw_data (acre_t *acre)
     cairo_t *cr = acre->cr;
     unsigned int d, i;
     acre_data_t *data;
+#define NUM_COLORS 3
+    struct {
+       double r;
+       double g;
+       double b;
+    } colors [NUM_COLORS] = {
+       {1, 0, 0},
+       {0, 1, 0},
+       {0, 0, 1}
+    };
 
     cairo_save (cr);
 
@@ -510,6 +520,11 @@ _draw_data (acre_t *acre)
     _set_transform_to_data_space (acre);
 
     for (d = 0; d < acre->num_data; d++) {
+       int color = d % NUM_COLORS;
+       cairo_set_source_rgb (cr,
+                             colors[color].r,
+                             colors[color].g,
+                             colors[color].b);
        data = acre->data[d];
        cairo_new_path (cr);
        for (i = 0; i < data->num_points; i++) {
@@ -552,7 +567,7 @@ _draw_ticks (acre_t *acre,
         t += sub_step)
     {
        int tick_size;
-       if (fabs((t / step) - (int) (t / step)) < 0.5 * (sub_step / step))
+       if (fabs((t / step) - round (t / step)) < 0.5 * (sub_step / step))
            tick_size = ACRE_TICK_MAJOR_SIZE;
        else
            tick_size = ACRE_TICK_MINOR_SIZE;