OK In progress...
This commit is contained in:
parent
e5c0f4d898
commit
b46de48825
|
@ -342,10 +342,10 @@ namespace CairoChart {
|
||||||
ctx.stroke ();
|
ctx.stroke ();
|
||||||
}
|
}
|
||||||
protected virtual void draw_title () {
|
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;
|
evarea.y0 += title_height;
|
||||||
color = title.color;
|
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();
|
title.show();
|
||||||
}
|
}
|
||||||
protected virtual void draw_haxes () {
|
protected virtual void draw_haxes () {
|
||||||
|
|
|
@ -296,7 +296,7 @@ namespace CairoChart {
|
||||||
break;
|
break;
|
||||||
case Axis.Position.HIGH:
|
case Axis.Position.HIGH:
|
||||||
var title_height = chart.title.height + (chart.legend.position == Legend.Position.TOP ?
|
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
|
print_y = chart.area.y0 + title_height + s.axis_x.font_spacing
|
||||||
+ (chart.legend.position == Legend.Position.TOP ? chart.legend.height : 0);
|
+ (chart.legend.position == Legend.Position.TOP ? chart.legend.height : 0);
|
||||||
switch (s.axis_x.dtype) {
|
switch (s.axis_x.dtype) {
|
||||||
|
|
|
@ -31,6 +31,29 @@ namespace CairoChart {
|
||||||
*/
|
*/
|
||||||
public virtual Gtk.Orientation orient { get; set; }
|
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``.
|
* Constructs a new ``Font``.
|
||||||
* @param family a font family name, encoded in UTF-8.
|
* @param family a font family name, encoded in UTF-8.
|
||||||
|
@ -43,7 +66,9 @@ namespace CairoChart {
|
||||||
double size = 10,
|
double size = 10,
|
||||||
Cairo.FontSlant slant = Cairo.FontSlant.NORMAL,
|
Cairo.FontSlant slant = Cairo.FontSlant.NORMAL,
|
||||||
Cairo.FontWeight weight = Cairo.FontWeight.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.family = family;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
@ -56,7 +81,10 @@ namespace CairoChart {
|
||||||
* Gets a copy of the ``Font``.
|
* Gets a copy of the ``Font``.
|
||||||
*/
|
*/
|
||||||
public virtual Font copy () {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace CairoChart {
|
||||||
case Position.TOP:
|
case Position.TOP:
|
||||||
x0 = (chart.area.width - width) / 2;
|
x0 = (chart.area.width - width) / 2;
|
||||||
var title_height = chart.title.height + (chart.legend.position == Legend.Position.TOP ?
|
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;
|
y0 = title_height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -44,29 +44,6 @@ namespace CairoChart {
|
||||||
*/
|
*/
|
||||||
public Color color = Color();
|
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.
|
* Cairo ``Text`` extents.
|
||||||
*/
|
*/
|
||||||
|
@ -158,8 +135,6 @@ namespace CairoChart {
|
||||||
text.font = this.font;
|
text.font = this.font;
|
||||||
text._ext = this._ext;
|
text._ext = this._ext;
|
||||||
text.color = this.color;
|
text.color = this.color;
|
||||||
text.hspacing = this.hspacing;
|
|
||||||
text.vspacing = this.vspacing;
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue