In progress...

This commit is contained in:
Kolan Sh 2018-01-21 15:41:04 +03:00
parent d9f79241dc
commit dc9b896232
3 changed files with 11 additions and 6 deletions

View File

@ -154,7 +154,7 @@ namespace CairoChart {
s.line_style.apply(chart);
chart.ctx.rel_line_to (line_length, 0);
chart.ctx.stroke();
s.marker.draw_at_pos (chart, x + line_length / 2, y - title_sz.height / 2);
s.marker.draw_at_pos (x + line_length / 2, y - title_sz.height / 2);
break;
}

View File

@ -5,6 +5,8 @@ namespace CairoChart {
*/
public class Marker {
Chart chart = null;
/**
* ``Marker`` shape.
*/
@ -33,9 +35,11 @@ namespace CairoChart {
* @param type ``Marker`` shape.
* @param size ``Marker`` size.
*/
public Marker (Type type = Type.NONE,
public Marker (Chart chart,
Type type = Type.NONE,
double size = 8.0
) {
this.chart = chart;
this.type = type;
this.size = size;
}
@ -44,7 +48,7 @@ namespace CairoChart {
* Gets a copy of the ``Marker``.
*/
public virtual Marker copy () {
return new Marker (type, size);
return new Marker (chart, type, size);
}
/**
@ -52,7 +56,7 @@ namespace CairoChart {
* @param x x-coordinate.
* @param y y-coordinate.
*/
public virtual void draw_at_pos (Chart chart, double x, double y) {
public virtual void draw_at_pos (double x, double y) {
chart.ctx.move_to (x, y);
switch (type) {
case Type.SQUARE:

View File

@ -17,7 +17,7 @@ namespace CairoChart {
public Place place = new Place();
public Text title = new Text ();
public Marker marker = new Marker ();
public Marker marker = null;
public Grid grid = new Grid ();
@ -45,6 +45,7 @@ namespace CairoChart {
public Series (Chart chart) {
this.chart = chart;
this.marker = new Marker(chart);
}
public virtual Series copy () {
@ -86,7 +87,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(chart, x, y);
marker.draw_at_pos(x, y);
}
}