OK In progress...
This commit is contained in:
parent
cf0e81e076
commit
e01bc80210
|
@ -10,7 +10,7 @@ namespace CairoChart {
|
||||||
/**
|
/**
|
||||||
* ``Marker`` shape.
|
* ``Marker`` shape.
|
||||||
*/
|
*/
|
||||||
public enum Type {
|
public enum Shape {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
SQUARE,
|
SQUARE,
|
||||||
CIRCLE,
|
CIRCLE,
|
||||||
|
@ -23,7 +23,7 @@ namespace CairoChart {
|
||||||
/**
|
/**
|
||||||
* ``Marker`` shape.
|
* ``Marker`` shape.
|
||||||
*/
|
*/
|
||||||
public Type type;
|
public Shape type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ``Marker`` size.
|
* ``Marker`` size.
|
||||||
|
@ -36,7 +36,7 @@ namespace CairoChart {
|
||||||
* @param size ``Marker`` size.
|
* @param size ``Marker`` size.
|
||||||
*/
|
*/
|
||||||
public Marker (Chart chart,
|
public Marker (Chart chart,
|
||||||
Type type = Type.NONE,
|
Shape type = Shape.NONE,
|
||||||
double size = 8.0
|
double size = 8.0
|
||||||
) {
|
) {
|
||||||
this.chart = chart;
|
this.chart = chart;
|
||||||
|
@ -59,17 +59,17 @@ namespace CairoChart {
|
||||||
public virtual void draw_at_pos (double x, double y) {
|
public virtual void draw_at_pos (double x, double y) {
|
||||||
chart.ctx.move_to (x, y);
|
chart.ctx.move_to (x, y);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Type.SQUARE:
|
case Shape.SQUARE:
|
||||||
chart.ctx.rectangle (x - size / 2, y - size / 2, size, size);
|
chart.ctx.rectangle (x - size / 2, y - size / 2, size, size);
|
||||||
chart.ctx.fill();
|
chart.ctx.fill();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type.CIRCLE:
|
case Shape.CIRCLE:
|
||||||
chart.ctx.arc (x, y, size / 2, 0, 2 * GLib.Math.PI);
|
chart.ctx.arc (x, y, size / 2, 0, 2 * GLib.Math.PI);
|
||||||
chart.ctx.fill();
|
chart.ctx.fill();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type.TRIANGLE:
|
case Shape.TRIANGLE:
|
||||||
chart.ctx.move_to (x - size / 2, y - size / 2);
|
chart.ctx.move_to (x - size / 2, 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);
|
||||||
|
@ -77,17 +77,17 @@ namespace CairoChart {
|
||||||
chart.ctx.fill();
|
chart.ctx.fill();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type.PRICLE_SQUARE:
|
case Shape.PRICLE_SQUARE:
|
||||||
chart.ctx.rectangle (x - size / 2, y - size / 2, size, size);
|
chart.ctx.rectangle (x - size / 2, y - size / 2, size, size);
|
||||||
chart.ctx.stroke();
|
chart.ctx.stroke();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type.PRICLE_CIRCLE:
|
case Shape.PRICLE_CIRCLE:
|
||||||
chart.ctx.arc (x, y, size / 2, 0, 2 * GLib.Math.PI);
|
chart.ctx.arc (x, y, size / 2, 0, 2 * GLib.Math.PI);
|
||||||
chart.ctx.stroke();
|
chart.ctx.stroke();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type.PRICLE_TRIANGLE:
|
case Shape.PRICLE_TRIANGLE:
|
||||||
chart.ctx.move_to (x - size / 2, y - size / 2);
|
chart.ctx.move_to (x - size / 2, 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);
|
||||||
|
|
|
@ -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.Type.SQUARE;
|
s1.marker.type = Marker.Shape.SQUARE;
|
||||||
s2.marker.type = Marker.Type.CIRCLE;
|
s2.marker.type = Marker.Shape.CIRCLE;
|
||||||
s3.marker.type = Marker.Type.PRICLE_TRIANGLE;
|
s3.marker.type = 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.Type.PRICLE_CIRCLE;
|
s1.marker.type = Marker.Shape.PRICLE_CIRCLE;
|
||||||
s2.marker.type = Marker.Type.PRICLE_SQUARE;
|
s2.marker.type = Marker.Shape.PRICLE_SQUARE;
|
||||||
s3.marker.type = Marker.Type.SQUARE;
|
s3.marker.type = 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.Type.SQUARE;
|
s1.marker.type = Marker.Shape.SQUARE;
|
||||||
s2.marker.type = Marker.Type.PRICLE_CIRCLE;
|
s2.marker.type = Marker.Shape.PRICLE_CIRCLE;
|
||||||
s3.marker.type = Marker.Type.TRIANGLE;
|
s3.marker.type = 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.Type.SQUARE;
|
s1.marker.type = Marker.Shape.SQUARE;
|
||||||
s2.marker.type = Marker.Type.PRICLE_CIRCLE;
|
s2.marker.type = Marker.Shape.PRICLE_CIRCLE;
|
||||||
s3.marker.type = Marker.Type.TRIANGLE;
|
s3.marker.type = Marker.Shape.TRIANGLE;
|
||||||
s4.marker.type = Marker.Type.PRICLE_SQUARE;
|
s4.marker.type = 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.");
|
||||||
|
|
Loading…
Reference in New Issue