From 4e1c4111b2aad15484dadc4db2b939332de2e1d1 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Tue, 7 Feb 2017 19:43:43 +0300 Subject: [PATCH] Axis added. --- vala/drawing_area/drawing_area.vala | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/vala/drawing_area/drawing_area.vala b/vala/drawing_area/drawing_area.vala index 475d41f..5d8ad7b 100644 --- a/vala/drawing_area/drawing_area.vala +++ b/vala/drawing_area/drawing_area.vala @@ -16,7 +16,7 @@ public class Application : Gtk.Window { Gdk.RGBA color = style_context.get_color (0); // Draw an arc: - double xc = width / 2.0; + /*double xc = width / 2.0; double yc = height / 2.0; double radius = int.min (width, height) / 2.0; double angle1 = 0; @@ -24,14 +24,33 @@ public class Application : Gtk.Window { context.arc (xc, yc, radius, angle1, angle2); Gdk.cairo_set_source_rgba (context, color); - context.fill (); + context.fill ();*/ + + // Chart + context.set_line_width (1); + context.move_to (30, 30); + context.line_to (30, height - 30); + context.line_to (width - 30, height - 30); + context.stroke (); + + context.move_to (25, 40); + context.line_to (30, 30); + context.line_to (35, 40); + context.stroke (); + + context.move_to (width - 40, height - 35); + context.line_to (width - 30, height - 30); + context.line_to (width - 40, height - 25); + context.stroke (); // Text: context.set_source_rgb (0.1, 0.1, 0.1); context.select_font_face ("Adventure", Cairo.FontSlant.NORMAL, Cairo.FontWeight.BOLD); context.set_font_size (20); - context.move_to (20, 30); - context.show_text ("Indiana Jones"); + context.move_to (10, 40); + context.show_text ("Y"); + context.move_to (width - 45, height - 7); + context.show_text ("X"); return true; });