Skip to content

Commit

Permalink
Improve visual appearance of horizontal marker lines
Browse files Browse the repository at this point in the history
This changes two things to improve the appearance of the profile:
- the partial pressure scale is now in 0.5 increments if the total is <= 4
  and in 1.0 increments if it is > 4.
- the depth marker lines end slightly below the depth chart so that we no
  longer have overlap between the depth scale and the partial pressure
  scale.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
  • Loading branch information
dirkhh committed Dec 17, 2012
1 parent 33ae98c commit a691a8e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ static void plot_pp_text(struct graphics_context *gc, struct plot_info *pi)

setup_pp_limits(gc, pi);
pp = floor(pi->maxpp * 10.0) / 10.0 + 0.2;
dpp = floor(2.0 * pp) / 10.0;
dpp = pp > 4 ? 1.0 : 0.5;
hpos = pi->entry[pi->nr - 1].sec;
set_source_rgba(gc, PP_LINES);
for (m = 0.0; m <= pp; m += dpp) {
Expand Down Expand Up @@ -653,7 +653,7 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi
cairo_t *cr = gc->cr;
int sec, depth;
struct plot_data *entry;
int maxtime, maxdepth, marker;
int maxtime, maxdepth, marker, maxline;
int increments[8] = { 10, 20, 30, 60, 5*60, 10*60, 15*60, 30*60 };

/* Get plot scaling limits */
Expand Down Expand Up @@ -705,9 +705,9 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi
case METERS: marker = 10000; break;
case FEET: marker = 9144; break; /* 30 ft */
}

maxline = MAX(pi->maxdepth + marker, maxdepth * 2 / 3);
set_source_rgba(gc, DEPTH_GRID);
for (i = marker; i < maxdepth; i += marker) {
for (i = marker; i < maxline; i += marker) {
move_to(gc, 0, i);
line_to(gc, 1, i);
}
Expand Down

0 comments on commit a691a8e

Please sign in to comment.