Join axes...

This commit is contained in:
Kolan Sh 2018-01-15 13:12:42 +03:00
parent 73b0ebdcb0
commit a7aa97bea5
2 changed files with 27 additions and 14 deletions

View File

@ -242,22 +242,11 @@ namespace CairoChart {
joint_x = joint_y = true; joint_x = joint_y = true;
int nzoom_series_show = 0; int nzoom_series_show = 0;
for (var si = series.length - 1; si >=0; --si) { for (var si = series.length - 1; si >=0; --si) {
var s = series[si]; var s = series[si], s0 = series[0];
if (!s.zoom_show) continue; if (!s.zoom_show) continue;
++nzoom_series_show; ++nzoom_series_show;
if ( s.axis_x.position != series[0].axis_x.position if (!s.equal_x_axis(s0)) joint_x = false;
|| s.axis_x.zoom_min != series[0].axis_x.zoom_min if (!s.equal_y_axis(s0)) joint_y = false;
|| s.axis_x.zoom_max != series[0].axis_x.zoom_max
|| s.place.zoom_x_min != series[0].place.zoom_x_min
|| s.place.zoom_x_max != series[0].place.zoom_x_max
|| s.axis_x.type != series[0].axis_x.type)
joint_x = false;
if ( s.axis_y.position != series[0].axis_y.position
|| s.axis_y.zoom_min != series[0].axis_y.zoom_min
|| s.axis_y.zoom_max != series[0].axis_y.zoom_max
|| s.place.zoom_y_min != series[0].place.zoom_y_min
|| s.place.zoom_y_max != series[0].place.zoom_y_max)
joint_y = false;
} }
if (nzoom_series_show == 1) joint_x = joint_y = false; if (nzoom_series_show == 1) joint_x = joint_y = false;

View File

@ -85,5 +85,29 @@ namespace CairoChart {
marker.draw_at_pos(chart, x, y); marker.draw_at_pos(chart, x, y);
} }
} }
public virtual bool equal_x_axis (Series s) {
if ( axis_x.position != s.axis_x.position
|| axis_x.zoom_min != s.axis_x.zoom_min
|| axis_x.zoom_max != s.axis_x.zoom_max
|| place.zoom_x_min != s.place.zoom_x_min
|| place.zoom_x_max != s.place.zoom_x_max
|| axis_x.type != s.axis_x.type
)
return false;
return true;
}
public virtual bool equal_y_axis (Series s) {
if ( axis_y.position != s.axis_y.position
|| axis_y.zoom_min != s.axis_y.zoom_min
|| axis_y.zoom_max != s.axis_y.zoom_max
|| place.zoom_y_min != s.place.zoom_y_min
|| place.zoom_y_max != s.place.zoom_y_max
|| axis_y.type != s.axis_y.type
)
return false;
return true;
}
} }
} }