In progress...

This commit is contained in:
Kolan Sh 2018-01-19 10:52:06 +03:00
parent 92c3548943
commit 272cefc395
5 changed files with 78 additions and 78 deletions

View File

@ -75,7 +75,7 @@ namespace CairoChart {
public Font.Style font_style = Font.Style (); public Font.Style font_style = Font.Style ();
public Color color = Color (); public Color color = Color ();
public Line.Style line_style = Line.Style (); public Line.Style line_style = Line.Style ();
public double font_indent = 5; public double font_spacing = 5;
public virtual Axis copy () { public virtual Axis copy () {
var axis = new Axis (); var axis = new Axis ();
@ -84,7 +84,7 @@ namespace CairoChart {
axis._format = this._format; axis._format = this._format;
axis._time_format = this._time_format; axis._time_format = this._time_format;
axis.color = this.color; axis.color = this.color;
axis.font_indent = this.font_indent; axis.font_spacing = this.font_spacing;
axis.font_style = this.font_style; axis.font_style = this.font_style;
axis.line_style = this.line_style; axis.line_style = this.line_style;
axis.max = this.max; axis.max = this.max;

View File

@ -98,10 +98,10 @@ namespace CairoChart {
} }
/** /**
* TODO: remove all indent fields / evaluate automatically. * TODO: remove all spacing fields / evaluate automatically.
*/ */
[Version (deprecated = true)] [Version (deprecated = true)]
public double title_indent = 4; public double title_spacing = 4;
/** /**
* Constructs a new ``Chart``. * Constructs a new ``Chart``.
@ -129,7 +129,7 @@ namespace CairoChart {
chart.selection_style = this.selection_style; chart.selection_style = this.selection_style;
chart.series = this.series; chart.series = this.series;
chart.title = this.title.copy(); chart.title = this.title.copy();
chart.title_indent = this.title_indent; chart.title_spacing = this.title_spacing;
chart.zoom = this.zoom; chart.zoom = this.zoom;
chart.zoom_1st_idx = this.zoom_1st_idx; chart.zoom_1st_idx = this.zoom_1st_idx;
return chart; return chart;
@ -314,10 +314,10 @@ namespace CairoChart {
} }
protected virtual void eval_plarea () { protected virtual void eval_plarea () {
plarea.x = evarea.x + legend.indent; plarea.x = evarea.x + legend.spacing;
plarea.width = evarea.width - 2 * legend.indent; plarea.width = evarea.width - 2 * legend.spacing;
plarea.y = evarea.y + legend.indent; plarea.y = evarea.y + legend.spacing;
plarea.height = evarea.height - 2 * legend.indent; plarea.height = evarea.height - 2 * legend.spacing;
// Check for joint axes // Check for joint axes
joint_x = joint_y = true; joint_x = joint_y = true;
@ -350,11 +350,11 @@ namespace CairoChart {
} }
protected virtual void draw_title () { protected virtual void draw_title () {
var sz = title.get_size(ctx); var sz = title.get_size(ctx);
var title_height = sz.height + (legend.position == Legend.Position.TOP ? title_indent * 2 : title_indent); var title_height = sz.height + (legend.position == Legend.Position.TOP ? title_spacing * 2 : title_spacing);
evarea.y += title_height; evarea.y += title_height;
evarea.height -= title_height; evarea.height -= title_height;
color = title.color; color = title.color;
ctx.move_to (area.width/2 - sz.width/2, sz.height + title_indent); ctx.move_to (area.width/2 - sz.width/2, sz.height + title_spacing);
title.show(ctx); title.show(ctx);
} }
protected virtual void draw_haxes () { protected virtual void draw_haxes () {

View File

@ -232,8 +232,8 @@ namespace CairoChart {
if (show_date) { var sz = date_t.get_size(chart.ctx); size.x = sz.width; h_x = sz.height; } if (show_date) { var sz = date_t.get_size(chart.ctx); size.x = sz.width; h_x = sz.height; }
if (show_time) { var sz = time_t.get_size(chart.ctx); size.x = double.max(size.x, sz.width); h_x += sz.height; } if (show_time) { var sz = time_t.get_size(chart.ctx); size.x = double.max(size.x, sz.width); h_x += sz.height; }
if (show_y) { var sz = y_t.get_size(chart.ctx); size.x += sz.width; h_y = sz.height; } if (show_y) { var sz = y_t.get_size(chart.ctx); size.x += sz.width; h_y = sz.height; }
if ((show_x || show_date || show_time) && show_y) size.x += double.max(s.axis_x.font_indent, s.axis_y.font_indent); if ((show_x || show_date || show_time) && show_y) size.x += double.max(s.axis_x.font_spacing, s.axis_y.font_spacing);
if (show_date && show_time) h_x += s.axis_x.font_indent; if (show_date && show_time) h_x += s.axis_x.font_spacing;
size.y = double.max (h_x, h_y); size.y = double.max (h_x, h_y);
} }
@ -261,21 +261,21 @@ namespace CairoChart {
if (chart.joint_x) { if (chart.joint_x) {
switch (s.axis_x.position) { switch (s.axis_x.position) {
case Axis.Position.LOW: high.y = chart.plarea.y + chart.plarea.height + s.axis_x.font_indent; break; case Axis.Position.LOW: high.y = chart.plarea.y + chart.plarea.height + s.axis_x.font_spacing; break;
case Axis.Position.HIGH: low.y = chart.plarea.y - s.axis_x.font_indent; break; case Axis.Position.HIGH: low.y = chart.plarea.y - s.axis_x.font_spacing; break;
case Axis.Position.BOTH: case Axis.Position.BOTH:
high.y = chart.plarea.y + chart.plarea.height + s.axis_x.font_indent; high.y = chart.plarea.y + chart.plarea.height + s.axis_x.font_spacing;
low.y = chart.plarea.y - s.axis_x.font_indent; low.y = chart.plarea.y - s.axis_x.font_spacing;
break; break;
} }
} }
if (chart.joint_y) { if (chart.joint_y) {
switch (s.axis_y.position) { switch (s.axis_y.position) {
case Axis.Position.LOW: low.x = chart.plarea.x - s.axis_y.font_indent; break; case Axis.Position.LOW: low.x = chart.plarea.x - s.axis_y.font_spacing; break;
case Axis.Position.HIGH: high.x = chart.plarea.x + chart.plarea.width + s.axis_y.font_indent; break; case Axis.Position.HIGH: high.x = chart.plarea.x + chart.plarea.width + s.axis_y.font_spacing; break;
case Axis.Position.BOTH: case Axis.Position.BOTH:
low.x = chart.plarea.x - s.axis_y.font_indent; low.x = chart.plarea.x - s.axis_y.font_spacing;
high.x = chart.plarea.x + chart.plarea.width + s.axis_y.font_indent; high.x = chart.plarea.x + chart.plarea.width + s.axis_y.font_spacing;
break; break;
} }
} }
@ -312,13 +312,13 @@ namespace CairoChart {
var time_text_t = new Text(time_text, s.axis_x.font_style, s.axis_x.color); var time_text_t = new Text(time_text, s.axis_x.font_style, s.axis_x.color);
var print_y = 0.0; var print_y = 0.0;
switch (s.axis_x.position) { switch (s.axis_x.position) {
case Axis.Position.LOW: print_y = chart.area.y + chart.area.height - s.axis_x.font_indent case Axis.Position.LOW: print_y = chart.area.y + chart.area.height - s.axis_x.font_spacing
- (chart.legend.position == Legend.Position.BOTTOM ? chart.legend.height : 0); - (chart.legend.position == Legend.Position.BOTTOM ? chart.legend.height : 0);
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
var title_height = chart.title.get_height(chart.ctx) + (chart.legend.position == Legend.Position.TOP ? var title_height = chart.title.get_height(chart.ctx) + (chart.legend.position == Legend.Position.TOP ?
chart.title_indent * 2 : chart.title_indent); chart.title_spacing * 2 : chart.title_spacing);
print_y = chart.area.y + title_height + s.axis_x.font_indent print_y = chart.area.y + title_height + s.axis_x.font_spacing
+ (chart.legend.position == Legend.Position.TOP ? chart.legend.height : 0); + (chart.legend.position == Legend.Position.TOP ? chart.legend.height : 0);
switch (s.axis_x.type) { switch (s.axis_x.type) {
case Axis.Type.NUMBERS: case Axis.Type.NUMBERS:
@ -327,7 +327,7 @@ namespace CairoChart {
case Axis.Type.DATE_TIME: case Axis.Type.DATE_TIME:
print_y += (s.axis_x.date_format == "" ? 0 : sz.height) print_y += (s.axis_x.date_format == "" ? 0 : sz.height)
+ (s.axis_x.time_format == "" ? 0 : time_text_t.get_height(chart.ctx)) + (s.axis_x.time_format == "" ? 0 : time_text_t.get_height(chart.ctx))
+ (s.axis_x.date_format == "" || s.axis_x.time_format == "" ? 0 : s.axis_x.font_indent); + (s.axis_x.date_format == "" || s.axis_x.time_format == "" ? 0 : s.axis_x.font_spacing);
break; break;
} }
break; break;
@ -342,7 +342,7 @@ namespace CairoChart {
case Axis.Type.DATE_TIME: case Axis.Type.DATE_TIME:
if (s.axis_x.date_format != "") text_t.show(chart.ctx); if (s.axis_x.date_format != "") text_t.show(chart.ctx);
print_x = s.compact_rec_x_pos (x, time_text_t); print_x = s.compact_rec_x_pos (x, time_text_t);
chart.ctx.move_to (print_x, print_y - (s.axis_x.date_format == "" ? 0 : sz.height + s.axis_x.font_indent)); chart.ctx.move_to (print_x, print_y - (s.axis_x.date_format == "" ? 0 : sz.height + s.axis_x.font_spacing));
if (s.axis_x.time_format != "") time_text_t.show(chart.ctx); if (s.axis_x.time_format != "") time_text_t.show(chart.ctx);
break; break;
} }
@ -362,11 +362,11 @@ namespace CairoChart {
var print_x = 0.0; var print_x = 0.0;
switch (s.axis_y.position) { switch (s.axis_y.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
print_x = chart.area.x + s.axis_y.font_indent print_x = chart.area.x + s.axis_y.font_spacing
+ (chart.legend.position == Legend.Position.LEFT ? chart.legend.width : 0); + (chart.legend.position == Legend.Position.LEFT ? chart.legend.width : 0);
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
print_x = chart.area.x + chart.area.width - text_t.get_width(chart.ctx) - s.axis_y.font_indent print_x = chart.area.x + chart.area.width - text_t.get_width(chart.ctx) - s.axis_y.font_spacing
- (chart.legend.position == Legend.Position.RIGHT ? chart.legend.width : 0); - (chart.legend.position == Legend.Position.RIGHT ? chart.legend.width : 0);
break; break;
} }
@ -408,7 +408,7 @@ namespace CairoChart {
var text_t = new Text(time, s.axis_x.font_style); var text_t = new Text(time, s.axis_x.font_style);
var sz = text_t.get_size(chart.ctx); var sz = text_t.get_size(chart.ctx);
var y = svp.y + sz.height / 2; var y = svp.y + sz.height / 2;
if (show_date) y -= sz.height / 2 + s.axis_x.font_indent / 2; if (show_date) y -= sz.height / 2 + s.axis_x.font_spacing / 2;
chart.ctx.move_to (svp.x - size.x / 2, y); chart.ctx.move_to (svp.x - size.x / 2, y);
if (chart.joint_x) chart.color = chart.joint_color; if (chart.joint_x) chart.color = chart.joint_color;
text_t.show(chart.ctx); text_t.show(chart.ctx);
@ -421,7 +421,7 @@ namespace CairoChart {
var text_t = new Text(date, s.axis_x.font_style); var text_t = new Text(date, s.axis_x.font_style);
var sz = text_t.get_size(chart.ctx); var sz = text_t.get_size(chart.ctx);
var y = svp.y + sz.height / 2; var y = svp.y + sz.height / 2;
if (show_time) y += sz.height / 2 + s.axis_x.font_indent / 2; if (show_time) y += sz.height / 2 + s.axis_x.font_spacing / 2;
chart.ctx.move_to (svp.x - size.x / 2, y); chart.ctx.move_to (svp.x - size.x / 2, y);
if (chart.joint_x) chart.color = chart.joint_color; if (chart.joint_x) chart.color = chart.joint_color;
text_t.show(chart.ctx); text_t.show(chart.ctx);

View File

@ -13,7 +13,7 @@ namespace CairoChart {
public Font.Style font_style = Font.Style(); public Font.Style font_style = Font.Style();
public Color bg_color = Color(1, 1, 1); public Color bg_color = Color(1, 1, 1);
public Line.Style border_style = Line.Style (); public Line.Style border_style = Line.Style ();
public double indent = 5; public double spacing = 5;
public double width = 0; public double width = 0;
public double height = 0; public double height = 0;
public double line_length = 30.0; public double line_length = 30.0;
@ -26,7 +26,7 @@ namespace CairoChart {
legend.position = this.position; legend.position = this.position;
legend.font_style = this.font_style; legend.font_style = this.font_style;
legend.bg_color = this.bg_color; legend.bg_color = this.bg_color;
legend.indent = this.indent; legend.spacing = this.spacing;
legend.height = this.height; legend.height = this.height;
legend.line_length = this.line_length; legend.line_length = this.line_length;
legend.text_hspace = this.text_hspace; legend.text_hspace = this.text_hspace;
@ -53,7 +53,7 @@ namespace CairoChart {
case Position.TOP: case Position.TOP:
x0 = (chart.area.width - width) / 2; x0 = (chart.area.width - width) / 2;
var title_height = chart.title.get_height(chart.ctx) + (chart.legend.position == Legend.Position.TOP ? var title_height = chart.title.get_height(chart.ctx) + (chart.legend.position == Legend.Position.TOP ?
chart.title_indent * 2 : chart.title_indent); chart.title_spacing * 2 : chart.title_spacing);
y0 = title_height; y0 = title_height;
break; break;

View File

@ -122,14 +122,14 @@ namespace CairoChart {
if (nskip != 0) {--nskip; return;} if (nskip != 0) {--nskip; return;}
double max_rec_width = 0; double max_rec_height = 0; double max_rec_width = 0; double max_rec_height = 0;
axis.calc_rec_sizes (chart, out max_rec_width, out max_rec_height, is_x); axis.calc_rec_sizes (chart, out max_rec_width, out max_rec_height, is_x);
var max_font_indent = axis.font_indent; var max_font_spacing = axis.font_spacing;
var max_axis_font_width = axis.title.text == "" ? 0 : axis.title.get_width(chart.ctx) + axis.font_indent; var max_axis_font_width = axis.title.text == "" ? 0 : axis.title.get_width(chart.ctx) + axis.font_spacing;
var max_axis_font_height = axis.title.text == "" ? 0 : axis.title.get_height(chart.ctx) + axis.font_indent; var max_axis_font_height = axis.title.text == "" ? 0 : axis.title.get_height(chart.ctx) + axis.font_spacing;
if (is_x) if (is_x)
s.join_relative_x_axes (si, true, ref max_rec_width, ref max_rec_height, ref max_font_indent, ref max_axis_font_height, ref nskip); s.join_relative_x_axes (si, true, ref max_rec_width, ref max_rec_height, ref max_font_spacing, ref max_axis_font_height, ref nskip);
else else
s.join_relative_y_axes (si, true, ref max_rec_width, ref max_rec_height, ref max_font_indent, ref max_axis_font_width, ref nskip); s.join_relative_y_axes (si, true, ref max_rec_width, ref max_rec_height, ref max_font_spacing, ref max_axis_font_width, ref nskip);
// for 4.2. Cursor values for joint X axis // for 4.2. Cursor values for joint X axis
if (si == chart.zoom_1st_idx && chart.cursors.cursors_crossings.length != 0) { if (si == chart.zoom_1st_idx && chart.cursors.cursors_crossings.length != 0) {
@ -137,9 +137,9 @@ namespace CairoChart {
case Cursors.Orientation.VERTICAL: case Cursors.Orientation.VERTICAL:
if (is_x && chart.joint_x) if (is_x && chart.joint_x)
switch (axis.position) { switch (axis.position) {
case Axis.Position.LOW: chart.plarea.height -= max_rec_height + axis.font_indent; break; case Axis.Position.LOW: chart.plarea.height -= max_rec_height + axis.font_spacing; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
var tmp = max_rec_height + axis.font_indent; var tmp = max_rec_height + axis.font_spacing;
chart.plarea.y += tmp; chart.plarea.height -= tmp; chart.plarea.y += tmp; chart.plarea.height -= tmp;
break; break;
} }
@ -148,29 +148,29 @@ namespace CairoChart {
if (!is_x && chart.joint_y) if (!is_x && chart.joint_y)
switch (s.axis_y.position) { switch (s.axis_y.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
var tmp = max_rec_width + s.axis_y.font_indent; var tmp = max_rec_width + s.axis_y.font_spacing;
chart.plarea.x += tmp; chart.plarea.width -= tmp; chart.plarea.x += tmp; chart.plarea.width -= tmp;
break; break;
case Axis.Position.HIGH: chart.plarea.width -= max_rec_width + s.axis_y.font_indent; break; case Axis.Position.HIGH: chart.plarea.width -= max_rec_width + s.axis_y.font_spacing; break;
} }
break; break;
} }
} }
if (is_x && (!chart.joint_x || si == chart.zoom_1st_idx)) if (is_x && (!chart.joint_x || si == chart.zoom_1st_idx))
switch (axis.position) { switch (axis.position) {
case Axis.Position.LOW: chart.plarea.height -= max_rec_height + max_font_indent + max_axis_font_height; break; case Axis.Position.LOW: chart.plarea.height -= max_rec_height + max_font_spacing + max_axis_font_height; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
var tmp = max_rec_height + max_font_indent + max_axis_font_height; var tmp = max_rec_height + max_font_spacing + max_axis_font_height;
chart.plarea.y += tmp; chart.plarea.height -= tmp; chart.plarea.y += tmp; chart.plarea.height -= tmp;
break; break;
} }
if (!is_x && (!chart.joint_y || si == chart.zoom_1st_idx)) if (!is_x && (!chart.joint_y || si == chart.zoom_1st_idx))
switch (s.axis_y.position) { switch (s.axis_y.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
var tmp = max_rec_width + max_font_indent + max_axis_font_width; var tmp = max_rec_width + max_font_spacing + max_axis_font_width;
chart.plarea.x += tmp; chart.plarea.width -= tmp; chart.plarea.x += tmp; chart.plarea.width -= tmp;
break; break;
case Axis.Position.HIGH: chart.plarea.width -= max_rec_width + max_font_indent + max_axis_font_width; break; case Axis.Position.HIGH: chart.plarea.width -= max_rec_width + max_font_spacing + max_axis_font_width; break;
} }
} }
@ -178,7 +178,7 @@ namespace CairoChart {
bool calc_max_values, bool calc_max_values,
ref double max_rec_width, ref double max_rec_width,
ref double max_rec_height, ref double max_rec_height,
ref double max_font_indent, ref double max_font_spacing,
ref double max_axis_font_height, ref double max_axis_font_height,
ref int nskip) { ref int nskip) {
for (int sj = si - 1; sj >= 0; --sj) { for (int sj = si - 1; sj >= 0; --sj) {
@ -201,9 +201,9 @@ namespace CairoChart {
s2.axis_x.calc_rec_sizes (chart, out tmp_max_rec_width, out tmp_max_rec_height, true); s2.axis_x.calc_rec_sizes (chart, out tmp_max_rec_width, out tmp_max_rec_height, true);
max_rec_width = double.max (max_rec_width, tmp_max_rec_width); max_rec_width = double.max (max_rec_width, tmp_max_rec_width);
max_rec_height = double.max (max_rec_height, tmp_max_rec_height); max_rec_height = double.max (max_rec_height, tmp_max_rec_height);
max_font_indent = double.max (max_font_indent, s2.axis_x.font_indent); max_font_spacing = double.max (max_font_spacing, s2.axis_x.font_spacing);
max_axis_font_height = double.max (max_axis_font_height, s2.axis_x.title.text == "" ? 0 : max_axis_font_height = double.max (max_axis_font_height, s2.axis_x.title.text == "" ? 0 :
s2.axis_x.title.get_height(chart.ctx) + this.axis_x.font_indent); s2.axis_x.title.get_height(chart.ctx) + this.axis_x.font_spacing);
} }
++nskip; ++nskip;
} else { } else {
@ -216,7 +216,7 @@ namespace CairoChart {
bool calc_max_values, bool calc_max_values,
ref double max_rec_width, ref double max_rec_width,
ref double max_rec_height, ref double max_rec_height,
ref double max_font_indent, ref double max_font_spacing,
ref double max_axis_font_width, ref double max_axis_font_width,
ref int nskip) { ref int nskip) {
for (int sj = si - 1; sj >= 0; --sj) { for (int sj = si - 1; sj >= 0; --sj) {
@ -238,9 +238,9 @@ namespace CairoChart {
s2.axis_y.calc_rec_sizes (chart, out tmp_max_rec_width, out tmp_max_rec_height, false); s2.axis_y.calc_rec_sizes (chart, out tmp_max_rec_width, out tmp_max_rec_height, false);
max_rec_width = double.max (max_rec_width, tmp_max_rec_width); max_rec_width = double.max (max_rec_width, tmp_max_rec_width);
max_rec_height = double.max (max_rec_height, tmp_max_rec_height); max_rec_height = double.max (max_rec_height, tmp_max_rec_height);
max_font_indent = double.max (max_font_indent, s2.axis_y.font_indent); max_font_spacing = double.max (max_font_spacing, s2.axis_y.font_spacing);
max_axis_font_width = double.max (max_axis_font_width, s2.axis_y.title.text == "" ? 0 max_axis_font_width = double.max (max_axis_font_width, s2.axis_y.title.text == "" ? 0
: s2.axis_y.title.get_width(chart.ctx) + this.axis_y.font_indent); : s2.axis_y.title.get_width(chart.ctx) + this.axis_y.font_spacing);
++nskip; ++nskip;
} else { } else {
break; break;
@ -271,7 +271,7 @@ namespace CairoChart {
switch (axis_x.position) { switch (axis_x.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
var print_y = chart.evarea.y + chart.evarea.height - axis_x.font_indent - (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_indent); var print_y = chart.evarea.y + chart.evarea.height - axis_x.font_spacing - (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_spacing);
var print_x = compact_rec_x_pos (x, text_t); var print_x = compact_rec_x_pos (x, text_t);
ctx.move_to (print_x, print_y); ctx.move_to (print_x, print_y);
switch (axis_x.type) { switch (axis_x.type) {
@ -282,7 +282,7 @@ namespace CairoChart {
if (axis_x.date_format != "") text_t.show(ctx); if (axis_x.date_format != "") text_t.show(ctx);
var time_text_t = new Text(time_text, axis_x.font_style, axis_x.color); var time_text_t = new Text(time_text, axis_x.font_style, axis_x.color);
print_x = compact_rec_x_pos (x, time_text_t); print_x = compact_rec_x_pos (x, time_text_t);
ctx.move_to (print_x, print_y - (axis_x.date_format == "" ? 0 : text_t.get_height(ctx) + axis_x.font_indent)); ctx.move_to (print_x, print_y - (axis_x.date_format == "" ? 0 : text_t.get_height(ctx) + axis_x.font_spacing));
if (axis_x.time_format != "") time_text_t.show(ctx); if (axis_x.time_format != "") time_text_t.show(ctx);
break; break;
} }
@ -290,7 +290,7 @@ namespace CairoChart {
var line_style = grid.line_style; var line_style = grid.line_style;
if (joint_x) line_style.color = Color(0, 0, 0, 0.5); if (joint_x) line_style.color = Color(0, 0, 0, 0.5);
line_style.set(chart); line_style.set(chart);
double y = chart.evarea.y + chart.evarea.height - max_rec_height - axis_x.font_indent - (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_indent); double y = chart.evarea.y + chart.evarea.height - max_rec_height - axis_x.font_spacing - (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_spacing);
ctx.move_to (scr_x, y); ctx.move_to (scr_x, y);
if (joint_x) if (joint_x)
ctx.line_to (scr_x, chart.plarea.y); ctx.line_to (scr_x, chart.plarea.y);
@ -298,7 +298,7 @@ namespace CairoChart {
ctx.line_to (scr_x, double.min (y, chart.plarea.y + chart.plarea.height * (1.0 - place.zoom_y_max))); ctx.line_to (scr_x, double.min (y, chart.plarea.y + chart.plarea.height * (1.0 - place.zoom_y_max)));
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
var print_y = chart.evarea.y + max_rec_height + axis_x.font_indent + (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_indent); var print_y = chart.evarea.y + max_rec_height + axis_x.font_spacing + (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_spacing);
var print_x = compact_rec_x_pos (x, text_t); var print_x = compact_rec_x_pos (x, text_t);
ctx.move_to (print_x, print_y); ctx.move_to (print_x, print_y);
@ -310,7 +310,7 @@ namespace CairoChart {
if (axis_x.date_format != "") text_t.show(ctx); if (axis_x.date_format != "") text_t.show(ctx);
var time_text_t = new Text(time_text, axis_x.font_style, axis_x.color); var time_text_t = new Text(time_text, axis_x.font_style, axis_x.color);
print_x = compact_rec_x_pos (x, time_text_t); print_x = compact_rec_x_pos (x, time_text_t);
ctx.move_to (print_x, print_y - (axis_x.date_format == "" ? 0 : text_t.get_height(ctx) + axis_x.font_indent)); ctx.move_to (print_x, print_y - (axis_x.date_format == "" ? 0 : text_t.get_height(ctx) + axis_x.font_spacing));
if (axis_x.time_format != "") time_text_t.show(ctx); if (axis_x.time_format != "") time_text_t.show(ctx);
break; break;
} }
@ -318,7 +318,7 @@ namespace CairoChart {
var line_style = grid.line_style; var line_style = grid.line_style;
if (joint_x) line_style.color = Color(0, 0, 0, 0.5); if (joint_x) line_style.color = Color(0, 0, 0, 0.5);
line_style.set(chart); line_style.set(chart);
double y = chart.evarea.y + max_rec_height + axis_x.font_indent + (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_indent); double y = chart.evarea.y + max_rec_height + axis_x.font_spacing + (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_spacing);
ctx.move_to (scr_x, y); ctx.move_to (scr_x, y);
if (joint_x) if (joint_x)
ctx.line_to (scr_x, chart.plarea.y + chart.plarea.height); ctx.line_to (scr_x, chart.plarea.y + chart.plarea.height);
@ -361,8 +361,8 @@ namespace CairoChart {
// 4.2. Cursor values for joint X axis // 4.2. Cursor values for joint X axis
if (chart.joint_x && chart.cursors.cursor_style.orientation == Cursors.Orientation.VERTICAL && chart.cursors.cursors_crossings.length != 0) { if (chart.joint_x && chart.cursors.cursor_style.orientation == Cursors.Orientation.VERTICAL && chart.cursors.cursors_crossings.length != 0) {
switch (s.axis_x.position) { switch (s.axis_x.position) {
case Axis.Position.LOW: chart.evarea.height -= max_rec_height + s.axis_x.font_indent; break; case Axis.Position.LOW: chart.evarea.height -= max_rec_height + s.axis_x.font_spacing; break;
case Axis.Position.HIGH: var tmp = max_rec_height + s.axis_x.font_indent; chart.evarea.y += tmp; chart.evarea.height -= tmp; break; case Axis.Position.HIGH: var tmp = max_rec_height + s.axis_x.font_spacing; chart.evarea.y += tmp; chart.evarea.height -= tmp; break;
} }
} }
@ -373,8 +373,8 @@ namespace CairoChart {
var scr_x = chart.plarea.x + chart.plarea.width * (s.place.zoom_x_min + s.place.zoom_x_max) / 2.0; var scr_x = chart.plarea.x + chart.plarea.width * (s.place.zoom_x_min + s.place.zoom_x_max) / 2.0;
double scr_y = 0.0; double scr_y = 0.0;
switch (s.axis_x.position) { switch (s.axis_x.position) {
case Axis.Position.LOW: scr_y = chart.evarea.y + chart.evarea.height - s.axis_x.font_indent; break; case Axis.Position.LOW: scr_y = chart.evarea.y + chart.evarea.height - s.axis_x.font_spacing; break;
case Axis.Position.HIGH: scr_y = chart.evarea.y + s.axis_x.font_indent + sz.height; break; case Axis.Position.HIGH: scr_y = chart.evarea.y + s.axis_x.font_spacing + sz.height; break;
} }
chart.ctx.move_to(scr_x - sz.width / 2.0, scr_y); chart.ctx.move_to(scr_x - sz.width / 2.0, scr_y);
chart.color = s.axis_x.color; chart.color = s.axis_x.color;
@ -393,11 +393,11 @@ namespace CairoChart {
switch (s.axis_x.position) { switch (s.axis_x.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
chart.evarea.height -= max_rec_height + s.axis_x.font_indent chart.evarea.height -= max_rec_height + s.axis_x.font_spacing
+ (s.axis_x.title.text == "" ? 0 : sz.height + s.axis_x.font_indent); + (s.axis_x.title.text == "" ? 0 : sz.height + s.axis_x.font_spacing);
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
var tmp = max_rec_height + s.axis_x.font_indent + (s.axis_x.title.text == "" ? 0 : sz.height + s.axis_x.font_indent); var tmp = max_rec_height + s.axis_x.font_spacing + (s.axis_x.title.text == "" ? 0 : sz.height + s.axis_x.font_spacing);
chart.evarea.y += tmp; chart.evarea.height -= tmp; chart.evarea.y += tmp; chart.evarea.height -= tmp;
break; break;
} }
@ -419,15 +419,15 @@ namespace CairoChart {
switch (axis_y.position) { switch (axis_y.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
ctx.move_to (chart.evarea.x + max_rec_width - text_sz.width + axis_y.font_indent ctx.move_to (chart.evarea.x + max_rec_width - text_sz.width + axis_y.font_spacing
+ (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent), + (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_spacing),
compact_rec_y_pos (y, text_t)); compact_rec_y_pos (y, text_t));
text_t.show(ctx); text_t.show(ctx);
// 6. Draw grid lines to the place.zoom_x_min. // 6. Draw grid lines to the place.zoom_x_min.
var line_style = grid.line_style; var line_style = grid.line_style;
if (joint_y) line_style.color = Color(0, 0, 0, 0.5); if (joint_y) line_style.color = Color(0, 0, 0, 0.5);
line_style.set(chart); line_style.set(chart);
double x = chart.evarea.x + max_rec_width + axis_y.font_indent + (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent); double x = chart.evarea.x + max_rec_width + axis_y.font_spacing + (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_spacing);
ctx.move_to (x, scr_y); ctx.move_to (x, scr_y);
if (joint_y) if (joint_y)
ctx.line_to (chart.plarea.x + chart.plarea.width, scr_y); ctx.line_to (chart.plarea.x + chart.plarea.width, scr_y);
@ -435,15 +435,15 @@ namespace CairoChart {
ctx.line_to (double.max (x, chart.plarea.x + chart.plarea.width * place.zoom_x_max), scr_y); ctx.line_to (double.max (x, chart.plarea.x + chart.plarea.width * place.zoom_x_max), scr_y);
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
ctx.move_to (chart.evarea.x + chart.evarea.width - text_sz.width - axis_y.font_indent ctx.move_to (chart.evarea.x + chart.evarea.width - text_sz.width - axis_y.font_spacing
- (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent), - (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_spacing),
compact_rec_y_pos (y, text_t)); compact_rec_y_pos (y, text_t));
text_t.show(ctx); text_t.show(ctx);
// 6. Draw grid lines to the place.zoom_x_max. // 6. Draw grid lines to the place.zoom_x_max.
var line_style = grid.line_style; var line_style = grid.line_style;
if (joint_y) line_style.color = Color(0, 0, 0, 0.5); if (joint_y) line_style.color = Color(0, 0, 0, 0.5);
line_style.set(chart); line_style.set(chart);
double x = chart.evarea.x + chart.evarea.width - max_rec_width - axis_y.font_indent - (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent); double x = chart.evarea.x + chart.evarea.width - max_rec_width - axis_y.font_spacing - (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_spacing);
ctx.move_to (x, scr_y); ctx.move_to (x, scr_y);
if (joint_y) if (joint_y)
ctx.line_to (chart.plarea.x, scr_y); ctx.line_to (chart.plarea.x, scr_y);
@ -485,8 +485,8 @@ namespace CairoChart {
// 4.2. Cursor values for joint Y axis // 4.2. Cursor values for joint Y axis
if (chart.joint_y && chart.cursors.cursor_style.orientation == Cursors.Orientation.HORIZONTAL && chart.cursors.cursors_crossings.length != 0) { if (chart.joint_y && chart.cursors.cursor_style.orientation == Cursors.Orientation.HORIZONTAL && chart.cursors.cursors_crossings.length != 0) {
switch (s.axis_y.position) { switch (s.axis_y.position) {
case Axis.Position.LOW: var tmp = max_rec_width + s.axis_y.font_indent; chart.evarea.x += tmp; chart.evarea.width -= tmp; break; case Axis.Position.LOW: var tmp = max_rec_width + s.axis_y.font_spacing; chart.evarea.x += tmp; chart.evarea.width -= tmp; break;
case Axis.Position.HIGH: chart.evarea.width -= max_rec_width + s.axis_y.font_indent; break; case Axis.Position.HIGH: chart.evarea.width -= max_rec_width + s.axis_y.font_spacing; break;
} }
} }
@ -497,11 +497,11 @@ namespace CairoChart {
var scr_y = chart.plarea.y + chart.plarea.height * (1.0 - (s.place.zoom_y_min + s.place.zoom_y_max) / 2.0); var scr_y = chart.plarea.y + chart.plarea.height * (1.0 - (s.place.zoom_y_min + s.place.zoom_y_max) / 2.0);
switch (s.axis_y.position) { switch (s.axis_y.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
var scr_x = chart.evarea.x + s.axis_y.font_indent + sz.width; var scr_x = chart.evarea.x + s.axis_y.font_spacing + sz.width;
chart.ctx.move_to(scr_x, scr_y + sz.height / 2.0); chart.ctx.move_to(scr_x, scr_y + sz.height / 2.0);
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
var scr_x = chart.evarea.x + chart.evarea.width - s.axis_y.font_indent; var scr_x = chart.evarea.x + chart.evarea.width - s.axis_y.font_spacing;
chart.ctx.move_to(scr_x, scr_y + sz.height / 2.0); chart.ctx.move_to(scr_x, scr_y + sz.height / 2.0);
break; break;
} }
@ -521,12 +521,12 @@ namespace CairoChart {
switch (s.axis_y.position) { switch (s.axis_y.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
var tmp = max_rec_width + s.axis_y.font_indent + (s.axis_y.title.text == "" ? 0 : sz.width + s.axis_y.font_indent); var tmp = max_rec_width + s.axis_y.font_spacing + (s.axis_y.title.text == "" ? 0 : sz.width + s.axis_y.font_spacing);
chart.evarea.x += tmp; chart.evarea.width -= tmp; chart.evarea.x += tmp; chart.evarea.width -= tmp;
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
chart.evarea.width -= max_rec_width + s.axis_y.font_indent chart.evarea.width -= max_rec_width + s.axis_y.font_spacing
+ (s.axis_y.title.text == "" ? 0 : sz.width + s.axis_y.font_indent); break; + (s.axis_y.title.text == "" ? 0 : sz.width + s.axis_y.font_spacing); break;
} }
} }