OK In progress...
This commit is contained in:
parent
89132d91fc
commit
620a1c167c
|
@ -72,9 +72,9 @@ namespace CairoChart {
|
|||
}
|
||||
default = 2;
|
||||
}
|
||||
public Font.Style font_style = Font.Style ();
|
||||
public Font font_style = Font ();
|
||||
public Color color = Color ();
|
||||
public Line.Style line_style = Line.Style ();
|
||||
public LineStyle line_style = LineStyle ();
|
||||
public double font_spacing = 5;
|
||||
|
||||
public virtual Axis copy () {
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace CairoChart {
|
|||
/**
|
||||
* Selection line style.
|
||||
*/
|
||||
public Line.Style selection_style = Line.Style ();
|
||||
public LineStyle selection_style = LineStyle ();
|
||||
|
||||
/**
|
||||
* ``Chart`` cursors.
|
||||
|
@ -303,7 +303,7 @@ namespace CairoChart {
|
|||
}
|
||||
protected virtual void rot_axes_titles () {
|
||||
foreach (var s in series)
|
||||
s.axis_y.title.style.orientation = Font.Orientation.VERTICAL;
|
||||
s.axis_y.title.style.direct = FontDirect.VERTICAL;
|
||||
}
|
||||
|
||||
protected virtual void eval_plarea () {
|
||||
|
|
|
@ -32,12 +32,12 @@ namespace CairoChart {
|
|||
|
||||
public Orientation orientation;
|
||||
public double select_distance;
|
||||
public Line.Style line_style;
|
||||
public LineStyle line_style;
|
||||
|
||||
public Style () {
|
||||
orientation = Orientation.VERTICAL;
|
||||
select_distance = 32;
|
||||
line_style = Line.Style(Color(0.2, 0.2, 0.2, 0.8));
|
||||
line_style = LineStyle(Color(0.2, 0.2, 0.2, 0.8));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,30 +1,25 @@
|
|||
namespace CairoChart {
|
||||
|
||||
/**
|
||||
* Text font.
|
||||
* ``Font`` direction.
|
||||
*/
|
||||
public class Font {
|
||||
public enum FontDirect {
|
||||
|
||||
/**
|
||||
* ``Font`` orientation.
|
||||
*/
|
||||
public enum Orientation {
|
||||
|
||||
/**
|
||||
* Horizontal font/text orientation.
|
||||
* Horizontal font/text direction.
|
||||
*/
|
||||
HORIZONTAL = 0,
|
||||
|
||||
/**
|
||||
* Vertical font/text orientation.
|
||||
* Vertical font/text direction.
|
||||
*/
|
||||
VERTICAL
|
||||
}
|
||||
|
||||
/**
|
||||
* ``Font`` Style.
|
||||
* ``Font`` style.
|
||||
*/
|
||||
public struct Style {
|
||||
public struct Font {
|
||||
|
||||
/**
|
||||
* A font family name, encoded in UTF-8.
|
||||
|
@ -47,32 +42,29 @@ namespace CairoChart {
|
|||
Cairo.FontWeight weight;
|
||||
|
||||
/**
|
||||
* Font/Text orientation.
|
||||
* Font/Text direction.
|
||||
*/
|
||||
Orientation orientation;
|
||||
FontDirect direct;
|
||||
|
||||
/**
|
||||
* Constructs a new ``Style``.
|
||||
* Constructs a new ``Font``.
|
||||
* @param family a font family name, encoded in UTF-8.
|
||||
* @param size the new font size, in user space units.
|
||||
* @param slant the slant for the font.
|
||||
* @param weight the weight for the font.
|
||||
* @param orientation font/text orientation.
|
||||
* @param direct font/text direction.
|
||||
*/
|
||||
public Style (string family = "Sans",
|
||||
public Font (string family = "Sans",
|
||||
double size = 10,
|
||||
Cairo.FontSlant slant = Cairo.FontSlant.NORMAL,
|
||||
Cairo.FontWeight weight = Cairo.FontWeight.NORMAL,
|
||||
Font.Orientation orientation = Font.Orientation.HORIZONTAL
|
||||
FontDirect direct = FontDirect.HORIZONTAL
|
||||
) {
|
||||
this.family = family;
|
||||
this.size = size;
|
||||
this.slant = slant;
|
||||
this.weight = weight;
|
||||
this.orientation = orientation;
|
||||
this.direct = direct;
|
||||
}
|
||||
}
|
||||
|
||||
private Font () { }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace CairoChart {
|
|||
/**
|
||||
* Line style of the ``Grid``.
|
||||
*/
|
||||
public Line.Style line_style = Line.Style ();
|
||||
public LineStyle line_style = LineStyle ();
|
||||
|
||||
/**
|
||||
* Gets a copy of the ``Grid``.
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
namespace CairoChart {
|
||||
|
||||
/**
|
||||
* Value of the point.
|
||||
* ``LabelStyle`` Style.
|
||||
*/
|
||||
public class Label {
|
||||
|
||||
/**
|
||||
* ``Label`` Style.
|
||||
*/
|
||||
public struct Style {
|
||||
public struct LabelStyle {
|
||||
|
||||
/**
|
||||
* Font style.
|
||||
*/
|
||||
Font.Style font_style;
|
||||
Font font_style;
|
||||
|
||||
/**
|
||||
* Frame line style.
|
||||
*/
|
||||
Line.Style frame_line_style;
|
||||
LineStyle frame_line_style;
|
||||
|
||||
/**
|
||||
* Background color.
|
||||
|
@ -30,7 +25,4 @@ namespace CairoChart {
|
|||
*/
|
||||
Color frame_color;
|
||||
}
|
||||
|
||||
private Label () { }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ namespace CairoChart {
|
|||
}
|
||||
|
||||
public Position position = Position.TOP;
|
||||
public Font.Style font_style = Font.Style();
|
||||
public Font font_style = Font();
|
||||
public Color bg_color = Color(1, 1, 1);
|
||||
public Line.Style border_style = Line.Style ();
|
||||
public LineStyle border_style = LineStyle ();
|
||||
public double spacing = 5;
|
||||
public double width = 0;
|
||||
public double height = 0;
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
namespace CairoChart {
|
||||
|
||||
/**
|
||||
* ``Chart`` line.
|
||||
*/
|
||||
public class Line {
|
||||
|
||||
/**
|
||||
* Line Style.
|
||||
*/
|
||||
public struct Style {
|
||||
public struct LineStyle {
|
||||
|
||||
/**
|
||||
* Line color.
|
||||
|
@ -40,7 +35,7 @@ namespace CairoChart {
|
|||
Cairo.LineCap cap;
|
||||
|
||||
/**
|
||||
* Constructs a new ``Style``.
|
||||
* Constructs a new ``LineStyle``.
|
||||
* @param color line color.
|
||||
* @param width a line width.
|
||||
* @param dashes an array specifying alternate lengths of on and off stroke portions.
|
||||
|
@ -48,7 +43,7 @@ namespace CairoChart {
|
|||
* @param join a line join style.
|
||||
* @param cap a line cap style.
|
||||
*/
|
||||
public Style (Color color = Color(),
|
||||
public LineStyle (Color color = Color(),
|
||||
double width = 1,
|
||||
double[]? dashes = null,
|
||||
double dash_offset = 0,
|
||||
|
@ -74,7 +69,4 @@ namespace CairoChart {
|
|||
chart.ctx.set_line_cap(cap);
|
||||
}
|
||||
}
|
||||
|
||||
private Line () { }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace CairoChart {
|
|||
|
||||
public Grid grid = new Grid ();
|
||||
|
||||
public Line.Style line_style = Line.Style ();
|
||||
public LineStyle line_style = LineStyle ();
|
||||
|
||||
protected Color _color = Color (0.0, 0.0, 0.0, 1.0);
|
||||
public Color color {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace CairoChart {
|
||||
public class Text {
|
||||
public string text = "";
|
||||
public Font.Style style = Font.Style ();
|
||||
public Font style = Font ();
|
||||
public Color color = Color();
|
||||
public double vspacing = 4;
|
||||
public double hspacing = 4;
|
||||
|
@ -25,18 +25,18 @@ namespace CairoChart {
|
|||
|
||||
public virtual double get_width (Cairo.Context ctx) {
|
||||
var extents = get_extents (ctx);
|
||||
switch (style.orientation) {
|
||||
case Font.Orientation.HORIZONTAL: return extents.width;
|
||||
case Font.Orientation.VERTICAL: return extents.height;
|
||||
switch (style.direct) {
|
||||
case FontDirect.HORIZONTAL: return extents.width;
|
||||
case FontDirect.VERTICAL: return extents.height;
|
||||
default: return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual double get_height (Cairo.Context ctx) {
|
||||
var extents = get_extents (ctx);
|
||||
switch (style.orientation) {
|
||||
case Font.Orientation.HORIZONTAL: return extents.height;
|
||||
case Font.Orientation.VERTICAL: return extents.width;
|
||||
switch (style.direct) {
|
||||
case FontDirect.HORIZONTAL: return extents.height;
|
||||
case FontDirect.VERTICAL: return extents.width;
|
||||
default: return 0.0;
|
||||
}
|
||||
}
|
||||
|
@ -49,12 +49,12 @@ namespace CairoChart {
|
|||
public virtual Size get_size (Cairo.Context ctx) {
|
||||
var sz = Size();
|
||||
var extents = get_extents (ctx);
|
||||
switch (style.orientation) {
|
||||
case Font.Orientation.HORIZONTAL:
|
||||
switch (style.direct) {
|
||||
case FontDirect.HORIZONTAL:
|
||||
sz.width = extents.width + extents.x_bearing;
|
||||
sz.height = extents.height;
|
||||
break;
|
||||
case Font.Orientation.VERTICAL:
|
||||
case FontDirect.VERTICAL:
|
||||
sz.width = extents.height; // + extents.x_bearing ?
|
||||
sz.height = extents.width; // +- extents.y_bearing ?
|
||||
break;
|
||||
|
@ -67,7 +67,7 @@ namespace CairoChart {
|
|||
style.slant,
|
||||
style.weight);
|
||||
ctx.set_font_size(style.size);
|
||||
if (style.orientation == Font.Orientation.VERTICAL) {
|
||||
if (style.direct == FontDirect.VERTICAL) {
|
||||
ctx.rotate(- GLib.Math.PI / 2.0);
|
||||
ctx.show_text(text);
|
||||
ctx.rotate(GLib.Math.PI / 2.0);
|
||||
|
@ -77,7 +77,7 @@ namespace CairoChart {
|
|||
}
|
||||
|
||||
public Text (string text = "",
|
||||
Font.Style style = Font.Style(),
|
||||
Font style = Font(),
|
||||
Color color = Color()
|
||||
) {
|
||||
this.text = text;
|
||||
|
|
|
@ -249,7 +249,7 @@ int main (string[] args) {
|
|||
plot_chart3 (chart3);
|
||||
plot_chart4 (chart4);
|
||||
|
||||
chart1.selection_style = Line.Style(Color(0.3, 0.3, 0.3, 0.7));
|
||||
chart1.selection_style = LineStyle(Color(0.3, 0.3, 0.3, 0.7));
|
||||
|
||||
var da = new DrawingArea();
|
||||
da.set_events ( Gdk.EventMask.BUTTON_PRESS_MASK
|
||||
|
|
Loading…
Reference in New Issue