From 394758bd730edef61d2c5062294427e08ed9d402 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Tue, 20 Feb 2018 17:33:20 +0300 Subject: [PATCH] Fixes #146: Draw grid optimizations made. --- src/Axis.vala | 7 ++++--- src/Chart.vala | 2 +- src/Series.vala | 7 +++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Axis.vala b/src/Axis.vala index b69742d..c56715a 100644 --- a/src/Axis.vala +++ b/src/Axis.vala @@ -156,7 +156,7 @@ namespace CairoChart { /** * ``Axis`` line style. */ - public LineStyle grid_style = LineStyle (Color(), 1, {2, 3}); + public LineStyle grid_style = LineStyle(Color(0, 0, 0, 0.25)); // Color(), 1, {2, 3}); /** * Number of equally placed points to evaluate records sizes. @@ -516,8 +516,9 @@ namespace CairoChart { for (Float128 v = min; Math.point_belong (v, min, range.zmax); v += step) { if (is_x && chart.joint_x || !is_x && chart.joint_y) { chart.color = chart.joint_color; - ser.axis_x.grid_style.color = Color(0, 0, 0, 0.5); - ser.axis_y.grid_style.color = Color(0, 0, 0, 0.5); + grid_style.color.red = chart.joint_color.red; + grid_style.color.green = chart.joint_color.green; + grid_style.color.blue = chart.joint_color.blue; } else chart.color = color; string text = "", time_text = ""; var time_text_t = new Text(chart); var crpt = 0.0; diff --git a/src/Chart.vala b/src/Chart.vala index 95f22a7..266b3e6 100644 --- a/src/Chart.vala +++ b/src/Chart.vala @@ -400,8 +400,8 @@ namespace CairoChart { } protected virtual void draw_plarea_border () { + LineStyle().apply(this); color = border_color; - ctx.set_dash(null, 0); ctx.rectangle(plarea.x0, plarea.y0, plarea.width, plarea.height); ctx.stroke (); } diff --git a/src/Series.vala b/src/Series.vala index 9185719..624811f 100644 --- a/src/Series.vala +++ b/src/Series.vala @@ -73,10 +73,9 @@ namespace CairoChart { line_style.color = value; axis_x.color = value; axis_y.color = value; - axis_x.grid_style.color = value; - axis_x.grid_style.color.alpha = 0.5; - axis_y.grid_style.color = value; - axis_y.grid_style.color.alpha = 0.5; + axis_x.grid_style.color.red = axis_y.grid_style.color.red = value.red; + axis_x.grid_style.color.green = axis_y.grid_style.color.green = value.green; + axis_x.grid_style.color.blue = axis_y.grid_style.color.blue = value.blue; } default = Color (0, 0, 0, 1); }