From: Carl Worth Date: Tue, 27 Jan 2009 19:48:46 +0000 (-0800) Subject: Add some distinguishing colors for the datasets X-Git-Url: https://git.cworth.org/git?p=acre;a=commitdiff_plain;h=af6a6a5cafbbbbb1d5e1cffcab4c5903853d9758 Add some distinguishing colors for the datasets This is quite cheesy for now. It's just three hard-coded, primary colors. (Much nicer would be to take N evenly-spaced colors from a percpetually linear space.) But this gives us parity with the functionality of the original motorsim plot, so it's enough for getting us closer to being able to replace that. --- diff --git a/acre.c b/acre.c index e444e30..12be71d 100644 --- a/acre.c +++ b/acre.c @@ -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++) {