diff --git a/src/Axis.vala b/src/Axis.vala index 9dab919..a1b9881 100644 --- a/src/Axis.vala +++ b/src/Axis.vala @@ -518,10 +518,11 @@ namespace CairoChart { var py0 = chart.plarea.y0, ey0 = chart.evarea.y0 + max_rec_size + tthv, ey1 = chart.evarea.y1 - tthv; var px0 = chart.plarea.x0, ex0 = chart.evarea.x0 + max_rec_size + ttwh, ex1 = chart.evarea.x1 - ttwh; var ph = chart.plarea.height, pw = chart.plarea.width; - if (is_x) + if (is_x) { + var crp = compact_rec_pos (v, text_t); switch (position) { case Axis.Position.LOW: - chart.ctx.move_to (compact_rec_pos (v, text_t), ey1); text_t.show(); + chart.ctx.move_to (crp, ey1); text_t.show(); if (dtype == Axis.DType.DATE_TIME) { chart.ctx.move_to (crpt, ey1 - dtf); time_text_t.show(); } ser.grid.style.apply(chart); @@ -530,7 +531,7 @@ namespace CairoChart { else chart.ctx.line_to (scr_v, double.min (y, py0 + ph * (1 - ser.axis_y.place.zmax))); break; case Axis.Position.HIGH: - chart.ctx.move_to (compact_rec_pos (v, text_t), ey0); text_t.show(); + chart.ctx.move_to (crp, ey0); text_t.show(); if (dtype == Axis.DType.DATE_TIME) { chart.ctx.move_to (crpt, ey0 - dtf); time_text_t.show(); } ser.grid.style.apply(chart); chart.ctx.move_to (scr_v, ey0); @@ -538,22 +539,25 @@ namespace CairoChart { else chart.ctx.line_to (scr_v, double.max (ey0, py0 + ph * (1 - ser.axis_y.place.zmin))); break; } - else + } else { + var crp = compact_rec_pos (v, text_t); switch (position) { case Axis.Position.LOW: - chart.ctx.move_to (ex0 - text_t.width, compact_rec_pos (v, text_t)); - text_t.show(); ser.grid.style.apply(chart); chart.ctx.move_to (ex0, scr_v); + chart.ctx.move_to (ex0 - text_t.width, crp); + text_t.show(); ser.grid.style.apply(chart); + chart.ctx.move_to (ex0, scr_v); if (chart.joint_y) chart.ctx.line_to (chart.plarea.x1, scr_v); else chart.ctx.line_to (double.max (ex0, px0 + pw * ser.axis_x.place.zmax), scr_v); break; case Axis.Position.HIGH: - chart.ctx.move_to (ex1 - text_t.width, compact_rec_pos (v, text_t)); + chart.ctx.move_to (ex1 - text_t.width, crp); text_t.show(); ser.grid.style.apply(chart); double x = ex1 - max_rec_size; chart.ctx.move_to (x, scr_v); if (chart.joint_y) chart.ctx.line_to (px0, scr_v); else chart.ctx.line_to (double.min (x, px0 + pw * ser.axis_x.place.zmin), scr_v); break; } + } } } }