OK In progress...

This commit is contained in:
Kolan Sh 2018-01-22 14:44:31 +03:00
parent bcb847c65e
commit 47bc860e3d
5 changed files with 59 additions and 21 deletions

View File

@ -1,23 +1,61 @@
namespace CairoChart { namespace CairoChart {
/** /**
* * ``Chart`` axis.
*/ */
public class Axis { public class Axis {
public Range range = new Range();
Chart chart; Chart chart;
public Text title; public Text title;
/**
* ``Axis`` range/limits.
*/
public Range range = new Range();
/**
* Data type.
*/
public enum DType { public enum DType {
/**
* Float128 numbers.
*/
NUMBERS = 0, NUMBERS = 0,
/**
* Date/Time.
*/
DATE_TIME DATE_TIME
} }
public enum ScaleType {
LINEAR = 0, // default /**
// LOGARITHMIC, // TODO * Data type.
// etc */
}
public DType dtype; public DType dtype;
/**
* ``Axis`` scale type.
*/
public enum ScaleType {
/**
* Linear scale.
*/
LINEAR = 0,
/**
* Logarithmic scale.
*/
// LOGARITHMIC,
}
/**
* Scale type.
*/
public ScaleType scale_type; public ScaleType scale_type;
/**
* ``Axis`` position.
*/
public enum Position { public enum Position {
LOW = 0, LOW = 0,
HIGH = 1, HIGH = 1,
@ -66,6 +104,11 @@ namespace CairoChart {
public LineStyle line_style = LineStyle (); public LineStyle line_style = LineStyle ();
public double font_spacing = 5; public double font_spacing = 5;
public Axis (Chart chart) {
this.chart = chart;
title = new Text (chart, "");
}
public virtual Axis copy () { public virtual Axis copy () {
var axis = new Axis (chart); var axis = new Axis (chart);
axis._date_format = this._date_format; axis._date_format = this._date_format;
@ -86,11 +129,6 @@ namespace CairoChart {
return axis; return axis;
} }
public Axis (Chart chart) {
this.chart = chart;
title = new Text (chart, "");
}
public int nrecords = 128; public int nrecords = 128;
public virtual void format_date_time (Float128 x, out string date, out string time) { public virtual void format_date_time (Float128 x, out string date, out string time) {
@ -133,8 +171,8 @@ namespace CairoChart {
} }
} }
public virtual void unzoom () { public virtual void zoom_out () {
range.unzoom(); range.zoom_out();
} }
} }
} }

View File

@ -253,7 +253,7 @@ namespace CairoChart {
* Zooms out the ``Chart``. * Zooms out the ``Chart``.
*/ */
public virtual void zoom_out () { public virtual void zoom_out () {
foreach (var s in series) s.unzoom(); foreach (var s in series) s.zoom_out();
zoom = new Area.with_abs (0, 0, 1, 1); zoom = new Area.with_abs (0, 0, 1, 1);
zoom_1st_idx = 0; zoom_1st_idx = 0;
} }

View File

@ -210,7 +210,7 @@ namespace CairoChart {
/** /**
* Unzooms ``Place``. * Unzooms ``Place``.
*/ */
public virtual void unzoom () { public virtual void zoom_out () {
zx0 = x0; zx0 = x0;
zy0 = y0; zy0 = y0;
zx1 = x1; zx1 = x1;

View File

@ -105,7 +105,7 @@ namespace CairoChart {
/** /**
* Unzooms ``Range``. * Unzooms ``Range``.
*/ */
public virtual void unzoom () { public virtual void zoom_out () {
zmin = min; zmin = min;
zmax = max; zmax = max;
} }

View File

@ -544,11 +544,11 @@ namespace CairoChart {
return Point128 (get_real_x(p.x), get_real_y(p.y)); return Point128 (get_real_x(p.x), get_real_y(p.y));
} }
public virtual void unzoom () { public virtual void zoom_out () {
zoom_show = true; zoom_show = true;
axis_x.unzoom(); axis_x.zoom_out();
axis_y.unzoom(); axis_y.zoom_out();
place.unzoom(); place.zoom_out();
} }
} }
} }