Axis added.

This commit is contained in:
Kolan Sh 2017-02-07 19:43:43 +03:00
parent fad1bd69d1
commit 4e1c4111b2
1 changed files with 23 additions and 4 deletions

View File

@ -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;
});