2018-01-08 23:33:13 +03:00
|
|
|
namespace CairoChart {
|
|
|
|
|
2018-01-17 12:46:25 +03:00
|
|
|
/**
|
2018-01-18 17:14:54 +03:00
|
|
|
* Cairo/GTK+ ``Chart``.
|
2018-01-17 12:46:25 +03:00
|
|
|
*/
|
2017-02-16 15:10:53 +03:00
|
|
|
public class Chart {
|
|
|
|
|
2018-01-17 10:18:47 +03:00
|
|
|
/**
|
2018-01-18 17:14:54 +03:00
|
|
|
* ``Chart`` Position.
|
2018-01-17 10:18:47 +03:00
|
|
|
*/
|
2018-01-18 13:52:06 +03:00
|
|
|
public Cairo.Rectangle area = Cairo.Rectangle();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Current evaluated area.
|
|
|
|
*/
|
|
|
|
public Cairo.Rectangle evarea = Cairo.Rectangle()
|
2018-01-18 16:27:53 +03:00
|
|
|
{ x = 0, y = 0, width = 1, height = 1 };
|
2018-01-18 13:52:06 +03:00
|
|
|
|
|
|
|
/**
|
2018-01-18 16:57:39 +03:00
|
|
|
* Zoom area limits (relative coordinates: 0.0-1.0).
|
2018-01-18 13:52:06 +03:00
|
|
|
*/
|
|
|
|
public Cairo.Rectangle zoom = Cairo.Rectangle()
|
|
|
|
{ x = 0, y = 0, width = 1, height = 1 };
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-18 16:27:53 +03:00
|
|
|
/**
|
2018-01-18 16:57:39 +03:00
|
|
|
* Plot area bounds.
|
2018-01-18 16:27:53 +03:00
|
|
|
*/
|
|
|
|
public Cairo.Rectangle plarea = Cairo.Rectangle()
|
|
|
|
{ x = 0, y = 0, width = 1, height = 1 };
|
|
|
|
|
2018-01-17 10:36:10 +03:00
|
|
|
/**
|
2018-01-18 18:51:06 +03:00
|
|
|
* Cairo ``Context`` of the Drawing Area.
|
2018-01-17 10:36:10 +03:00
|
|
|
*/
|
|
|
|
public Cairo.Context ctx = null;
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-17 12:46:25 +03:00
|
|
|
/**
|
2018-01-18 18:51:06 +03:00
|
|
|
* Background ``Color``.
|
2018-01-17 12:46:25 +03:00
|
|
|
*/
|
2018-01-16 14:59:00 +03:00
|
|
|
public Color bg_color = Color(1, 1, 1);
|
2018-01-17 12:46:25 +03:00
|
|
|
|
|
|
|
/**
|
2018-01-18 18:51:06 +03:00
|
|
|
* Border ``Color``.
|
2018-01-17 12:46:25 +03:00
|
|
|
*/
|
2018-01-18 13:52:06 +03:00
|
|
|
public Color border_color = Color(0, 0, 0, 0.3);
|
2018-01-17 12:46:25 +03:00
|
|
|
|
|
|
|
/**
|
2018-01-18 17:14:54 +03:00
|
|
|
* ``Chart`` Title.
|
2018-01-17 12:46:25 +03:00
|
|
|
*/
|
2018-01-18 13:52:06 +03:00
|
|
|
public Text title = new Text("Cairo Chart");
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-17 12:46:25 +03:00
|
|
|
/**
|
|
|
|
* Legend.
|
|
|
|
*/
|
2018-01-18 13:52:06 +03:00
|
|
|
public Legend legend = new Legend();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-17 12:46:25 +03:00
|
|
|
/**
|
2018-01-19 10:40:35 +03:00
|
|
|
* ``Chart`` Series array.
|
2018-01-17 12:46:25 +03:00
|
|
|
*/
|
2017-10-25 19:31:30 +03:00
|
|
|
public Series[] series = {};
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-18 12:29:43 +03:00
|
|
|
/**
|
2018-01-19 10:40:35 +03:00
|
|
|
* index of the 1'st shown series in a zoommed area.
|
2018-01-18 12:29:43 +03:00
|
|
|
*/
|
|
|
|
public int zoom_1st_idx { get; protected set; default = 0; }
|
2018-01-16 12:09:21 +03:00
|
|
|
|
2018-01-18 16:53:47 +03:00
|
|
|
/**
|
|
|
|
* Joint/common X axes or not.
|
|
|
|
*/
|
2018-01-16 12:09:21 +03:00
|
|
|
public bool joint_x { get; protected set; default = false; }
|
2018-01-18 16:53:47 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Joint/common Y axes or not.
|
|
|
|
*/
|
2018-01-16 12:09:21 +03:00
|
|
|
public bool joint_y { get; protected set; default = false; }
|
2018-01-18 16:53:47 +03:00
|
|
|
|
|
|
|
/**
|
2018-01-18 18:51:06 +03:00
|
|
|
* Joint/common {@link Axis} ``Color``.
|
2018-01-18 16:53:47 +03:00
|
|
|
*/
|
2018-01-18 16:57:39 +03:00
|
|
|
public Color joint_color = Color (0, 0, 0, 1);
|
2018-01-16 12:09:21 +03:00
|
|
|
|
2018-01-18 16:53:47 +03:00
|
|
|
/**
|
|
|
|
* Selection line style.
|
|
|
|
*/
|
|
|
|
public Line.Style selection_style = Line.Style ();
|
|
|
|
|
|
|
|
/**
|
2018-01-18 17:14:54 +03:00
|
|
|
* ``Chart`` cursors.
|
2018-01-18 16:53:47 +03:00
|
|
|
*/
|
2018-01-18 18:10:28 +03:00
|
|
|
public Cursors cursors { get; protected set; default = null; }
|
2018-01-16 12:09:21 +03:00
|
|
|
|
2018-01-18 16:53:47 +03:00
|
|
|
/**
|
|
|
|
* Set paint color for further drawing.
|
|
|
|
*/
|
2018-01-16 20:39:59 +03:00
|
|
|
public Color color {
|
|
|
|
private get { return Color(); }
|
2018-01-17 10:36:10 +03:00
|
|
|
set { ctx.set_source_rgba (value.red, value.green, value.blue, value.alpha); }
|
2018-01-16 20:39:59 +03:00
|
|
|
default = Color();
|
2018-01-16 12:09:21 +03:00
|
|
|
}
|
|
|
|
|
2018-01-18 16:53:47 +03:00
|
|
|
/**
|
2018-01-18 17:14:54 +03:00
|
|
|
* Constructs a new ``Chart``.
|
2018-01-18 16:53:47 +03:00
|
|
|
*/
|
2018-01-18 18:10:28 +03:00
|
|
|
public Chart () {
|
|
|
|
cursors = new Cursors (this);
|
|
|
|
}
|
2018-01-16 20:39:59 +03:00
|
|
|
|
2018-01-18 17:14:54 +03:00
|
|
|
/**
|
|
|
|
* Gets a copy of the ``Chart``.
|
|
|
|
*/
|
2018-01-16 12:09:21 +03:00
|
|
|
public Chart copy () {
|
|
|
|
var chart = new Chart ();
|
2018-01-18 21:17:49 +03:00
|
|
|
chart.area = this.area;
|
2018-01-16 12:09:21 +03:00
|
|
|
chart.bg_color = this.bg_color;
|
|
|
|
chart.border_color = this.border_color;
|
2018-01-17 10:36:10 +03:00
|
|
|
chart.ctx = this.ctx;
|
2018-01-16 19:38:43 +03:00
|
|
|
chart.cursors = this.cursors.copy();
|
2018-01-18 21:17:49 +03:00
|
|
|
chart.evarea = this.evarea;
|
|
|
|
chart.joint_color = this.joint_color;
|
|
|
|
chart.joint_x = this.joint_x;
|
|
|
|
chart.joint_y = this.joint_y;
|
2018-01-16 12:09:21 +03:00
|
|
|
chart.legend = this.legend.copy();
|
2018-01-18 16:27:53 +03:00
|
|
|
chart.plarea = this.plarea;
|
2018-01-16 12:09:21 +03:00
|
|
|
chart.selection_style = this.selection_style;
|
|
|
|
chart.series = this.series;
|
|
|
|
chart.title = this.title.copy();
|
2018-01-18 21:17:49 +03:00
|
|
|
chart.zoom = this.zoom;
|
2018-01-18 12:29:43 +03:00
|
|
|
chart.zoom_1st_idx = this.zoom_1st_idx;
|
2018-01-16 12:09:21 +03:00
|
|
|
return chart;
|
|
|
|
}
|
|
|
|
|
2018-01-18 18:38:22 +03:00
|
|
|
/**
|
|
|
|
* Clears the ``Chart`` with a {@link bg_color} background color.
|
|
|
|
*/
|
2017-10-13 16:39:07 +03:00
|
|
|
public virtual void clear () {
|
2018-01-17 10:36:10 +03:00
|
|
|
if (ctx != null) {
|
2018-01-16 20:39:59 +03:00
|
|
|
color = bg_color;
|
2018-01-17 10:36:10 +03:00
|
|
|
ctx.paint();
|
2018-01-16 19:51:31 +03:00
|
|
|
}
|
2017-10-13 16:39:07 +03:00
|
|
|
}
|
2018-01-18 18:38:22 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws the ``Chart``.
|
|
|
|
*/
|
2017-10-13 16:39:07 +03:00
|
|
|
public virtual bool draw () {
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-18 13:52:06 +03:00
|
|
|
evarea = area;
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-19 10:40:35 +03:00
|
|
|
draw_title ();
|
2018-01-18 13:52:06 +03:00
|
|
|
fix_evarea ();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-08 23:33:13 +03:00
|
|
|
legend.draw (this);
|
2018-01-18 13:52:06 +03:00
|
|
|
fix_evarea ();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-19 10:31:51 +03:00
|
|
|
rot_axes_titles ();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-19 11:23:40 +03:00
|
|
|
cursors.get_crossings();
|
2017-12-01 16:25:07 +03:00
|
|
|
|
2018-01-19 10:40:35 +03:00
|
|
|
eval_plarea ();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-19 10:40:35 +03:00
|
|
|
draw_haxes ();
|
2018-01-18 13:52:06 +03:00
|
|
|
fix_evarea ();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-19 10:40:35 +03:00
|
|
|
draw_vaxes ();
|
2018-01-18 13:52:06 +03:00
|
|
|
fix_evarea ();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-19 10:40:35 +03:00
|
|
|
draw_plarea_border ();
|
2018-01-18 13:52:06 +03:00
|
|
|
fix_evarea ();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
|
|
|
draw_series ();
|
2018-01-18 13:52:06 +03:00
|
|
|
fix_evarea ();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-19 11:27:49 +03:00
|
|
|
cursors.draw ();
|
2018-01-18 13:52:06 +03:00
|
|
|
fix_evarea ();
|
2017-02-16 15:10:53 +03:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2018-01-18 18:38:22 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws selection with a {@link selection_style} line style.
|
|
|
|
* @param rect selection square.
|
|
|
|
*/
|
2018-01-16 20:39:59 +03:00
|
|
|
public virtual void draw_selection (Cairo.Rectangle rect) {
|
2018-01-19 11:36:33 +03:00
|
|
|
selection_style.apply(this);
|
2018-01-17 10:36:10 +03:00
|
|
|
ctx.rectangle (rect.x, rect.y, rect.width, rect.height);
|
|
|
|
ctx.stroke();
|
2018-01-16 20:39:59 +03:00
|
|
|
}
|
2017-02-16 15:10:53 +03:00
|
|
|
|
2018-01-18 18:38:22 +03:00
|
|
|
/**
|
|
|
|
* Zooms the ``Chart``.
|
|
|
|
* @param rect selected zoom area.
|
|
|
|
*/
|
2018-01-16 13:19:28 +03:00
|
|
|
public virtual void zoom_in (Cairo.Rectangle rect) {
|
2018-01-19 11:49:46 +03:00
|
|
|
foreach (var s in series) {
|
2017-11-28 21:51:58 +03:00
|
|
|
if (!s.zoom_show) continue;
|
2018-01-16 18:49:37 +03:00
|
|
|
var real_x0 = s.get_real_x (rect.x);
|
2018-01-19 11:44:02 +03:00
|
|
|
var real_x1 = s.get_real_x (rect.x + rect.width);
|
2018-01-19 13:29:12 +03:00
|
|
|
var real_width = real_x1 - real_x0;
|
2018-01-16 18:49:37 +03:00
|
|
|
var real_y0 = s.get_real_y (rect.y);
|
2018-01-19 11:44:02 +03:00
|
|
|
var real_y1 = s.get_real_y (rect.y + rect.height);
|
2018-01-19 13:29:12 +03:00
|
|
|
var real_height = real_y0 - real_y1;
|
2017-10-25 19:31:30 +03:00
|
|
|
// if selected square does not intersect with the series's square
|
2017-08-22 11:54:18 +03:00
|
|
|
if ( real_x1 <= s.axis_x.zoom_min || real_x0 >= s.axis_x.zoom_max
|
2018-01-19 13:50:00 +03:00
|
|
|
|| real_y0 <= s.axis_y.zoom_min || real_y1 >= s.axis_y.zoom_max) {
|
2017-11-28 21:51:58 +03:00
|
|
|
s.zoom_show = false;
|
2017-08-22 11:54:18 +03:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (real_x0 >= s.axis_x.zoom_min) {
|
|
|
|
s.axis_x.zoom_min = real_x0;
|
2018-01-08 23:33:13 +03:00
|
|
|
s.place.zoom_x_min = 0.0;
|
2017-08-22 11:54:18 +03:00
|
|
|
} else {
|
2018-01-19 13:29:12 +03:00
|
|
|
s.place.zoom_x_min = (s.axis_x.zoom_min - real_x0) / real_width;
|
2017-08-22 11:54:18 +03:00
|
|
|
}
|
|
|
|
if (real_x1 <= s.axis_x.zoom_max) {
|
|
|
|
s.axis_x.zoom_max = real_x1;
|
2018-01-08 23:33:13 +03:00
|
|
|
s.place.zoom_x_max = 1.0;
|
2017-08-22 11:54:18 +03:00
|
|
|
} else {
|
2018-01-19 13:29:12 +03:00
|
|
|
s.place.zoom_x_max = (s.axis_x.zoom_max - real_x0) / real_width;
|
2017-08-22 11:54:18 +03:00
|
|
|
}
|
|
|
|
if (real_y1 >= s.axis_y.zoom_min) {
|
|
|
|
s.axis_y.zoom_min = real_y1;
|
2018-01-08 23:33:13 +03:00
|
|
|
s.place.zoom_y_min = 0.0;
|
2017-08-22 11:54:18 +03:00
|
|
|
} else {
|
2018-01-19 13:29:12 +03:00
|
|
|
s.place.zoom_y_min = (s.axis_y.zoom_min - real_y1) / real_height;
|
2017-08-22 11:54:18 +03:00
|
|
|
}
|
|
|
|
if (real_y0 <= s.axis_y.zoom_max) {
|
|
|
|
s.axis_y.zoom_max = real_y0;
|
2018-01-08 23:33:13 +03:00
|
|
|
s.place.zoom_y_max = 1.0;
|
2017-08-22 11:54:18 +03:00
|
|
|
} else {
|
2018-01-19 13:29:12 +03:00
|
|
|
s.place.zoom_y_max = (s.axis_y.zoom_max - real_y1) / real_height;
|
2017-08-22 11:54:18 +03:00
|
|
|
}
|
|
|
|
}
|
2017-10-06 22:46:51 +03:00
|
|
|
|
2018-01-18 12:29:43 +03:00
|
|
|
zoom_1st_idx = 0;
|
2018-01-19 11:49:46 +03:00
|
|
|
for (var si = 0; si < series.length; ++si)
|
2017-11-28 21:51:58 +03:00
|
|
|
if (series[si].zoom_show) {
|
2018-01-18 12:29:43 +03:00
|
|
|
zoom_1st_idx = si;
|
2017-10-25 19:31:30 +03:00
|
|
|
break;
|
|
|
|
}
|
2018-01-18 12:22:49 +03:00
|
|
|
var new_zoom = zoom;
|
2018-01-19 13:56:18 +03:00
|
|
|
var rmpx = rect.x - plarea.x;
|
2018-01-19 14:02:41 +03:00
|
|
|
var zdpw = zoom.width / plarea.width;
|
|
|
|
new_zoom.x += rmpx * zdpw;
|
|
|
|
var x_max = zoom.x + (rmpx + rect.width) * zdpw;
|
2018-01-18 12:22:49 +03:00
|
|
|
new_zoom.width = x_max - new_zoom.x;
|
2018-01-19 13:56:18 +03:00
|
|
|
var rmpy = rect.y - plarea.y;
|
2018-01-19 14:02:41 +03:00
|
|
|
var zdph = zoom.height / plarea.height;
|
|
|
|
new_zoom.y += rmpy * zdph;
|
|
|
|
var y_max = zoom.y + (rmpy + rect.height) * zdph;
|
2018-01-18 12:22:49 +03:00
|
|
|
new_zoom.height = y_max - new_zoom.y;
|
|
|
|
zoom = new_zoom;
|
2017-08-22 11:54:18 +03:00
|
|
|
}
|
2018-01-18 18:38:22 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Zooms out the ``Chart``.
|
|
|
|
*/
|
2017-08-22 11:54:18 +03:00
|
|
|
public virtual void zoom_out () {
|
2018-01-19 14:09:50 +03:00
|
|
|
foreach (var s in series) s.unzoom();
|
2018-01-18 12:22:49 +03:00
|
|
|
zoom = Cairo.Rectangle() { x = 0, y = 0, width = 1, height = 1 };
|
2018-01-18 12:29:43 +03:00
|
|
|
zoom_1st_idx = 0;
|
2017-10-06 22:46:51 +03:00
|
|
|
}
|
2018-01-18 18:38:22 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Moves the ``Chart``.
|
|
|
|
* @param delta delta Δ(x;y) value to move the ``Chart``.
|
|
|
|
*/
|
2018-01-16 13:39:17 +03:00
|
|
|
public virtual void move (Point delta) {
|
|
|
|
var d = delta;
|
2018-01-19 15:13:28 +03:00
|
|
|
|
|
|
|
d.x /= -plarea.width; d.y /= -plarea.height;
|
|
|
|
|
2018-01-19 16:04:16 +03:00
|
|
|
var z = zoom;
|
2018-01-19 15:13:28 +03:00
|
|
|
|
2017-10-06 22:46:51 +03:00
|
|
|
zoom_out();
|
2018-01-19 15:13:28 +03:00
|
|
|
|
|
|
|
d.x *= plarea.width; d.y *= plarea.height;
|
|
|
|
|
2018-01-19 16:04:16 +03:00
|
|
|
var x0 = plarea.x + plarea.width * z.x;
|
|
|
|
var x1 = plarea.x + plarea.width * (z.x + z.width);
|
|
|
|
var y0 = plarea.y + plarea.height * z.y;
|
|
|
|
var y1 = plarea.y + plarea.height * (z.y + z.height);
|
2017-10-06 22:46:51 +03:00
|
|
|
|
2018-01-19 16:04:16 +03:00
|
|
|
d.x *= z.width; d.y *= z.height;
|
2017-10-06 22:46:51 +03:00
|
|
|
|
2018-01-19 14:25:53 +03:00
|
|
|
var px1 = plarea.x + plarea.width;
|
|
|
|
var py1 = plarea.y + plarea.height;
|
2018-01-19 15:13:28 +03:00
|
|
|
|
2018-01-19 16:04:16 +03:00
|
|
|
if (x0 + d.x < plarea.x) d.x = plarea.x - x0;
|
|
|
|
if (x1 + d.x > px1) d.x = px1 - x1;
|
|
|
|
if (y0 + d.y < plarea.y) d.y = plarea.y - y0;
|
|
|
|
if (y1 + d.y > py1) d.y = py1 - y1;
|
2017-10-06 22:46:51 +03:00
|
|
|
|
2018-01-19 15:13:28 +03:00
|
|
|
zoom_in(Cairo.Rectangle() {
|
2018-01-19 16:04:16 +03:00
|
|
|
x = x0 + d.x,
|
|
|
|
y = y0 + d.y,
|
|
|
|
width = plarea.width * z.width,
|
|
|
|
height = plarea.height * z.height
|
2018-01-19 15:13:28 +03:00
|
|
|
});
|
2017-08-22 11:54:18 +03:00
|
|
|
}
|
|
|
|
|
2018-01-18 17:20:06 +03:00
|
|
|
protected virtual void fix_evarea () {
|
|
|
|
if (evarea.width < 0) evarea.width = 0;
|
|
|
|
if (evarea.height < 0) evarea.height = 0;
|
|
|
|
}
|
2018-01-19 10:31:51 +03:00
|
|
|
protected virtual void rot_axes_titles () {
|
2018-01-19 16:08:30 +03:00
|
|
|
foreach (var s in series)
|
2018-01-18 17:20:06 +03:00
|
|
|
s.axis_y.title.style.orientation = Font.Orientation.VERTICAL;
|
|
|
|
}
|
|
|
|
|
2018-01-19 10:40:35 +03:00
|
|
|
protected virtual void eval_plarea () {
|
2018-01-19 10:52:06 +03:00
|
|
|
plarea.x = evarea.x + legend.spacing;
|
|
|
|
plarea.width = evarea.width - 2 * legend.spacing;
|
|
|
|
plarea.y = evarea.y + legend.spacing;
|
|
|
|
plarea.height = evarea.height - 2 * legend.spacing;
|
2018-01-15 16:40:14 +03:00
|
|
|
|
|
|
|
// Check for joint axes
|
|
|
|
joint_x = joint_y = true;
|
2018-01-19 17:20:23 +03:00
|
|
|
int nshow = 0;
|
|
|
|
foreach (var s in series) {
|
2018-01-15 16:40:14 +03:00
|
|
|
if (!s.zoom_show) continue;
|
2018-01-19 17:20:23 +03:00
|
|
|
if (!s.equal_x_axis(series[0])) joint_x = false;
|
|
|
|
if (!s.equal_y_axis(series[0])) joint_y = false;
|
2018-01-19 17:34:30 +03:00
|
|
|
++nshow;
|
2018-01-15 16:40:14 +03:00
|
|
|
}
|
2018-01-19 17:20:23 +03:00
|
|
|
if (nshow == 1) joint_x = joint_y = false;
|
2018-01-15 16:40:14 +03:00
|
|
|
|
2018-01-19 10:07:11 +03:00
|
|
|
for (var si = series.length - 1, nskip = 0; si >= 0; --si)
|
2018-01-19 17:34:30 +03:00
|
|
|
series[si].join_axes(true, si, ref nskip);
|
2018-01-19 10:07:11 +03:00
|
|
|
|
|
|
|
for (var si = series.length - 1, nskip = 0; si >= 0; --si)
|
2018-01-19 17:34:30 +03:00
|
|
|
series[si].join_axes(false, si, ref nskip);
|
2018-01-15 16:40:14 +03:00
|
|
|
}
|
|
|
|
|
2018-01-19 10:40:35 +03:00
|
|
|
protected virtual void draw_plarea_border () {
|
2018-01-18 17:20:06 +03:00
|
|
|
color = border_color;
|
|
|
|
ctx.set_dash(null, 0);
|
2018-01-19 16:29:56 +03:00
|
|
|
ctx.rectangle(plarea.x, plarea.y, plarea.width, plarea.height);
|
2018-01-18 17:20:06 +03:00
|
|
|
ctx.stroke ();
|
|
|
|
}
|
2018-01-19 10:40:35 +03:00
|
|
|
protected virtual void draw_title () {
|
2018-01-18 17:20:06 +03:00
|
|
|
var sz = title.get_size(ctx);
|
2018-01-19 16:33:27 +03:00
|
|
|
var title_height = sz.height + title.vspacing * 2;
|
2018-01-18 17:20:06 +03:00
|
|
|
evarea.y += title_height;
|
|
|
|
evarea.height -= title_height;
|
|
|
|
color = title.color;
|
2018-01-19 11:09:33 +03:00
|
|
|
ctx.move_to (area.width/2 - sz.width/2, sz.height + title.vspacing);
|
2018-01-18 17:20:06 +03:00
|
|
|
title.show(ctx);
|
|
|
|
}
|
2018-01-19 10:40:35 +03:00
|
|
|
protected virtual void draw_haxes () {
|
2018-01-18 17:20:06 +03:00
|
|
|
for (var si = series.length - 1, nskip = 0; si >=0; --si)
|
|
|
|
series[si].draw_horizontal_axis (si, ref nskip);
|
|
|
|
}
|
2018-01-19 10:40:35 +03:00
|
|
|
protected virtual void draw_vaxes () {
|
2018-01-18 17:20:06 +03:00
|
|
|
for (var si = series.length - 1, nskip = 0; si >=0; --si)
|
|
|
|
series[si].draw_vertical_axis (si, ref nskip);
|
|
|
|
}
|
|
|
|
protected virtual void draw_series () {
|
2018-01-19 16:26:46 +03:00
|
|
|
foreach (var s in series)
|
2018-01-18 17:20:06 +03:00
|
|
|
if (s.zoom_show && s.points.length != 0)
|
|
|
|
s.draw();
|
|
|
|
}
|
2017-02-09 13:23:16 +03:00
|
|
|
}
|
|
|
|
}
|