OK In progress...

This commit is contained in:
Kolan Sh 2018-01-23 09:46:26 +03:00
parent 796cabe307
commit ee6dde9731
3 changed files with 26 additions and 10 deletions

View File

@ -353,10 +353,10 @@ namespace CairoChart {
if (nshow == 1) joint_x = joint_y = false; if (nshow == 1) joint_x = joint_y = false;
for (var si = series.length - 1, nskip = 0; si >= 0; --si) for (var si = series.length - 1, nskip = 0; si >= 0; --si)
series[si].join_axes(true, si, ref nskip); series[si].join_axes(true, ref nskip);
for (var si = series.length - 1, nskip = 0; si >= 0; --si) for (var si = series.length - 1, nskip = 0; si >= 0; --si)
series[si].join_axes(false, si, ref nskip); series[si].join_axes(false, ref nskip);
} }
protected virtual void draw_plarea_border () { protected virtual void draw_plarea_border () {
@ -374,11 +374,11 @@ namespace CairoChart {
} }
protected virtual void draw_haxes () { protected virtual void draw_haxes () {
for (var si = series.length - 1, nskip = 0; si >=0; --si) for (var si = series.length - 1, nskip = 0; si >=0; --si)
series[si].draw_horizontal_axis (si, ref nskip); series[si].draw_horizontal_axis (ref nskip);
} }
protected virtual void draw_vaxes () { protected virtual void draw_vaxes () {
for (var si = series.length - 1, nskip = 0; si >=0; --si) for (var si = series.length - 1, nskip = 0; si >=0; --si)
series[si].draw_vertical_axis (si, ref nskip); series[si].draw_vertical_axis (ref nskip);
} }
protected virtual void draw_series () { protected virtual void draw_series () {
foreach (var s in series) foreach (var s in series)

View File

@ -149,5 +149,13 @@ namespace CairoChart {
} }
return points; return points;
} }
internal int find_arr<G> (G[] arr, G elem) {
for (var i = 0; i < arr.length; ++i) {
if (arr[i] == elem)
return i;
}
return -1;
}
} }
} }

View File

@ -157,10 +157,9 @@ namespace CairoChart {
/** /**
* Joins equal axes. * Joins equal axes.
* @param is_x is this X-axis or not. * @param is_x is this X-axis or not.
* @param si series index.
* @param nskip returns number of series to skip printing. * @param nskip returns number of series to skip printing.
*/ */
public virtual void join_axes (bool is_x, int si, ref int nskip) { public virtual void join_axes (bool is_x, ref int nskip) {
Axis axis = axis_x; Axis axis = axis_x;
if (!is_x) axis = axis_y; if (!is_x) axis = axis_y;
if (!zoom_show) return; if (!zoom_show) return;
@ -171,6 +170,9 @@ namespace CairoChart {
var max_axis_font_width = axis.title.text == "" ? 0 : axis.title.width + axis.font.hspacing; 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.vspacing; var max_axis_font_height = axis.title.text == "" ? 0 : axis.title.height + axis.font.vspacing;
var si = Math.find_arr<Series>(chart.series, this);
if (si == -1) return;
if (is_x) if (is_x)
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); 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
@ -217,11 +219,14 @@ namespace CairoChart {
/** /**
* Draws horizontal axis. * Draws horizontal axis.
* @param si series index.
* @param nskip number of series to skip printing. * @param nskip number of series to skip printing.
*/ */
public virtual void draw_horizontal_axis (int si, ref int nskip) { public virtual void draw_horizontal_axis (ref int nskip) {
if (!zoom_show) return; if (!zoom_show) return;
var si = Math.find_arr<Series>(chart.series, this);
if (si == -1) return;
if (chart.joint_x && si != chart.zoom_1st_idx) return; if (chart.joint_x && si != chart.zoom_1st_idx) return;
// 1. Detect max record width/height by axis.nrecords equally selected points using format. // 1. Detect max record width/height by axis.nrecords equally selected points using format.
@ -289,11 +294,14 @@ namespace CairoChart {
/** /**
* Draws vertical axis. * Draws vertical axis.
* @param si series index.
* @param nskip number of series to skip printing. * @param nskip number of series to skip printing.
*/ */
public virtual void draw_vertical_axis (int si, ref int nskip) { public virtual void draw_vertical_axis (ref int nskip) {
if (!zoom_show) return; if (!zoom_show) return;
var si = Math.find_arr<Series>(chart.series, this);
if (si == -1) return;
if (chart.joint_y && si != chart.zoom_1st_idx) return; if (chart.joint_y && si != chart.zoom_1st_idx) return;
// 1. Detect max record width/height by axis.nrecords equally selected points using format. // 1. Detect max record width/height by axis.nrecords equally selected points using format.
double max_rec_width, max_rec_height; double max_rec_width, max_rec_height;