join relative x-axes with non-intersect places
This commit is contained in:
parent
a7aa97bea5
commit
db93ad0bd3
|
@ -232,6 +232,45 @@ namespace CairoChart {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void join_relative_x_axes (Series s,
|
||||||
|
int si,
|
||||||
|
bool calc_max_values,
|
||||||
|
ref double max_rec_width,
|
||||||
|
ref double max_rec_height,
|
||||||
|
ref double max_font_indent,
|
||||||
|
ref double max_axis_font_height,
|
||||||
|
ref int nskip) {
|
||||||
|
for (int sj = si - 1; sj >= 0; --sj) {
|
||||||
|
var s2 = series[sj];
|
||||||
|
if (!s2.zoom_show) continue;
|
||||||
|
bool has_intersection = false;
|
||||||
|
for (int sk = si; sk > sj; --sk) {
|
||||||
|
var s3 = series[sk];
|
||||||
|
if (!s3.zoom_show) continue;
|
||||||
|
if (math.are_intersect(s2.place.zoom_x_min, s2.place.zoom_x_max, s3.place.zoom_x_min, s3.place.zoom_x_max)
|
||||||
|
|| s2.axis_x.position != s3.axis_x.position
|
||||||
|
|| s2.axis_x.type != s3.axis_x.type) {
|
||||||
|
has_intersection = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!has_intersection) {
|
||||||
|
if (calc_max_values) {
|
||||||
|
double tmp_max_rec_width = 0; double tmp_max_rec_height = 0;
|
||||||
|
s2.axis_x.calc_rec_sizes (this, 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_height = double.max (max_rec_height, tmp_max_rec_height);
|
||||||
|
max_font_indent = double.max (max_font_indent, s2.axis_x.font_indent);
|
||||||
|
max_axis_font_height = double.max (max_axis_font_height, s2.axis_x.title.text == "" ? 0 :
|
||||||
|
s2.axis_x.title.get_height(context) + s.axis_x.font_indent);
|
||||||
|
}
|
||||||
|
++nskip;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void calc_plot_area () {
|
protected virtual void calc_plot_area () {
|
||||||
plot_x_min = cur_x_min + legend.indent;
|
plot_x_min = cur_x_min + legend.indent;
|
||||||
plot_x_max = cur_x_max - legend.indent;
|
plot_x_max = cur_x_max - legend.indent;
|
||||||
|
@ -260,34 +299,7 @@ namespace CairoChart {
|
||||||
var max_font_indent = s.axis_x.font_indent;
|
var max_font_indent = s.axis_x.font_indent;
|
||||||
var max_axis_font_height = s.axis_x.title.text == "" ? 0 : s.axis_x.title.get_height(context) + s.axis_x.font_indent;
|
var max_axis_font_height = s.axis_x.title.text == "" ? 0 : s.axis_x.title.get_height(context) + s.axis_x.font_indent;
|
||||||
|
|
||||||
// join relative x-axes with non-intersect places
|
join_relative_x_axes (s, si, true, ref max_rec_width, ref max_rec_height, ref max_font_indent, ref max_axis_font_height, ref nskip);
|
||||||
for (int sj = si - 1; sj >= 0; --sj) {
|
|
||||||
var s2 = series[sj];
|
|
||||||
if (!s2.zoom_show) continue;
|
|
||||||
bool has_intersection = false;
|
|
||||||
for (int sk = si; sk > sj; --sk) {
|
|
||||||
var s3 = series[sk];
|
|
||||||
if (!s3.zoom_show) continue;
|
|
||||||
if (math.are_intersect(s2.place.zoom_x_min, s2.place.zoom_x_max, s3.place.zoom_x_min, s3.place.zoom_x_max)
|
|
||||||
|| s2.axis_x.position != s3.axis_x.position
|
|
||||||
|| s2.axis_x.type != s3.axis_x.type) {
|
|
||||||
has_intersection = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!has_intersection) {
|
|
||||||
double tmp_max_rec_width = 0; double tmp_max_rec_height = 0;
|
|
||||||
s2.axis_x.calc_rec_sizes (this, 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_height = double.max (max_rec_height, tmp_max_rec_height);
|
|
||||||
max_font_indent = double.max (max_font_indent, s2.axis_x.font_indent);
|
|
||||||
max_axis_font_height = double.max (max_axis_font_height, s2.axis_x.title.text == "" ? 0 :
|
|
||||||
s2.axis_x.title.get_height(context) + s.axis_x.font_indent);
|
|
||||||
++nskip;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// for 4.2. Cursor values for joint X axis
|
// for 4.2. Cursor values for joint X axis
|
||||||
if (joint_x && si == zoom_first_show && cursor_style.orientation == Cursor.Orientation.VERTICAL && cursors_crossings.length != 0) {
|
if (joint_x && si == zoom_first_show && cursor_style.orientation == Cursor.Orientation.VERTICAL && cursors_crossings.length != 0) {
|
||||||
|
@ -314,7 +326,7 @@ namespace CairoChart {
|
||||||
var max_font_indent = s.axis_y.font_indent;
|
var max_font_indent = s.axis_y.font_indent;
|
||||||
var max_axis_font_width = s.axis_y.title.text == "" ? 0 : s.axis_y.title.get_width(context) + s.axis_y.font_indent;
|
var max_axis_font_width = s.axis_y.title.text == "" ? 0 : s.axis_y.title.get_width(context) + s.axis_y.font_indent;
|
||||||
|
|
||||||
// join relative x-axes with non-intersect places
|
// join relative y-axes with non-intersect places
|
||||||
for (int sj = si - 1; sj >= 0; --sj) {
|
for (int sj = si - 1; sj >= 0; --sj) {
|
||||||
var s2 = series[sj];
|
var s2 = series[sj];
|
||||||
if (!s2.zoom_show) continue;
|
if (!s2.zoom_show) continue;
|
||||||
|
@ -324,7 +336,7 @@ namespace CairoChart {
|
||||||
if (!s3.zoom_show) continue;
|
if (!s3.zoom_show) continue;
|
||||||
if (math.are_intersect(s2.place.zoom_y_min, s2.place.zoom_y_max, s3.place.zoom_y_min, s3.place.zoom_y_max)
|
if (math.are_intersect(s2.place.zoom_y_min, s2.place.zoom_y_max, s3.place.zoom_y_min, s3.place.zoom_y_max)
|
||||||
|| s2.axis_y.position != s3.axis_y.position
|
|| s2.axis_y.position != s3.axis_y.position
|
||||||
|| s2.axis_x.type != s3.axis_x.type) {
|
|| s2.axis_y.type != s3.axis_y.type) {
|
||||||
has_intersection = true;
|
has_intersection = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -502,27 +514,8 @@ namespace CairoChart {
|
||||||
}
|
}
|
||||||
context.stroke ();
|
context.stroke ();
|
||||||
|
|
||||||
// join relative x-axes with non-intersect places
|
double tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp4 = 0;
|
||||||
for (int sj = si - 1; sj >= 0; --sj) {
|
join_relative_x_axes (s, si, false, ref tmp1, ref tmp2, ref tmp3, ref tmp4, ref nskip);
|
||||||
var s2 = series[sj];
|
|
||||||
if (!s2.zoom_show) continue;
|
|
||||||
bool has_intersection = false;
|
|
||||||
for (int sk = si; sk > sj; --sk) {
|
|
||||||
var s3 = series[sk];
|
|
||||||
if (!s3.zoom_show) continue;
|
|
||||||
if (math.are_intersect(s2.place.zoom_x_min, s2.place.zoom_x_max, s3.place.zoom_x_min, s3.place.zoom_x_max)
|
|
||||||
|| s2.axis_x.position != s3.axis_x.position
|
|
||||||
|| s2.axis_x.type != s3.axis_x.type) {
|
|
||||||
has_intersection = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!has_intersection) {
|
|
||||||
++nskip;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nskip != 0) {--nskip; continue;}
|
if (nskip != 0) {--nskip; continue;}
|
||||||
|
|
||||||
|
@ -641,7 +634,7 @@ namespace CairoChart {
|
||||||
}
|
}
|
||||||
context.stroke ();
|
context.stroke ();
|
||||||
|
|
||||||
// join relative x-axes with non-intersect places
|
// join relative y-axes with non-intersect places
|
||||||
for (int sj = si - 1; sj >= 0; --sj) {
|
for (int sj = si - 1; sj >= 0; --sj) {
|
||||||
var s2 = series[sj];
|
var s2 = series[sj];
|
||||||
if (!s2.zoom_show) continue;
|
if (!s2.zoom_show) continue;
|
||||||
|
|
Loading…
Reference in New Issue