From a3bbf50b6fe268508505637d9d7e744b3f734db0 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 15 Jan 2018 16:40:14 +0300 Subject: [PATCH] Separate join_calc_{x,y}() added. --- src/Chart.vala | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/Chart.vala b/src/Chart.vala index 4479cdf..3b3482f 100644 --- a/src/Chart.vala +++ b/src/Chart.vala @@ -232,24 +232,7 @@ namespace CairoChart { } } - protected virtual void calc_plot_area () { - plot_x_min = cur_x_min + legend.indent; - plot_x_max = cur_x_max - legend.indent; - plot_y_min = cur_y_min + legend.indent; - plot_y_max = cur_y_max - legend.indent; - - // Check for joint axes - joint_x = joint_y = true; - int nzoom_series_show = 0; - for (var si = series.length - 1; si >=0; --si) { - var s = series[si], s0 = series[0]; - if (!s.zoom_show) continue; - ++nzoom_series_show; - if (!s.equal_x_axis(s0)) joint_x = false; - if (!s.equal_y_axis(s0)) joint_y = false; - } - if (nzoom_series_show == 1) joint_x = joint_y = false; - + protected virtual void join_calc_x () { // Join and calc X-axes for (var si = series.length - 1, nskip = 0; si >= 0; --si) { var s = series[si]; @@ -276,7 +259,9 @@ namespace CairoChart { case Axis.Position.HIGH: plot_y_min += max_rec_height + max_font_indent + max_axis_font_height; break; } } + } + protected virtual void join_calc_y () { // Join and calc Y-axes for (var si = series.length - 1, nskip = 0; si >= 0; --si) { var s = series[si]; @@ -305,6 +290,28 @@ namespace CairoChart { } } + protected virtual void calc_plot_area () { + plot_x_min = cur_x_min + legend.indent; + plot_x_max = cur_x_max - legend.indent; + plot_y_min = cur_y_min + legend.indent; + plot_y_max = cur_y_max - legend.indent; + + // Check for joint axes + joint_x = joint_y = true; + int nzoom_series_show = 0; + for (var si = series.length - 1; si >=0; --si) { + var s = series[si], s0 = series[0]; + if (!s.zoom_show) continue; + ++nzoom_series_show; + if (!s.equal_x_axis(s0)) joint_x = false; + if (!s.equal_y_axis(s0)) joint_y = false; + } + if (nzoom_series_show == 1) joint_x = joint_y = false; + + join_calc_x (); + join_calc_y (); + } + protected virtual double compact_rec_x_pos (Series s, Float128 x, Text text) { var sz = text.get_size(context); return get_scr_x(s, x) - sz.width / 2.0