From 737eac7066f0b375c07f8a3c8206c24f94c0c091 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Wed, 24 Jan 2018 14:19:32 +0300 Subject: [PATCH] Fixes #159: Inconstant space between axis values and plot area (depending on legend position)... Fixes #158: legend.spacing=50: not only plarea.x0-y1 should be changed but axis positions too. --- src/Chart.vala | 7 ------- src/Legend.vala | 8 ++++---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Chart.vala b/src/Chart.vala index 3119466..e6b19b0 100644 --- a/src/Chart.vala +++ b/src/Chart.vala @@ -380,13 +380,6 @@ namespace CairoChart { protected virtual void eval_plarea () { plarea = evarea.copy(); - if (legend.show) - switch(legend.position) { - case Legend.Position.TOP: plarea.y0 += legend.spacing; break; - case Legend.Position.BOTTOM: plarea.y1 -= legend.spacing; break; - case Legend.Position.LEFT: plarea.x0 += legend.spacing; break; - case Legend.Position.RIGHT: plarea.x1 -= legend.spacing; break; - } // Check for joint axes joint_x = joint_y = true; diff --git a/src/Legend.vala b/src/Legend.vala index 54a2bb2..2576605 100644 --- a/src/Legend.vala +++ b/src/Legend.vala @@ -261,10 +261,10 @@ namespace CairoChart { case ProcessType.CALC: height = leg_height_sum; switch (position) { - case Position.TOP: chart.evarea.y0 += height; break; - case Position.BOTTOM: chart.evarea.y1 -= height; break; - case Position.LEFT: chart.evarea.x0 += width; break; - case Position.RIGHT: chart.evarea.x1 -= width; break; + case Position.TOP: chart.evarea.y0 += height + spacing; break; + case Position.BOTTOM: chart.evarea.y1 -= height + spacing; break; + case Position.LEFT: chart.evarea.x0 += width + spacing; break; + case Position.RIGHT: chart.evarea.x1 -= width + spacing; break; } break; }