OK In progress...

This commit is contained in:
Kolan Sh 2018-01-22 13:39:26 +03:00
parent 644c7b4409
commit 946974b3d0
3 changed files with 23 additions and 21 deletions

View File

@ -72,7 +72,8 @@ namespace CairoChart {
* @param x1 right bound. * @param x1 right bound.
* @param y1 bottom bound. * @param y1 bottom bound.
*/ */
public Area.with_abs (double x0, double y0, double x1, double y1) { public Area.with_abs (double x0, double y0,
double x1, double y1) {
this.x0 = x0; this.x0 = x0;
this.y0 = y0; this.y0 = y0;
this.x1 = x1; this.x1 = x1;
@ -98,7 +99,8 @@ namespace CairoChart {
* @param width ``Area`` width. * @param width ``Area`` width.
* @param height ``Area`` height. * @param height ``Area`` height.
*/ */
public Area.with_rel (double x0, double y0, double width, double height) { public Area.with_rel (double x0, double y0,
double width, double height) {
this.x0 = x0; this.x0 = x0;
this.y0 = y0; this.y0 = y0;
this.width = width; this.width = width;

View File

@ -23,7 +23,7 @@ namespace CairoChart {
/** /**
* ``Marker`` shape. * ``Marker`` shape.
*/ */
public Shape type; public Shape shape;
/** /**
* ``Marker`` size. * ``Marker`` size.
@ -33,15 +33,15 @@ namespace CairoChart {
/** /**
* Constructs a new ``Marker``. * Constructs a new ``Marker``.
* @param chart ``Chart`` instance. * @param chart ``Chart`` instance.
* @param type ``Marker`` shape. * @param shape ``Marker`` shape.
* @param size ``Marker`` size. * @param size ``Marker`` size.
*/ */
public Marker (Chart chart, public Marker (Chart chart,
Shape type = Shape.NONE, Shape shape = Shape.NONE,
double size = 8.0 double size = 8.0
) { ) {
this.chart = chart; this.chart = chart;
this.type = type; this.shape = shape;
this.size = size; this.size = size;
} }
@ -49,7 +49,7 @@ namespace CairoChart {
* Gets a copy of the ``Marker``. * Gets a copy of the ``Marker``.
*/ */
public virtual Marker copy () { public virtual Marker copy () {
return new Marker (chart, type, size); return new Marker (chart, shape, size);
} }
/** /**
@ -58,7 +58,7 @@ namespace CairoChart {
*/ */
public virtual void draw_at_pos (Point p) { public virtual void draw_at_pos (Point p) {
chart.ctx.move_to (p.x, p.y); chart.ctx.move_to (p.x, p.y);
switch (type) { switch (shape) {
case Shape.SQUARE: case Shape.SQUARE:
chart.ctx.rectangle (p.x - size / 2, p.y - size / 2, size, size); chart.ctx.rectangle (p.x - size / 2, p.y - size / 2, size, size);
chart.ctx.fill(); chart.ctx.fill();

View File

@ -31,9 +31,9 @@ void plot_chart1 (Chart chart) {
s3.place.x0 = 0; s3.place.x1 = 0.5; s3.place.x0 = 0; s3.place.x1 = 0.5;
s3.place.y0 = 0.5; s3.place.y1 = 1.0; s3.place.y0 = 0.5; s3.place.y1 = 1.0;
s1.marker.type = Marker.Shape.SQUARE; s1.marker.shape = Marker.Shape.SQUARE;
s2.marker.type = Marker.Shape.CIRCLE; s2.marker.shape = Marker.Shape.CIRCLE;
s3.marker.type = Marker.Shape.PRICLE_TRIANGLE; s3.marker.shape = Marker.Shape.PRICLE_TRIANGLE;
s1.axis_x.title = new Text(chart, "Series 1: Axis X."); s1.axis_x.title = new Text(chart, "Series 1: Axis X.");
s1.axis_y.title = new Text(chart, "Series 1: Axis Y."); s1.axis_y.title = new Text(chart, "Series 1: Axis Y.");
@ -103,9 +103,9 @@ void plot_chart2 (Chart chart) {
s3.place.x0 = 0.0; s3.place.x1 = 1.0; s3.place.x0 = 0.0; s3.place.x1 = 1.0;
s3.place.y0 = 0.5; s3.place.y1 = 1.0; s3.place.y0 = 0.5; s3.place.y1 = 1.0;
s1.marker.type = Marker.Shape.PRICLE_CIRCLE; s1.marker.shape = Marker.Shape.PRICLE_CIRCLE;
s2.marker.type = Marker.Shape.PRICLE_SQUARE; s2.marker.shape = Marker.Shape.PRICLE_SQUARE;
s3.marker.type = Marker.Shape.SQUARE; s3.marker.shape = Marker.Shape.SQUARE;
s1.axis_x.title = new Text(chart, "All Series: Axis X."); s1.axis_x.title = new Text(chart, "All Series: Axis X.");
s1.axis_y.title = new Text(chart, "Series 1: Axis Y."); s1.axis_y.title = new Text(chart, "Series 1: Axis Y.");
@ -153,9 +153,9 @@ void plot_chart3 (Chart chart) {
s3.place.x0 = 0; s3.place.x1 = 0.5; s3.place.x0 = 0; s3.place.x1 = 0.5;
s3.place.y0 = 0.0; s3.place.y1 = 1.0; s3.place.y0 = 0.0; s3.place.y1 = 1.0;
s1.marker.type = Marker.Shape.SQUARE; s1.marker.shape = Marker.Shape.SQUARE;
s2.marker.type = Marker.Shape.PRICLE_CIRCLE; s2.marker.shape = Marker.Shape.PRICLE_CIRCLE;
s3.marker.type = Marker.Shape.TRIANGLE; s3.marker.shape = Marker.Shape.TRIANGLE;
s1.axis_x.title = new Text(chart, "Series 1: Axis X."); s1.axis_x.title = new Text(chart, "Series 1: Axis X.");
s1.axis_y.title = new Text(chart, "All Series: Axis Y."); s1.axis_y.title = new Text(chart, "All Series: Axis Y.");
@ -217,10 +217,10 @@ void plot_chart4 (Chart chart) {
s4.place.x0 = 0.2; s4.place.x1 = 1.0; s4.place.x0 = 0.2; s4.place.x1 = 1.0;
s4.place.y0 = 0.0; s4.place.y1 = 1.0; s4.place.y0 = 0.0; s4.place.y1 = 1.0;
s1.marker.type = Marker.Shape.SQUARE; s1.marker.shape = Marker.Shape.SQUARE;
s2.marker.type = Marker.Shape.PRICLE_CIRCLE; s2.marker.shape = Marker.Shape.PRICLE_CIRCLE;
s3.marker.type = Marker.Shape.TRIANGLE; s3.marker.shape = Marker.Shape.TRIANGLE;
s4.marker.type = Marker.Shape.PRICLE_SQUARE; s4.marker.shape = Marker.Shape.PRICLE_SQUARE;
s1.axis_x.title = new Text(chart, "Series 1: Axis X."); s1.axis_x.title = new Text(chart, "Series 1: Axis X.");
s1.axis_y.title = new Text(chart, "All Series: Axis Y."); s1.axis_y.title = new Text(chart, "All Series: Axis Y.");