From e01bc802105b1ce6f0f503bdbde128f6768c49db Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 22 Jan 2018 12:56:17 +0300 Subject: [PATCH] OK In progress... --- src/Marker.vala | 18 +++++++++--------- test/ChartTest.vala | 26 +++++++++++++------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Marker.vala b/src/Marker.vala index eb87ce2..dd47177 100644 --- a/src/Marker.vala +++ b/src/Marker.vala @@ -10,7 +10,7 @@ namespace CairoChart { /** * ``Marker`` shape. */ - public enum Type { + public enum Shape { NONE = 0, SQUARE, CIRCLE, @@ -23,7 +23,7 @@ namespace CairoChart { /** * ``Marker`` shape. */ - public Type type; + public Shape type; /** * ``Marker`` size. @@ -36,7 +36,7 @@ namespace CairoChart { * @param size ``Marker`` size. */ public Marker (Chart chart, - Type type = Type.NONE, + Shape type = Shape.NONE, double size = 8.0 ) { this.chart = chart; @@ -59,17 +59,17 @@ namespace CairoChart { public virtual void draw_at_pos (double x, double y) { chart.ctx.move_to (x, y); switch (type) { - case Type.SQUARE: + case Shape.SQUARE: chart.ctx.rectangle (x - size / 2, y - size / 2, size, size); chart.ctx.fill(); break; - case Type.CIRCLE: + case Shape.CIRCLE: chart.ctx.arc (x, y, size / 2, 0, 2 * GLib.Math.PI); chart.ctx.fill(); break; - case Type.TRIANGLE: + case Shape.TRIANGLE: chart.ctx.move_to (x - size / 2, y - size / 2); chart.ctx.rel_line_to (size, 0); chart.ctx.rel_line_to (-size / 2, size); @@ -77,17 +77,17 @@ namespace CairoChart { chart.ctx.fill(); break; - case Type.PRICLE_SQUARE: + case Shape.PRICLE_SQUARE: chart.ctx.rectangle (x - size / 2, y - size / 2, size, size); chart.ctx.stroke(); break; - case Type.PRICLE_CIRCLE: + case Shape.PRICLE_CIRCLE: chart.ctx.arc (x, y, size / 2, 0, 2 * GLib.Math.PI); chart.ctx.stroke(); break; - case Type.PRICLE_TRIANGLE: + case Shape.PRICLE_TRIANGLE: chart.ctx.move_to (x - size / 2, y - size / 2); chart.ctx.rel_line_to (size, 0); chart.ctx.rel_line_to (-size / 2, size); diff --git a/test/ChartTest.vala b/test/ChartTest.vala index 501b679..3347319 100644 --- a/test/ChartTest.vala +++ b/test/ChartTest.vala @@ -31,9 +31,9 @@ void plot_chart1 (Chart chart) { s3.place.x0 = 0; s3.place.x1 = 0.5; s3.place.y0 = 0.5; s3.place.y1 = 1.0; - s1.marker.type = Marker.Type.SQUARE; - s2.marker.type = Marker.Type.CIRCLE; - s3.marker.type = Marker.Type.PRICLE_TRIANGLE; + s1.marker.type = Marker.Shape.SQUARE; + s2.marker.type = Marker.Shape.CIRCLE; + s3.marker.type = Marker.Shape.PRICLE_TRIANGLE; s1.axis_x.title = new Text(chart, "Series 1: Axis X."); s1.axis_y.title = new Text(chart, "Series 1: Axis Y."); @@ -103,9 +103,9 @@ void plot_chart2 (Chart chart) { s3.place.x0 = 0.0; s3.place.x1 = 1.0; s3.place.y0 = 0.5; s3.place.y1 = 1.0; - s1.marker.type = Marker.Type.PRICLE_CIRCLE; - s2.marker.type = Marker.Type.PRICLE_SQUARE; - s3.marker.type = Marker.Type.SQUARE; + s1.marker.type = Marker.Shape.PRICLE_CIRCLE; + s2.marker.type = Marker.Shape.PRICLE_SQUARE; + s3.marker.type = Marker.Shape.SQUARE; s1.axis_x.title = new Text(chart, "All Series: Axis X."); s1.axis_y.title = new Text(chart, "Series 1: Axis Y."); @@ -153,9 +153,9 @@ void plot_chart3 (Chart chart) { s3.place.x0 = 0; s3.place.x1 = 0.5; s3.place.y0 = 0.0; s3.place.y1 = 1.0; - s1.marker.type = Marker.Type.SQUARE; - s2.marker.type = Marker.Type.PRICLE_CIRCLE; - s3.marker.type = Marker.Type.TRIANGLE; + s1.marker.type = Marker.Shape.SQUARE; + s2.marker.type = Marker.Shape.PRICLE_CIRCLE; + s3.marker.type = Marker.Shape.TRIANGLE; s1.axis_x.title = new Text(chart, "Series 1: Axis X."); s1.axis_y.title = new Text(chart, "All Series: Axis Y."); @@ -217,10 +217,10 @@ void plot_chart4 (Chart chart) { s4.place.x0 = 0.2; s4.place.x1 = 1.0; s4.place.y0 = 0.0; s4.place.y1 = 1.0; - s1.marker.type = Marker.Type.SQUARE; - s2.marker.type = Marker.Type.PRICLE_CIRCLE; - s3.marker.type = Marker.Type.TRIANGLE; - s4.marker.type = Marker.Type.PRICLE_SQUARE; + s1.marker.type = Marker.Shape.SQUARE; + s2.marker.type = Marker.Shape.PRICLE_CIRCLE; + s3.marker.type = Marker.Shape.TRIANGLE; + s4.marker.type = Marker.Shape.PRICLE_SQUARE; s1.axis_x.title = new Text(chart, "Series 1: Axis X."); s1.axis_y.title = new Text(chart, "All Series: Axis Y.");