X-Git-Url: https://git.cworth.org/git?p=acre;a=blobdiff_plain;f=acre.c;h=8ba639ebf24e5c86321a482c6b9e2482ce3aa6d6;hp=6cd3a0b3c309fef4d49d5bffc05601e76f520e99;hb=2ede293f10cdbf9267f48823930950d31be83767;hpb=4a5a4c8bad866e53298a1cdf47104c2711c139df diff --git a/acre.c b/acre.c index 6cd3a0b..8ba639e 100644 --- a/acre.c +++ b/acre.c @@ -164,6 +164,7 @@ acre_add_data (acre_t *acre, acre_data_t *data) #define ACRE_PAD (ACRE_FONT_SIZE) #define ACRE_TICK_MAJOR_SIZE 6 #define ACRE_TICK_MINOR_SIZE 3 +#define ACRE_TICK_MINOR_DIVISIONS 5 #define ACRE_X_TICK_VALUE_PAD 2 #define ACRE_Y_TICK_VALUE_PAD 4 @@ -378,7 +379,7 @@ _expand_range_for_width (double *axis_min, double *axis_max, int pixel_size) range = *axis_max - *axis_min; step = _step_for_range (range); - pixel_step = step * pixel_size / range; + pixel_step = step * pixel_size / range / ACRE_TICK_MINOR_DIVISIONS; /* We expand the range by the ratio of the pixel step to the floor * of the pixel_step. @@ -512,14 +513,13 @@ _draw_ticks (acre_t *acre, { cairo_t *cr = acre->cr; double t, step, sub_step; - int minor_divisions = 5; cairo_save (cr); _set_transform_to_data_space (acre); step = _step_for_range (axis_max - axis_min); - sub_step = step / minor_divisions; + sub_step = step / ACRE_TICK_MINOR_DIVISIONS; for (t = (floor (axis_min / sub_step) + 1) * sub_step; t <= axis_max;