OK In progress...

This commit is contained in:
Kolan Sh 2018-01-22 15:03:10 +03:00
parent e5c0f4d898
commit b46de48825
5 changed files with 34 additions and 31 deletions

View File

@ -342,10 +342,10 @@ namespace CairoChart {
ctx.stroke ();
}
protected virtual void draw_title () {
var title_height = title.height + title.vspacing * 2;
var title_height = title.height + title.font.vspacing * 2;
evarea.y0 += title_height;
color = title.color;
ctx.move_to (area.width/2 - title.width/2, title.height + title.vspacing);
ctx.move_to (area.width/2 - title.width/2, title.height + title.font.vspacing);
title.show();
}
protected virtual void draw_haxes () {

View File

@ -296,7 +296,7 @@ namespace CairoChart {
break;
case Axis.Position.HIGH:
var title_height = chart.title.height + (chart.legend.position == Legend.Position.TOP ?
chart.title.vspacing * 2 : chart.title.vspacing);
chart.title.font.vspacing * 2 : chart.title.font.vspacing);
print_y = chart.area.y0 + title_height + s.axis_x.font_spacing
+ (chart.legend.position == Legend.Position.TOP ? chart.legend.height : 0);
switch (s.axis_x.dtype) {

View File

@ -31,6 +31,29 @@ namespace CairoChart {
*/
public virtual Gtk.Orientation orient { get; set; }
/**
* Vertical spacing.
*/
public double vspacing = 4;
/**
* Horizontal spacing.
*/
public double hspacing = 4;
/**
* Both vertical & horizontal spacing (set only).
*/
public virtual double spacing {
protected get {
return 0;
}
set {
vspacing = hspacing = value;
}
default = 4;
}
/**
* Constructs a new ``Font``.
* @param family a font family name, encoded in UTF-8.
@ -43,7 +66,9 @@ namespace CairoChart {
double size = 10,
Cairo.FontSlant slant = Cairo.FontSlant.NORMAL,
Cairo.FontWeight weight = Cairo.FontWeight.NORMAL,
Gtk.Orientation orient = Gtk.Orientation.HORIZONTAL
Gtk.Orientation orient = Gtk.Orientation.HORIZONTAL,
double vspacing = 4,
double hspacing = 4
) {
this.family = family;
this.size = size;
@ -56,7 +81,10 @@ namespace CairoChart {
* Gets a copy of the ``Font``.
*/
public virtual Font copy () {
return new Font(family, size, slant, weight, orient);
var f = new Font(family, size, slant, weight, orient);
f.vspacing = vspacing;
f.hspacing = hspacing;
return f;
}
}
}

View File

@ -54,7 +54,7 @@ namespace CairoChart {
case Position.TOP:
x0 = (chart.area.width - width) / 2;
var title_height = chart.title.height + (chart.legend.position == Legend.Position.TOP ?
chart.title.vspacing * 2 : chart.title.vspacing);
chart.title.font.vspacing * 2 : chart.title.font.vspacing);
y0 = title_height;
break;

View File

@ -44,29 +44,6 @@ namespace CairoChart {
*/
public Color color = Color();
/**
* Vertical spacing.
*/
public double vspacing = 4;
/**
* Horizontal spacing.
*/
public double hspacing = 4;
/**
* Both vertical & horizontal spacing (set only).
*/
public virtual double spacing {
protected get {
return 0;
}
set {
vspacing = hspacing = value;
}
default = 4;
}
/**
* Cairo ``Text`` extents.
*/
@ -158,8 +135,6 @@ namespace CairoChart {
text.font = this.font;
text._ext = this._ext;
text.color = this.color;
text.hspacing = this.hspacing;
text.vspacing = this.vspacing;
return text;
}
}