diff --git a/src/Axis.vala b/src/Axis.vala index 6341aa1..938fb02 100644 --- a/src/Axis.vala +++ b/src/Axis.vala @@ -5,11 +5,11 @@ namespace CairoChart { */ public class Axis { - Chart chart; - string _format = "%.2Lf"; - string _date_format = "%Y.%m.%d"; - string _time_format = "%H:%M:%S"; - int _dsec_signs = 2; // 2 signs = centiseconds + protected Chart chart; + protected string _format = "%.2Lf"; + protected string _date_format = "%Y.%m.%d"; + protected string _time_format = "%H:%M:%S"; + protected int _dsec_signs = 2; // 2 signs = centiseconds /** * ``Axis`` title. diff --git a/src/Chart.vala b/src/Chart.vala index fce64b4..6c6fe24 100644 --- a/src/Chart.vala +++ b/src/Chart.vala @@ -309,7 +309,6 @@ namespace CairoChart { protected virtual void eval_plarea () { plarea = evarea.copy(); - legend.show = false; if (legend.show) switch(legend.position) { case Legend.Position.TOP: plarea.y0 += legend.spacing; break; diff --git a/src/Cursor.vala b/src/Cursor.vala index eac3278..7ffbcb4 100644 --- a/src/Cursor.vala +++ b/src/Cursor.vala @@ -1,18 +1,35 @@ namespace CairoChart { + /** + * {@link Chart} cursors. + */ public class Cursors { + protected Chart chart; protected List list = new List (); protected Point active_cursor = Point(); // { get; protected set; default = Point128 (); } protected bool is_cursor_active = false; // { get; protected set; default = false; } - public Cursors.Style cursor_style = Cursors.Style(); - public Cursors.CursorCrossings[] crossings = {}; - Chart chart; + /** + * + */ + public Cursors.Style cursor_style = Cursors.Style(); + + /** + * + */ + public Cursors.CursorCrossings[] crossings = {}; + + /** + * + */ public Cursors (Chart chart) { this.chart = chart; } + /** + * + */ public Cursors copy () { var c = new Cursors (chart); c.list = list.copy(); @@ -23,17 +40,36 @@ namespace CairoChart { return c; } + /** + * + */ protected enum Orientation { - VERTICAL = 0, // default + VERTICAL = 0, HORIZONTAL } + /** + * + */ protected struct Style { - + /** + * + */ public Orientation orientation; + + /** + * + */ public double select_distance; + + /** + * + */ public LineStyle line_style; + /** + * + */ public Style () { orientation = Orientation.VERTICAL; select_distance = 32; diff --git a/src/Legend.vala b/src/Legend.vala index 018f654..d30fb32 100644 --- a/src/Legend.vala +++ b/src/Legend.vala @@ -5,8 +5,8 @@ namespace CairoChart { */ public class Legend { - Chart chart; - double [] max_font_heights; + protected Chart chart; + protected double [] max_font_heights; /** * ``Legend`` position. @@ -158,12 +158,14 @@ namespace CairoChart { var leg_height_sum = 0.0; var max_font_h = 0.0; + double [] mfh = max_font_heights; + // prepare switch (process_type) { case ProcessType.CALC: width = 0; height = 0; - max_font_heights = {}; + mfh = {}; heights_idx = 0; break; case ProcessType.DRAW: @@ -172,7 +174,6 @@ namespace CairoChart { } foreach (var s in chart.series) { - if (!s.zoom_show) continue; // carry @@ -184,7 +185,7 @@ namespace CairoChart { leg_height_sum += max_font_h; switch (process_type) { case ProcessType.CALC: - max_font_heights += max_font_h; + mfh += max_font_h; width = double.max(width, leg_width_sum); break; case ProcessType.DRAW: @@ -200,7 +201,7 @@ namespace CairoChart { switch (process_type) { case ProcessType.DRAW: var x = legend_x0 + leg_width_sum + (leg_width_sum == 0 ? 0 : s.title.font.hspacing); - var y = legend_y0 + leg_height_sum + max_font_heights[heights_idx] / 2 + s.title.height / 2; + var y = legend_y0 + leg_height_sum + mfh[heights_idx] / 2 + s.title.height / 2; // series title chart.ctx.move_to (x + line_length, y); @@ -228,7 +229,7 @@ namespace CairoChart { case Position.RIGHT: switch (process_type) { case ProcessType.CALC: - max_font_heights += s.title.height + (leg_height_sum != 0 ? s.title.font.vspacing : 0); + mfh += s.title.height + (leg_height_sum != 0 ? s.title.font.vspacing : 0); width = double.max (width, s.title.width + line_length); break; case ProcessType.DRAW: @@ -248,7 +249,7 @@ namespace CairoChart { leg_height_sum += max_font_h; switch (process_type) { case ProcessType.CALC: - max_font_heights += max_font_h; + mfh += max_font_h; width = double.max(width, leg_width_sum); break; } @@ -267,6 +268,8 @@ namespace CairoChart { } break; } + + max_font_heights = mfh; } } } diff --git a/src/Marker.vala b/src/Marker.vala index d4c2382..4368d72 100644 --- a/src/Marker.vala +++ b/src/Marker.vala @@ -5,7 +5,7 @@ namespace CairoChart { */ public class Marker { - Chart chart; + protected Chart chart; /** * ``Marker`` shape. diff --git a/src/Place.vala b/src/Place.vala index 809a011..ae1781c 100644 --- a/src/Place.vala +++ b/src/Place.vala @@ -5,10 +5,10 @@ namespace CairoChart { */ public class Place { - double _x0 = 0; - double _x1 = 1; - double _y0 = 0; - double _y1 = 1; + protected double _x0 = 0; + protected double _x1 = 1; + protected double _y0 = 0; + protected double _y1 = 1; /** * Zoomed Left bound. diff --git a/src/Range.vala b/src/Range.vala index 15cf989..6ed8bf9 100644 --- a/src/Range.vala +++ b/src/Range.vala @@ -5,8 +5,8 @@ namespace CairoChart { */ public class Range { - Float128 _min = 0; - Float128 _max = 1; + protected Float128 _min = 0; + protected Float128 _max = 1; /** * Zoomed min bound. diff --git a/src/Text.vala b/src/Text.vala index 45c8574..4d19fcd 100644 --- a/src/Text.vala +++ b/src/Text.vala @@ -5,10 +5,10 @@ namespace CairoChart { */ public class Text { - Chart chart; - string _text; - Font _font; - Cairo.TextExtents? _ext; + protected Chart chart; + protected string _text; + protected Font _font; + protected Cairo.TextExtents? _ext; /** * ``Text`` string.