OK In progress...
This commit is contained in:
parent
e01bc80210
commit
a6839c3211
|
@ -153,7 +153,7 @@ namespace CairoChart {
|
||||||
s.line_style.apply(chart);
|
s.line_style.apply(chart);
|
||||||
chart.ctx.rel_line_to (line_length, 0);
|
chart.ctx.rel_line_to (line_length, 0);
|
||||||
chart.ctx.stroke();
|
chart.ctx.stroke();
|
||||||
s.marker.draw_at_pos (x + line_length / 2, y - s.title.height / 2);
|
s.marker.draw_at_pos (Point(x + line_length / 2, y - s.title.height / 2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,24 +53,23 @@ namespace CairoChart {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the ``Marker`` at specific position.
|
* Draws the ``Marker`` at specific position.
|
||||||
* @param x x-coordinate.
|
* @param p coordinates.
|
||||||
* @param y y-coordinate.
|
|
||||||
*/
|
*/
|
||||||
public virtual void draw_at_pos (double x, double y) {
|
public virtual void draw_at_pos (Point p) {
|
||||||
chart.ctx.move_to (x, y);
|
chart.ctx.move_to (p.x, p.y);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Shape.SQUARE:
|
case Shape.SQUARE:
|
||||||
chart.ctx.rectangle (x - size / 2, y - size / 2, size, size);
|
chart.ctx.rectangle (p.x - size / 2, p.y - size / 2, size, size);
|
||||||
chart.ctx.fill();
|
chart.ctx.fill();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Shape.CIRCLE:
|
case Shape.CIRCLE:
|
||||||
chart.ctx.arc (x, y, size / 2, 0, 2 * GLib.Math.PI);
|
chart.ctx.arc (p.x, p.y, size / 2, 0, 2 * GLib.Math.PI);
|
||||||
chart.ctx.fill();
|
chart.ctx.fill();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Shape.TRIANGLE:
|
case Shape.TRIANGLE:
|
||||||
chart.ctx.move_to (x - size / 2, y - size / 2);
|
chart.ctx.move_to (p.x - size / 2, p.y - size / 2);
|
||||||
chart.ctx.rel_line_to (size, 0);
|
chart.ctx.rel_line_to (size, 0);
|
||||||
chart.ctx.rel_line_to (-size / 2, size);
|
chart.ctx.rel_line_to (-size / 2, size);
|
||||||
chart.ctx.rel_line_to (-size / 2, -size);
|
chart.ctx.rel_line_to (-size / 2, -size);
|
||||||
|
@ -78,17 +77,17 @@ namespace CairoChart {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Shape.PRICLE_SQUARE:
|
case Shape.PRICLE_SQUARE:
|
||||||
chart.ctx.rectangle (x - size / 2, y - size / 2, size, size);
|
chart.ctx.rectangle (p.x - size / 2, p.y - size / 2, size, size);
|
||||||
chart.ctx.stroke();
|
chart.ctx.stroke();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Shape.PRICLE_CIRCLE:
|
case Shape.PRICLE_CIRCLE:
|
||||||
chart.ctx.arc (x, y, size / 2, 0, 2 * GLib.Math.PI);
|
chart.ctx.arc (p.x, p.y, size / 2, 0, 2 * GLib.Math.PI);
|
||||||
chart.ctx.stroke();
|
chart.ctx.stroke();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Shape.PRICLE_TRIANGLE:
|
case Shape.PRICLE_TRIANGLE:
|
||||||
chart.ctx.move_to (x - size / 2, y - size / 2);
|
chart.ctx.move_to (p.x - size / 2, p.y - size / 2);
|
||||||
chart.ctx.rel_line_to (size, 0);
|
chart.ctx.rel_line_to (size, 0);
|
||||||
chart.ctx.rel_line_to (-size / 2, size);
|
chart.ctx.rel_line_to (-size / 2, size);
|
||||||
chart.ctx.rel_line_to (-size / 2, -size);
|
chart.ctx.rel_line_to (-size / 2, -size);
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace CairoChart {
|
||||||
var y = get_scr_y(points[i].y);
|
var y = get_scr_y(points[i].y);
|
||||||
if (Math.point_in_rect (Point(x, y), chart.plarea.x0, chart.plarea.x1,
|
if (Math.point_in_rect (Point(x, y), chart.plarea.x0, chart.plarea.x1,
|
||||||
chart.plarea.y0, chart.plarea.y1))
|
chart.plarea.y0, chart.plarea.y1))
|
||||||
marker.draw_at_pos(x, y);
|
marker.draw_at_pos(Point(x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue