OK In progress...

This commit is contained in:
Kolan Sh 2018-01-22 13:10:27 +03:00
parent e01bc80210
commit a6839c3211
3 changed files with 11 additions and 12 deletions

View File

@ -153,7 +153,7 @@ namespace CairoChart {
s.line_style.apply(chart);
chart.ctx.rel_line_to (line_length, 0);
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;
}

View File

@ -53,24 +53,23 @@ namespace CairoChart {
/**
* Draws the ``Marker`` at specific position.
* @param x x-coordinate.
* @param y y-coordinate.
* @param p coordinates.
*/
public virtual void draw_at_pos (double x, double y) {
chart.ctx.move_to (x, y);
public virtual void draw_at_pos (Point p) {
chart.ctx.move_to (p.x, p.y);
switch (type) {
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();
break;
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();
break;
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 / 2, size);
chart.ctx.rel_line_to (-size / 2, -size);
@ -78,17 +77,17 @@ namespace CairoChart {
break;
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();
break;
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();
break;
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 / 2, size);
chart.ctx.rel_line_to (-size / 2, -size);

View File

@ -88,7 +88,7 @@ namespace CairoChart {
var y = get_scr_y(points[i].y);
if (Math.point_in_rect (Point(x, y), chart.plarea.x0, chart.plarea.x1,
chart.plarea.y0, chart.plarea.y1))
marker.draw_at_pos(x, y);
marker.draw_at_pos(Point(x, y));
}
}