diff --git a/src/Axis.vala b/src/Axis.vala index f9a2fed..9dab919 100644 --- a/src/Axis.vala +++ b/src/Axis.vala @@ -518,9 +518,9 @@ 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; - switch (position) { - case Axis.Position.LOW: - if (is_x) { + if (is_x) + switch (position) { + case Axis.Position.LOW: chart.ctx.move_to (compact_rec_pos (v, text_t), ey1); text_t.show(); if (dtype == Axis.DType.DATE_TIME) { chart.ctx.move_to (crpt, ey1 - dtf); time_text_t.show(); } @@ -528,30 +528,32 @@ namespace CairoChart { double y = ey1 - max_rec_size; chart.ctx.move_to (scr_v, y); if (chart.joint_x) chart.ctx.line_to (scr_v, py0); else chart.ctx.line_to (scr_v, double.min (y, py0 + ph * (1 - ser.axis_y.place.zmax))); - } else { - 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); - 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: - if (is_x) { + break; + case Axis.Position.HIGH: chart.ctx.move_to (compact_rec_pos (v, text_t), 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); if (chart.joint_x) chart.ctx.line_to (scr_v, chart.plarea.y1); else chart.ctx.line_to (scr_v, double.max (ey0, py0 + ph * (1 - ser.axis_y.place.zmin))); - } else { + break; + } + else + 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); + 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)); 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; } - break; - } } } }