Fixes #155: LabelStyle never used, why?
This commit is contained in:
parent
639d7e07e0
commit
a495f6b217
|
@ -60,6 +60,11 @@ namespace CairoChart {
|
|||
*/
|
||||
public Style style = Style();
|
||||
|
||||
/**
|
||||
* Value label style.
|
||||
*/
|
||||
public LabelStyle label_style = new LabelStyle();
|
||||
|
||||
/**
|
||||
* Has crossings.
|
||||
*/
|
||||
|
@ -82,6 +87,7 @@ namespace CairoChart {
|
|||
c.active_cursor = active_cursor;
|
||||
c.is_cursor_active = is_cursor_active;
|
||||
c.style = style;
|
||||
c.label_style = label_style.copy();
|
||||
c.crossings = crossings;
|
||||
return c;
|
||||
}
|
||||
|
@ -340,9 +346,18 @@ namespace CairoChart {
|
|||
var show_time = ccs[ci].show_time;
|
||||
var show_y = ccs[ci].show_y;
|
||||
|
||||
chart.color = chart.bg_color;
|
||||
// value label background
|
||||
chart.color = label_style.bg_color;
|
||||
chart.ctx.rectangle (svp.x - size.x / 2, svp.y - size.y / 2, size.x, size.y);
|
||||
chart.ctx.fill();
|
||||
// value label frame
|
||||
label_style.frame_style.apply(chart);
|
||||
chart.ctx.move_to (svp.x - size.x / 2, svp.y - size.y / 2);
|
||||
chart.ctx.rel_line_to (size.x, 0);
|
||||
chart.ctx.rel_line_to (0, size.y);
|
||||
chart.ctx.rel_line_to (-size.x, 0);
|
||||
chart.ctx.rel_line_to (0, -size.y);
|
||||
chart.ctx.stroke();
|
||||
|
||||
if (show_x) {
|
||||
chart.color = s.axis_x.color;
|
||||
|
|
|
@ -3,26 +3,44 @@ namespace CairoChart {
|
|||
/**
|
||||
* ``LabelStyle`` Style.
|
||||
*/
|
||||
public struct LabelStyle {
|
||||
|
||||
/**
|
||||
* Font style.
|
||||
*/
|
||||
Font font;
|
||||
|
||||
/**
|
||||
* Frame line style.
|
||||
*/
|
||||
LineStyle frame_line_style;
|
||||
public class LabelStyle {
|
||||
|
||||
/**
|
||||
* Background color.
|
||||
*/
|
||||
Color bg_color;
|
||||
public Color bg_color;
|
||||
|
||||
/**
|
||||
* Frame/border color.
|
||||
* Frame line style.
|
||||
*/
|
||||
Color frame_color;
|
||||
public LineStyle frame_style;
|
||||
|
||||
/**
|
||||
* Font style.
|
||||
*/
|
||||
public Font font;
|
||||
|
||||
/**
|
||||
* Constructs a new ``LabelStyle``.
|
||||
* @param font font style.
|
||||
* @param bg_color background color.
|
||||
* @param frame_style frame line style.
|
||||
*/
|
||||
public LabelStyle (
|
||||
Color bg_color = Color(1, 1, 1, 1),
|
||||
LineStyle frame_style = LineStyle(Color(0, 0, 0, 0.1)),
|
||||
Font font = new Font()
|
||||
) {
|
||||
this.bg_color = bg_color;
|
||||
this.frame_style = frame_style;
|
||||
this.font = font;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a copy of the ``LabelStyle``.
|
||||
*/
|
||||
public virtual LabelStyle copy () {
|
||||
return new LabelStyle(bg_color, frame_style, font);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue