summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-11 15:58:37 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-11 15:58:37 -0800
commit0b69bd474d08570981a296ff847a9fd01b4b53af (patch)
treef73c8aa6fbdc61dba65a5cff2560fee80960706a /profile.c
parentc26fa209e329d7bfbc853c0b99c6aef0b98041dc (diff)
downloadsubsurface-0b69bd474d08570981a296ff847a9fd01b4b53af.tar.gz
Only display a depth scale appropriate for the depth of the dive
Showing the depth scale all the way to the bottom of the profile plot looks strange when there are partial pressure graphs down there. So instead we only plot down to the next marker below the maximum depth of the actual dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/profile.c b/profile.c
index 24b9523fd..c8571b8d5 100644
--- a/profile.c
+++ b/profile.c
@@ -517,7 +517,12 @@ static void plot_depth_scale(struct graphics_context *gc, struct plot_info *pi)
case FEET: marker = 9144; break; /* 30 ft */
}
set_source_rgba(gc, DEPTH_GRID);
- for (i = marker; i < maxdepth; i += marker) {
+ /* don't write depth labels all the way to the bottom as
+ * there may be other graphs below the depth plot (like
+ * partial pressure graphs) where this would look out
+ * of place - so we only make sure that we print the next
+ * marker below the actual maxdepth of the dive */
+ for (i = marker; i <= pi->maxdepth + marker; i += marker) {
double d = get_depth_units(i, NULL, NULL);
plot_text(gc, &tro, -0.002, i, "%.0f", d);
}