From 4e6045d160a1ba6b0e5c10477fd8a51c13e655ed Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 22 Jan 2018 09:04:26 +0300 Subject: [PATCH] OK In progress... --- src/Grid.vala | 12 +++--------- src/Marker.vala | 4 ++-- src/Series.vala | 30 ++++++++++++++---------------- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/Grid.vala b/src/Grid.vala index aedaf32..5751836 100644 --- a/src/Grid.vala +++ b/src/Grid.vala @@ -10,23 +10,17 @@ namespace CairoChart { LINE }*/ - /** - * Color of the ``Grid``. - */ - public Color color = Color (0, 0, 0, 0.1); - /** * Line style of the ``Grid``. */ - public LineStyle line_style = LineStyle (); + public LineStyle style = LineStyle (); /** * Gets a copy of the ``Grid``. */ public virtual Grid copy () { var grid = new Grid (); - grid.color = this.color; - grid.line_style = this.line_style; + grid.style = this.style; return grid; } @@ -34,7 +28,7 @@ namespace CairoChart { * Constructs a new ``Grid``. */ public Grid () { - line_style.dashes = {2, 3}; + style.dashes = {2, 3}; } } } diff --git a/src/Marker.vala b/src/Marker.vala index c71b3f5..5e82863 100644 --- a/src/Marker.vala +++ b/src/Marker.vala @@ -5,7 +5,7 @@ namespace CairoChart { */ public class Marker { - Chart chart = null; + Chart chart; /** * ``Marker`` shape. @@ -28,7 +28,7 @@ namespace CairoChart { /** * ``Marker`` size. */ - public double size = 8.0; + public double size; /** * Constructs a new ``Marker``. diff --git a/src/Series.vala b/src/Series.vala index ef16332..150e7a1 100644 --- a/src/Series.vala +++ b/src/Series.vala @@ -31,10 +31,8 @@ namespace CairoChart { line_style.color = _color; axis_x.color = _color; axis_y.color = _color; - grid.color = _color; - grid.color.alpha = 0.5; - grid.line_style.color = _color; - grid.line_style.color.alpha = 0.5; + grid.style.color = _color; + grid.style.color.alpha = 0.5; } default = Color (0.0, 0.0, 0.0, 1.0); } @@ -282,9 +280,9 @@ namespace CairoChart { break; } // 6. Draw grid lines to the place.zy0. - var line_style = grid.line_style; - if (joint_x) line_style.color = Color(0, 0, 0, 0.5); - line_style.apply(chart); + var grid_style = grid.style; + if (joint_x) grid_style.color = Color(0, 0, 0, 0.5); + grid_style.apply(chart); double y = chart.evarea.y1 - max_rec_height - axis_x.font_spacing - (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font_spacing); ctx.move_to (scr_x, y); if (joint_x) @@ -310,9 +308,9 @@ namespace CairoChart { break; } // 6. Draw grid lines to the place.zy1. - var line_style = grid.line_style; - if (joint_x) line_style.color = Color(0, 0, 0, 0.5); - line_style.apply(chart); + var grid_style = grid.style; + if (joint_x) grid_style.color = Color(0, 0, 0, 0.5); + grid_style.apply(chart); double y = chart.evarea.y0 + max_rec_height + axis_x.font_spacing + (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font_spacing); ctx.move_to (scr_x, y); if (joint_x) @@ -411,9 +409,9 @@ namespace CairoChart { compact_rec_y_pos (y, text_t)); text_t.show(); // 6. Draw grid lines to the place.zx0. - var line_style = grid.line_style; - if (joint_y) line_style.color = Color(0, 0, 0, 0.5); - line_style.apply(chart); + var grid_style = grid.style; + if (joint_y) grid_style.color = Color(0, 0, 0, 0.5); + grid_style.apply(chart); double x = chart.evarea.x0 + max_rec_width + axis_y.font_spacing + (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font_spacing); ctx.move_to (x, scr_y); if (joint_y) @@ -427,9 +425,9 @@ namespace CairoChart { compact_rec_y_pos (y, text_t)); text_t.show(); // 6. Draw grid lines to the place.zx1. - var line_style = grid.line_style; - if (joint_y) line_style.color = Color(0, 0, 0, 0.5); - line_style.apply(chart); + var grid_style = grid.style; + if (joint_y) grid_style.color = Color(0, 0, 0, 0.5); + grid_style.apply(chart); double x = chart.evarea.x1 - max_rec_width - axis_y.font_spacing - (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font_spacing); ctx.move_to (x, scr_y); if (joint_y)