OK In progress...
This commit is contained in:
parent
5342b49bf7
commit
4628b6cdd7
|
@ -147,11 +147,6 @@ namespace CairoChart {
|
||||||
*/
|
*/
|
||||||
public LineStyle line_style = LineStyle ();
|
public LineStyle line_style = LineStyle ();
|
||||||
|
|
||||||
/**
|
|
||||||
* ``Axis`` font spacing.
|
|
||||||
*/
|
|
||||||
public double font_spacing = 5;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of equally placed points to evaluate records sizes.
|
* Number of equally placed points to evaluate records sizes.
|
||||||
*/
|
*/
|
||||||
|
@ -176,11 +171,9 @@ 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_spacing = this.font_spacing;
|
axis.font = this.font.copy();
|
||||||
axis.font = this.font;
|
|
||||||
axis.line_style = this.line_style;
|
axis.line_style = this.line_style;
|
||||||
axis.range.max = this.range.max;
|
axis.range = this.range.copy();
|
||||||
axis.range.min = this.range.min;
|
|
||||||
axis.position = this.position;
|
axis.position = this.position;
|
||||||
axis.scale = this.scale;
|
axis.scale = this.scale;
|
||||||
axis.title = this.title.copy();
|
axis.title = this.title.copy();
|
||||||
|
|
|
@ -218,8 +218,8 @@ namespace CairoChart {
|
||||||
if (show_date) { size.x = date_t.width; h_x = date_t.height; }
|
if (show_date) { size.x = date_t.width; h_x = date_t.height; }
|
||||||
if (show_time) { size.x = double.max(size.x, time_t.width); h_x += time_t.height; }
|
if (show_time) { size.x = double.max(size.x, time_t.width); h_x += time_t.height; }
|
||||||
if (show_y) { size.x += y_t.width; h_y = y_t.height; }
|
if (show_y) { size.x += y_t.width; h_y = y_t.height; }
|
||||||
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_x || show_date || show_time) && show_y) size.x += double.max(s.axis_x.font.hspacing, s.axis_y.font.hspacing);
|
||||||
if (show_date && show_time) h_x += s.axis_x.font_spacing;
|
if (show_date && show_time) h_x += s.axis_x.font.hspacing;
|
||||||
size.y = double.max (h_x, h_y);
|
size.y = double.max (h_x, h_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,21 +247,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.y1 + s.axis_x.font_spacing; break;
|
case Axis.Position.LOW: high.y = chart.plarea.y1 + s.axis_x.font.vspacing; break;
|
||||||
case Axis.Position.HIGH: low.y = chart.plarea.y0 - s.axis_x.font_spacing; break;
|
case Axis.Position.HIGH: low.y = chart.plarea.y0 - s.axis_x.font.vspacing; break;
|
||||||
case Axis.Position.BOTH:
|
case Axis.Position.BOTH:
|
||||||
high.y = chart.plarea.y1 + s.axis_x.font_spacing;
|
high.y = chart.plarea.y1 + s.axis_x.font.vspacing;
|
||||||
low.y = chart.plarea.y0 - s.axis_x.font_spacing;
|
low.y = chart.plarea.y0 - s.axis_x.font.vspacing;
|
||||||
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.x0 - s.axis_y.font_spacing; break;
|
case Axis.Position.LOW: low.x = chart.plarea.x0 - s.axis_y.font.hspacing; break;
|
||||||
case Axis.Position.HIGH: high.x = chart.plarea.x1 + s.axis_y.font_spacing; break;
|
case Axis.Position.HIGH: high.x = chart.plarea.x1 + s.axis_y.font.hspacing; break;
|
||||||
case Axis.Position.BOTH:
|
case Axis.Position.BOTH:
|
||||||
low.x = chart.plarea.x0 - s.axis_y.font_spacing;
|
low.x = chart.plarea.x0 - s.axis_y.font.hspacing;
|
||||||
high.x = chart.plarea.x1 + s.axis_y.font_spacing;
|
high.x = chart.plarea.x1 + s.axis_y.font.hspacing;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,13 +291,13 @@ namespace CairoChart {
|
||||||
var time_text_t = new Text(chart, time_text, s.axis_x.font, s.axis_x.color);
|
var time_text_t = new Text(chart, time_text, s.axis_x.font, 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.y1 - s.axis_x.font_spacing
|
case Axis.Position.LOW: print_y = chart.area.y1 - s.axis_x.font.vspacing
|
||||||
- (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.height + (chart.legend.position == Legend.Position.TOP ?
|
var title_height = chart.title.height + (chart.legend.position == Legend.Position.TOP ?
|
||||||
chart.title.font.vspacing * 2 : chart.title.font.vspacing);
|
chart.title.font.vspacing * 2 : chart.title.font.vspacing);
|
||||||
print_y = chart.area.y0 + title_height + s.axis_x.font_spacing
|
print_y = chart.area.y0 + title_height + s.axis_x.font.vspacing
|
||||||
+ (chart.legend.position == Legend.Position.TOP ? chart.legend.height : 0);
|
+ (chart.legend.position == Legend.Position.TOP ? chart.legend.height : 0);
|
||||||
switch (s.axis_x.dtype) {
|
switch (s.axis_x.dtype) {
|
||||||
case Axis.DType.NUMBERS:
|
case Axis.DType.NUMBERS:
|
||||||
|
@ -306,7 +306,7 @@ namespace CairoChart {
|
||||||
case Axis.DType.DATE_TIME:
|
case Axis.DType.DATE_TIME:
|
||||||
print_y += (s.axis_x.date_format == "" ? 0 : text_t.height)
|
print_y += (s.axis_x.date_format == "" ? 0 : text_t.height)
|
||||||
+ (s.axis_x.time_format == "" ? 0 : time_text_t.height)
|
+ (s.axis_x.time_format == "" ? 0 : time_text_t.height)
|
||||||
+ (s.axis_x.date_format == "" || s.axis_x.time_format == "" ? 0 : s.axis_x.font_spacing);
|
+ (s.axis_x.date_format == "" || s.axis_x.time_format == "" ? 0 : s.axis_x.font.vspacing);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -321,7 +321,7 @@ namespace CairoChart {
|
||||||
case Axis.DType.DATE_TIME:
|
case Axis.DType.DATE_TIME:
|
||||||
if (s.axis_x.date_format != "") text_t.show();
|
if (s.axis_x.date_format != "") text_t.show();
|
||||||
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 : text_t.height + s.axis_x.font_spacing));
|
chart.ctx.move_to (print_x, print_y - (s.axis_x.date_format == "" ? 0 : text_t.height + s.axis_x.font.vspacing));
|
||||||
if (s.axis_x.time_format != "") time_text_t.show();
|
if (s.axis_x.time_format != "") time_text_t.show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -341,11 +341,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.x0 + s.axis_y.font_spacing
|
print_x = chart.area.x0 + s.axis_y.font.hspacing
|
||||||
+ (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.x1 - text_t.width - s.axis_y.font_spacing
|
print_x = chart.area.x1 - text_t.width - s.axis_y.font.hspacing
|
||||||
- (chart.legend.position == Legend.Position.RIGHT ? chart.legend.width : 0);
|
- (chart.legend.position == Legend.Position.RIGHT ? chart.legend.width : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ namespace CairoChart {
|
||||||
s.axis_x.format_date_time(point.x, out date, out time);
|
s.axis_x.format_date_time(point.x, out date, out time);
|
||||||
var text_t = new Text(chart, time, s.axis_x.font);
|
var text_t = new Text(chart, time, s.axis_x.font);
|
||||||
var y = svp.y + text_t.height / 2;
|
var y = svp.y + text_t.height / 2;
|
||||||
if (show_date) y -= text_t.height / 2 + s.axis_x.font_spacing / 2;
|
if (show_date) y -= text_t.height / 2 + s.axis_x.font.vspacing / 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();
|
text_t.show();
|
||||||
|
@ -398,7 +398,7 @@ namespace CairoChart {
|
||||||
s.axis_x.format_date_time(point.x, out date, out time);
|
s.axis_x.format_date_time(point.x, out date, out time);
|
||||||
var text_t = new Text(chart, date, s.axis_x.font);
|
var text_t = new Text(chart, date, s.axis_x.font);
|
||||||
var y = svp.y + text_t.height / 2;
|
var y = svp.y + text_t.height / 2;
|
||||||
if (show_time) y += text_t.height / 2 + s.axis_x.font_spacing / 2;
|
if (show_time) y += text_t.height / 2 + s.axis_x.font.vspacing / 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();
|
text_t.show();
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace CairoChart {
|
||||||
public virtual Legend copy () {
|
public virtual Legend copy () {
|
||||||
var legend = new Legend ();
|
var legend = new Legend ();
|
||||||
legend.position = this.position;
|
legend.position = this.position;
|
||||||
legend.font = this.font;
|
legend.font = this.font.copy();
|
||||||
legend.bg_color = this.bg_color;
|
legend.bg_color = this.bg_color;
|
||||||
legend.spacing = this.spacing;
|
legend.spacing = this.spacing;
|
||||||
legend.height = this.height;
|
legend.height = this.height;
|
||||||
|
|
|
@ -124,9 +124,9 @@ 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 (out max_rec_width, out max_rec_height, is_x);
|
axis.calc_rec_sizes (out max_rec_width, out max_rec_height, is_x);
|
||||||
var max_font_spacing = axis.font_spacing;
|
var max_font_spacing = is_x ? axis.font.vspacing : axis.font.hspacing;
|
||||||
var max_axis_font_width = axis.title.text == "" ? 0 : axis.title.width + axis.font_spacing;
|
var max_axis_font_width = axis.title.text == "" ? 0 : axis.title.width + axis.font.hspacing;
|
||||||
var max_axis_font_height = axis.title.text == "" ? 0 : axis.title.height + axis.font_spacing;
|
var max_axis_font_height = axis.title.text == "" ? 0 : axis.title.height + axis.font.vspacing;
|
||||||
|
|
||||||
if (is_x)
|
if (is_x)
|
||||||
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);
|
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);
|
||||||
|
@ -138,7 +138,7 @@ namespace CairoChart {
|
||||||
switch (chart.cursors.cursor_style.orientation) {
|
switch (chart.cursors.cursor_style.orientation) {
|
||||||
case Cursors.Orientation.VERTICAL:
|
case Cursors.Orientation.VERTICAL:
|
||||||
if (is_x && chart.joint_x) {
|
if (is_x && chart.joint_x) {
|
||||||
var tmp = max_rec_height + axis.font_spacing;
|
var tmp = max_rec_height + axis.font.vspacing;
|
||||||
switch (axis.position) {
|
switch (axis.position) {
|
||||||
case Axis.Position.LOW: chart.plarea.y1 -= tmp; break;
|
case Axis.Position.LOW: chart.plarea.y1 -= tmp; break;
|
||||||
case Axis.Position.HIGH: chart.plarea.y0 += tmp; break;
|
case Axis.Position.HIGH: chart.plarea.y0 += tmp; break;
|
||||||
|
@ -147,7 +147,7 @@ namespace CairoChart {
|
||||||
break;
|
break;
|
||||||
case Cursors.Orientation.HORIZONTAL:
|
case Cursors.Orientation.HORIZONTAL:
|
||||||
if (!is_x && chart.joint_y) {
|
if (!is_x && chart.joint_y) {
|
||||||
var tmp = max_rec_width + s.axis_y.font_spacing;
|
var tmp = max_rec_width + s.axis_y.font.hspacing;
|
||||||
switch (s.axis_y.position) {
|
switch (s.axis_y.position) {
|
||||||
case Axis.Position.LOW: chart.plarea.x0 += tmp; break;
|
case Axis.Position.LOW: chart.plarea.x0 += tmp; break;
|
||||||
case Axis.Position.HIGH: chart.plarea.x1 -= tmp; break;
|
case Axis.Position.HIGH: chart.plarea.x1 -= tmp; break;
|
||||||
|
@ -199,9 +199,9 @@ namespace CairoChart {
|
||||||
s2.axis_x.calc_rec_sizes (out tmp_max_rec_width, out tmp_max_rec_height, true);
|
s2.axis_x.calc_rec_sizes (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_spacing = double.max (max_font_spacing, s2.axis_x.font_spacing);
|
max_font_spacing = double.max (max_font_spacing, s2.axis_x.font.vspacing);
|
||||||
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.height + this.axis_x.font_spacing);
|
s2.axis_x.title.height + this.axis_x.font.vspacing);
|
||||||
}
|
}
|
||||||
++nskip;
|
++nskip;
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,9 +236,9 @@ namespace CairoChart {
|
||||||
s2.axis_y.calc_rec_sizes (out tmp_max_rec_width, out tmp_max_rec_height, false);
|
s2.axis_y.calc_rec_sizes (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_spacing = double.max (max_font_spacing, s2.axis_y.font_spacing);
|
max_font_spacing = double.max (max_font_spacing, s2.axis_y.font.hspacing);
|
||||||
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.width + this.axis_y.font_spacing);
|
: s2.axis_y.title.width + this.axis_y.font.hspacing);
|
||||||
++nskip;
|
++nskip;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -264,7 +264,7 @@ namespace CairoChart {
|
||||||
|
|
||||||
switch (axis_x.position) {
|
switch (axis_x.position) {
|
||||||
case Axis.Position.LOW:
|
case Axis.Position.LOW:
|
||||||
var print_y = chart.evarea.y1 - axis_x.font_spacing - (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font_spacing);
|
var print_y = chart.evarea.y1 - axis_x.font.vspacing - (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font.vspacing);
|
||||||
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.dtype) {
|
switch (axis_x.dtype) {
|
||||||
|
@ -275,7 +275,7 @@ namespace CairoChart {
|
||||||
if (axis_x.date_format != "") text_t.show();
|
if (axis_x.date_format != "") text_t.show();
|
||||||
var time_text_t = new Text(chart, time_text, axis_x.font, axis_x.color);
|
var time_text_t = new Text(chart, time_text, axis_x.font, 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.height + axis_x.font_spacing));
|
ctx.move_to (print_x, print_y - (axis_x.date_format == "" ? 0 : text_t.height + axis_x.font.vspacing));
|
||||||
if (axis_x.time_format != "") time_text_t.show();
|
if (axis_x.time_format != "") time_text_t.show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ namespace CairoChart {
|
||||||
var grid_style = grid.style;
|
var grid_style = grid.style;
|
||||||
if (joint_x) grid_style.color = Color(0, 0, 0, 0.5);
|
if (joint_x) grid_style.color = Color(0, 0, 0, 0.5);
|
||||||
grid_style.apply(chart);
|
grid_style.apply(chart);
|
||||||
double y = chart.evarea.y1 - max_rec_height - axis_x.font_spacing - (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font_spacing);
|
double y = chart.evarea.y1 - max_rec_height - axis_x.font.vspacing - (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font.vspacing);
|
||||||
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.y0);
|
ctx.line_to (scr_x, chart.plarea.y0);
|
||||||
|
@ -291,7 +291,7 @@ namespace CairoChart {
|
||||||
ctx.line_to (scr_x, double.min (y, chart.plarea.y0 + chart.plarea.height * (1.0 - place.zy1)));
|
ctx.line_to (scr_x, double.min (y, chart.plarea.y0 + chart.plarea.height * (1.0 - place.zy1)));
|
||||||
break;
|
break;
|
||||||
case Axis.Position.HIGH:
|
case Axis.Position.HIGH:
|
||||||
var print_y = chart.evarea.y0 + max_rec_height + axis_x.font_spacing + (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font_spacing);
|
var print_y = chart.evarea.y0 + max_rec_height + axis_x.font.vspacing + (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font.vspacing);
|
||||||
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);
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ namespace CairoChart {
|
||||||
if (axis_x.date_format != "") text_t.show();
|
if (axis_x.date_format != "") text_t.show();
|
||||||
var time_text_t = new Text(chart, time_text, axis_x.font, axis_x.color);
|
var time_text_t = new Text(chart, time_text, axis_x.font, 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.height + axis_x.font_spacing));
|
ctx.move_to (print_x, print_y - (axis_x.date_format == "" ? 0 : text_t.height + axis_x.font.vspacing));
|
||||||
if (axis_x.time_format != "") time_text_t.show();
|
if (axis_x.time_format != "") time_text_t.show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ namespace CairoChart {
|
||||||
var grid_style = grid.style;
|
var grid_style = grid.style;
|
||||||
if (joint_x) grid_style.color = Color(0, 0, 0, 0.5);
|
if (joint_x) grid_style.color = Color(0, 0, 0, 0.5);
|
||||||
grid_style.apply(chart);
|
grid_style.apply(chart);
|
||||||
double y = chart.evarea.y0 + max_rec_height + axis_x.font_spacing + (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font_spacing);
|
double y = chart.evarea.y0 + max_rec_height + axis_x.font.vspacing + (axis_x.title.text == "" ? 0 : axis_x.title.height + axis_x.font.vspacing);
|
||||||
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.y1);
|
ctx.line_to (scr_x, chart.plarea.y1);
|
||||||
|
@ -353,7 +353,7 @@ 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) {
|
||||||
var tmp = max_rec_height + s.axis_x.font_spacing;
|
var tmp = max_rec_height + s.axis_x.font.vspacing;
|
||||||
switch (s.axis_x.position) {
|
switch (s.axis_x.position) {
|
||||||
case Axis.Position.LOW: chart.evarea.y1 -= tmp; break;
|
case Axis.Position.LOW: chart.evarea.y1 -= tmp; break;
|
||||||
case Axis.Position.HIGH: chart.evarea.y0 += tmp; break;
|
case Axis.Position.HIGH: chart.evarea.y0 += tmp; break;
|
||||||
|
@ -365,8 +365,8 @@ namespace CairoChart {
|
||||||
var scr_x = chart.plarea.x0 + chart.plarea.width * (s.place.zx0 + s.place.zx1) / 2.0;
|
var scr_x = chart.plarea.x0 + chart.plarea.width * (s.place.zx0 + s.place.zx1) / 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.y1 - s.axis_x.font_spacing; break;
|
case Axis.Position.LOW: scr_y = chart.evarea.y1 - s.axis_x.font.vspacing; break;
|
||||||
case Axis.Position.HIGH: scr_y = chart.evarea.y0 + s.axis_x.font_spacing + axis_x.title.height; break;
|
case Axis.Position.HIGH: scr_y = chart.evarea.y0 + s.axis_x.font.vspacing + axis_x.title.height; break;
|
||||||
}
|
}
|
||||||
chart.ctx.move_to(scr_x - axis_x.title.width / 2.0, scr_y);
|
chart.ctx.move_to(scr_x - axis_x.title.width / 2.0, scr_y);
|
||||||
chart.color = s.axis_x.color;
|
chart.color = s.axis_x.color;
|
||||||
|
@ -383,7 +383,7 @@ namespace CairoChart {
|
||||||
|
|
||||||
if (nskip != 0) {--nskip; return;}
|
if (nskip != 0) {--nskip; return;}
|
||||||
|
|
||||||
var tmp = max_rec_height + s.axis_x.font_spacing + (s.axis_x.title.text == "" ? 0 : axis_x.title.height + s.axis_x.font_spacing);
|
var tmp = max_rec_height + s.axis_x.font.vspacing + (s.axis_x.title.text == "" ? 0 : axis_x.title.height + s.axis_x.font.vspacing);
|
||||||
switch (s.axis_x.position) {
|
switch (s.axis_x.position) {
|
||||||
case Axis.Position.LOW: chart.evarea.y1 -= tmp; break;
|
case Axis.Position.LOW: chart.evarea.y1 -= tmp; break;
|
||||||
case Axis.Position.HIGH: chart.evarea.y0 += tmp; break;
|
case Axis.Position.HIGH: chart.evarea.y0 += tmp; break;
|
||||||
|
@ -404,15 +404,15 @@ namespace CairoChart {
|
||||||
|
|
||||||
switch (axis_y.position) {
|
switch (axis_y.position) {
|
||||||
case Axis.Position.LOW:
|
case Axis.Position.LOW:
|
||||||
ctx.move_to (chart.evarea.x0 + max_rec_width - text_t.width + axis_y.font_spacing
|
ctx.move_to (chart.evarea.x0 + max_rec_width - text_t.width + axis_y.font.hspacing
|
||||||
+ (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font_spacing),
|
+ (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font.hspacing),
|
||||||
compact_rec_y_pos (y, text_t));
|
compact_rec_y_pos (y, text_t));
|
||||||
text_t.show();
|
text_t.show();
|
||||||
// 6. Draw grid lines to the place.zx0.
|
// 6. Draw grid lines to the place.zx0.
|
||||||
var grid_style = grid.style;
|
var grid_style = grid.style;
|
||||||
if (joint_y) grid_style.color = Color(0, 0, 0, 0.5);
|
if (joint_y) grid_style.color = Color(0, 0, 0, 0.5);
|
||||||
grid_style.apply(chart);
|
grid_style.apply(chart);
|
||||||
double x = chart.evarea.x0 + max_rec_width + axis_y.font_spacing + (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font_spacing);
|
double x = chart.evarea.x0 + max_rec_width + axis_y.font.hspacing + (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font.hspacing);
|
||||||
ctx.move_to (x, scr_y);
|
ctx.move_to (x, scr_y);
|
||||||
if (joint_y)
|
if (joint_y)
|
||||||
ctx.line_to (chart.plarea.x1, scr_y);
|
ctx.line_to (chart.plarea.x1, scr_y);
|
||||||
|
@ -420,15 +420,15 @@ namespace CairoChart {
|
||||||
ctx.line_to (double.max (x, chart.plarea.x0 + chart.plarea.width * place.zx1), scr_y);
|
ctx.line_to (double.max (x, chart.plarea.x0 + chart.plarea.width * place.zx1), scr_y);
|
||||||
break;
|
break;
|
||||||
case Axis.Position.HIGH:
|
case Axis.Position.HIGH:
|
||||||
ctx.move_to (chart.evarea.x1 - text_t.width - axis_y.font_spacing
|
ctx.move_to (chart.evarea.x1 - text_t.width - axis_y.font.hspacing
|
||||||
- (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font_spacing),
|
- (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font.hspacing),
|
||||||
compact_rec_y_pos (y, text_t));
|
compact_rec_y_pos (y, text_t));
|
||||||
text_t.show();
|
text_t.show();
|
||||||
// 6. Draw grid lines to the place.zx1.
|
// 6. Draw grid lines to the place.zx1.
|
||||||
var grid_style = grid.style;
|
var grid_style = grid.style;
|
||||||
if (joint_y) grid_style.color = Color(0, 0, 0, 0.5);
|
if (joint_y) grid_style.color = Color(0, 0, 0, 0.5);
|
||||||
grid_style.apply(chart);
|
grid_style.apply(chart);
|
||||||
double x = chart.evarea.x1 - max_rec_width - axis_y.font_spacing - (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font_spacing);
|
double x = chart.evarea.x1 - max_rec_width - axis_y.font.hspacing - (axis_y.title.text == "" ? 0 : axis_y.title.width + axis_y.font.hspacing);
|
||||||
ctx.move_to (x, scr_y);
|
ctx.move_to (x, scr_y);
|
||||||
if (joint_y)
|
if (joint_y)
|
||||||
ctx.line_to (chart.plarea.x0, scr_y);
|
ctx.line_to (chart.plarea.x0, scr_y);
|
||||||
|
@ -469,7 +469,7 @@ 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) {
|
||||||
var tmp = max_rec_width + s.axis_y.font_spacing;
|
var tmp = max_rec_width + s.axis_y.font.hspacing;
|
||||||
switch (s.axis_y.position) {
|
switch (s.axis_y.position) {
|
||||||
case Axis.Position.LOW: chart.evarea.x0 += tmp; break;
|
case Axis.Position.LOW: chart.evarea.x0 += tmp; break;
|
||||||
case Axis.Position.HIGH: chart.evarea.x1 -= tmp; break;
|
case Axis.Position.HIGH: chart.evarea.x1 -= tmp; break;
|
||||||
|
@ -481,11 +481,11 @@ namespace CairoChart {
|
||||||
var scr_y = chart.plarea.y0 + chart.plarea.height * (1.0 - (s.place.zy0 + s.place.zy1) / 2.0);
|
var scr_y = chart.plarea.y0 + chart.plarea.height * (1.0 - (s.place.zy0 + s.place.zy1) / 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.x0 + s.axis_y.font_spacing + axis_y.title.width;
|
var scr_x = chart.evarea.x0 + s.axis_y.font.hspacing + axis_y.title.width;
|
||||||
chart.ctx.move_to(scr_x, scr_y + axis_y.title.height / 2.0);
|
chart.ctx.move_to(scr_x, scr_y + axis_y.title.height / 2.0);
|
||||||
break;
|
break;
|
||||||
case Axis.Position.HIGH:
|
case Axis.Position.HIGH:
|
||||||
var scr_x = chart.evarea.x1 - s.axis_y.font_spacing;
|
var scr_x = chart.evarea.x1 - s.axis_y.font.hspacing;
|
||||||
chart.ctx.move_to(scr_x, scr_y + axis_y.title.height / 2.0);
|
chart.ctx.move_to(scr_x, scr_y + axis_y.title.height / 2.0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -503,7 +503,7 @@ namespace CairoChart {
|
||||||
|
|
||||||
if (nskip != 0) {--nskip; return;}
|
if (nskip != 0) {--nskip; return;}
|
||||||
|
|
||||||
var tmp = max_rec_width + s.axis_y.font_spacing + (s.axis_y.title.text == "" ? 0 : axis_y.title.width + s.axis_y.font_spacing);
|
var tmp = max_rec_width + s.axis_y.font.hspacing + (s.axis_y.title.text == "" ? 0 : axis_y.title.width + s.axis_y.font.hspacing);
|
||||||
switch (s.axis_y.position) {
|
switch (s.axis_y.position) {
|
||||||
case Axis.Position.LOW: chart.evarea.x0 += tmp; break;
|
case Axis.Position.LOW: chart.evarea.x0 += tmp; break;
|
||||||
case Axis.Position.HIGH: chart.evarea.x1 -= tmp; break;
|
case Axis.Position.HIGH: chart.evarea.x1 -= tmp; break;
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace CairoChart {
|
||||||
var text = new Text (chart);
|
var text = new Text (chart);
|
||||||
text.chart = this.chart;
|
text.chart = this.chart;
|
||||||
text.text = this.text;
|
text.text = this.text;
|
||||||
text.font = this.font;
|
text.font = this.font.copy();
|
||||||
text._ext = this._ext;
|
text._ext = this._ext;
|
||||||
text.color = this.color;
|
text.color = this.color;
|
||||||
return text;
|
return text;
|
||||||
|
|
Loading…
Reference in New Issue