OK In progress...

This commit is contained in:
Kolan Sh 2018-01-18 13:52:06 +03:00
parent cb90a82119
commit ada0922c69
5 changed files with 83 additions and 78 deletions

View File

@ -8,7 +8,19 @@ namespace CairoChart {
/** /**
* Chart Position. * Chart Position.
*/ */
public Cairo.Rectangle pos = Cairo.Rectangle(); public Cairo.Rectangle area = Cairo.Rectangle();
/**
* Current evaluated area.
*/
public Cairo.Rectangle evarea = Cairo.Rectangle()
{ x = 0, y = 0, width = 1, height = 1 };
/**
* Zoom Limits (relative coordinates: 0.0-1.0).
*/
public Cairo.Rectangle zoom = Cairo.Rectangle()
{ x = 0, y = 0, width = 1, height = 1 };
/** /**
* Cairo Context of the Drawing Area. * Cairo Context of the Drawing Area.
@ -20,38 +32,26 @@ namespace CairoChart {
*/ */
public Color bg_color = Color(1, 1, 1); public Color bg_color = Color(1, 1, 1);
/**
* Chart Title.
*/
public Text title = new Text ("Cairo Chart");
/** /**
* Border Color. * Border Color.
*/ */
public Color border_color = Color(0, 0, 0, 0.3); public Color border_color = Color(0, 0, 0, 0.3);
/**
* Chart Title.
*/
public Text title = new Text("Cairo Chart");
/** /**
* Legend. * Legend.
*/ */
public Legend legend = new Legend (); public Legend legend = new Legend();
/** /**
* Chart Series. * Chart Series.
*/ */
public Series[] series = {}; public Series[] series = {};
/**
* Current calculated Plot Position.
*/
public Cairo.Rectangle calc_pos = Cairo.Rectangle()
{ x = 0, y = 0, width = 1, height = 1 };
/**
* Zoom Limits (relative coordinates: 0.0-1.0).
*/
public Cairo.Rectangle zoom = Cairo.Rectangle()
{ x = 0, y = 0, width = 1, height = 1 };
/** /**
* 1'st shown series index in zoom area. * 1'st shown series index in zoom area.
*/ */
@ -61,6 +61,11 @@ namespace CairoChart {
public Line.Style selection_style = Line.Style (); public Line.Style selection_style = Line.Style ();
/**
* Plot Area Bounds.
*/
//public Cairo.Rectangle plot = ;
public double plot_x_min = 0; public double plot_x_min = 0;
public double plot_x_max = 0; public double plot_x_max = 0;
public double plot_y_min = 0; public double plot_y_min = 0;
@ -88,7 +93,7 @@ namespace CairoChart {
chart.joint_x = this.joint_x; chart.joint_x = this.joint_x;
chart.joint_y = this.joint_y; chart.joint_y = this.joint_y;
chart.ctx = this.ctx; chart.ctx = this.ctx;
chart.calc_pos = this.calc_pos; chart.evarea = this.evarea;
chart.cursors = this.cursors.copy(); chart.cursors = this.cursors.copy();
chart.legend = this.legend.copy(); chart.legend = this.legend.copy();
chart.plot_x_max = this.plot_x_max; chart.plot_x_max = this.plot_x_max;
@ -100,14 +105,14 @@ namespace CairoChart {
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_indent = this.title_indent;
chart.pos = this.pos; chart.area = this.area;
chart.zoom_1st_idx = this.zoom_1st_idx; chart.zoom_1st_idx = this.zoom_1st_idx;
return chart; return chart;
} }
protected virtual void fix_calc_pos () { protected virtual void fix_evarea () {
if (calc_pos.width < 0) calc_pos.width = 0; if (evarea.width < 0) evarea.width = 0;
if (calc_pos.height < 0) calc_pos.height = 0; if (evarea.height < 0) evarea.height = 0;
} }
protected virtual void set_vertical_axes_titles () { protected virtual void set_vertical_axes_titles () {
for (var si = 0; si < series.length; ++si) { for (var si = 0; si < series.length; ++si) {
@ -126,13 +131,13 @@ namespace CairoChart {
public virtual bool draw () { public virtual bool draw () {
calc_pos = pos; evarea = area;
draw_chart_title (); draw_chart_title ();
fix_calc_pos (); fix_evarea ();
legend.draw (this); legend.draw (this);
fix_calc_pos (); fix_evarea ();
set_vertical_axes_titles (); set_vertical_axes_titles ();
@ -141,29 +146,29 @@ namespace CairoChart {
calc_plot_area (); calc_plot_area ();
draw_horizontal_axes (); draw_horizontal_axes ();
fix_calc_pos (); fix_evarea ();
draw_vertical_axes (); draw_vertical_axes ();
fix_calc_pos (); fix_evarea ();
draw_plot_area_border (); draw_plot_area_border ();
fix_calc_pos (); fix_evarea ();
draw_series (); draw_series ();
fix_calc_pos (); fix_evarea ();
cursors.draw_cursors (this); cursors.draw_cursors (this);
fix_calc_pos (); fix_evarea ();
return true; return true;
} }
protected virtual void draw_chart_title () { protected virtual void draw_chart_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_indent * 2 : title_indent);
calc_pos.y += title_height; evarea.y += title_height;
calc_pos.height -= title_height; evarea.height -= title_height;
color = title.color; color = title.color;
ctx.move_to (pos.width/2 - sz.width/2, sz.height + title_indent); ctx.move_to (area.width/2 - sz.width/2, sz.height + title_indent);
title.show(ctx); title.show(ctx);
} }
public virtual void draw_selection (Cairo.Rectangle rect) { public virtual void draw_selection (Cairo.Rectangle rect) {
@ -298,10 +303,10 @@ namespace CairoChart {
series[si].join_calc(is_x, si, ref nskip); series[si].join_calc(is_x, si, ref nskip);
} }
protected virtual void calc_plot_area () { protected virtual void calc_plot_area () {
plot_x_min = calc_pos.x + legend.indent; plot_x_min = evarea.x + legend.indent;
plot_x_max = calc_pos.x + calc_pos.width - legend.indent; plot_x_max = evarea.x + evarea.width - legend.indent;
plot_y_min = calc_pos.y + legend.indent; plot_y_min = evarea.y + legend.indent;
plot_y_max = calc_pos.y + calc_pos.height - legend.indent; plot_y_max = evarea.y + evarea.height - legend.indent;
// Check for joint axes // Check for joint axes
joint_x = joint_y = true; joint_x = joint_y = true;

View File

@ -301,13 +301,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.pos.y + chart.pos.height - s.axis_x.font_indent case Axis.Position.LOW: print_y = chart.area.y + chart.area.height - s.axis_x.font_indent
- (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_indent * 2 : chart.title_indent);
print_y = chart.pos.y + title_height + s.axis_x.font_indent print_y = chart.area.y + title_height + s.axis_x.font_indent
+ (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:
@ -351,11 +351,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.pos.x + s.axis_y.font_indent print_x = chart.area.x + s.axis_y.font_indent
+ (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.pos.x + chart.pos.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_indent
- (chart.legend.position == Legend.Position.RIGHT ? chart.legend.width : 0); - (chart.legend.position == Legend.Position.RIGHT ? chart.legend.width : 0);
break; break;
} }

View File

@ -51,25 +51,25 @@ namespace CairoChart {
if (chart.ctx != null) { if (chart.ctx != null) {
switch (position) { switch (position) {
case Position.TOP: case Position.TOP:
x0 = (chart.pos.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_indent * 2 : chart.title_indent);
y0 = title_height; y0 = title_height;
break; break;
case Position.BOTTOM: case Position.BOTTOM:
x0 = (chart.pos.width - width) / 2; x0 = (chart.area.width - width) / 2;
y0 = chart.pos.height - height; y0 = chart.area.height - height;
break; break;
case Position.LEFT: case Position.LEFT:
x0 = 0; x0 = 0;
y0 = (chart.pos.height - height) / 2; y0 = (chart.area.height - height) / 2;
break; break;
case Position.RIGHT: case Position.RIGHT:
x0 = chart.pos.width - width; x0 = chart.area.width - width;
y0 = (chart.pos.height - height) / 2; y0 = (chart.area.height - height) / 2;
break; break;
} }
chart.color = bg_color; chart.color = bg_color;
@ -122,7 +122,7 @@ namespace CairoChart {
case Position.TOP: case Position.TOP:
case Position.BOTTOM: case Position.BOTTOM:
var ser_title_width = title_sz.width + line_length; var ser_title_width = title_sz.width + line_length;
if (leg_width_sum + (leg_width_sum == 0 ? 0 : text_hspace) + ser_title_width > chart.pos.width) { // carry if (leg_width_sum + (leg_width_sum == 0 ? 0 : text_hspace) + ser_title_width > chart.area.width) { // carry
leg_height_sum += max_font_h; leg_height_sum += max_font_h;
switch (process_type) { switch (process_type) {
case ProcessType.CALC: case ProcessType.CALC:
@ -203,18 +203,18 @@ namespace CairoChart {
height = leg_height_sum; height = leg_height_sum;
switch (position) { switch (position) {
case Position.TOP: case Position.TOP:
chart.calc_pos.y += height; chart.evarea.y += height;
chart.calc_pos.height -= height; chart.evarea.height -= height;
break; break;
case Position.BOTTOM: case Position.BOTTOM:
chart.calc_pos.height -= height; chart.evarea.height -= height;
break; break;
case Position.LEFT: case Position.LEFT:
chart.calc_pos.x += width; chart.evarea.x += width;
chart.calc_pos.width -= width; chart.evarea.width -= width;
break; break;
case Position.RIGHT: case Position.RIGHT:
chart.calc_pos.width -= width; chart.evarea.width -= width;
break; break;
} }
break; break;

View File

@ -258,7 +258,7 @@ namespace CairoChart {
switch (axis_x.position) { switch (axis_x.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
var print_y = chart.calc_pos.y + chart.calc_pos.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_indent - (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_indent);
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) {
@ -277,7 +277,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.calc_pos.y + chart.calc_pos.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_indent - (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_indent);
ctx.move_to (scr_x, y); ctx.move_to (scr_x, y);
if (joint_x) if (joint_x)
ctx.line_to (scr_x, chart.plot_y_min); ctx.line_to (scr_x, chart.plot_y_min);
@ -285,7 +285,7 @@ namespace CairoChart {
ctx.line_to (scr_x, double.min (y, chart.plot_y_max - (chart.plot_y_max - chart.plot_y_min) * place.zoom_y_max)); ctx.line_to (scr_x, double.min (y, chart.plot_y_max - (chart.plot_y_max - chart.plot_y_min) * place.zoom_y_max));
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
var print_y = chart.calc_pos.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_indent + (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_indent);
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);
@ -305,7 +305,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.calc_pos.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_indent + (axis_x.title.text == "" ? 0 : sz.height + axis_x.font_indent);
ctx.move_to (scr_x, y); ctx.move_to (scr_x, y);
if (joint_x) if (joint_x)
ctx.line_to (scr_x, chart.plot_y_max); ctx.line_to (scr_x, chart.plot_y_max);
@ -348,8 +348,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.calc_pos.height -= max_rec_height + s.axis_x.font_indent; break; case Axis.Position.LOW: chart.evarea.height -= max_rec_height + s.axis_x.font_indent; break;
case Axis.Position.HIGH: var tmp = max_rec_height + s.axis_x.font_indent; chart.calc_pos.y += tmp; chart.calc_pos.height -= tmp; break; case Axis.Position.HIGH: var tmp = max_rec_height + s.axis_x.font_indent; chart.evarea.y += tmp; chart.evarea.height -= tmp; break;
} }
} }
@ -360,8 +360,8 @@ namespace CairoChart {
var scr_x = chart.plot_x_min + (chart.plot_x_max - chart.plot_x_min) * (s.place.zoom_x_min + s.place.zoom_x_max) / 2.0; var scr_x = chart.plot_x_min + (chart.plot_x_max - chart.plot_x_min) * (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.calc_pos.y + chart.calc_pos.height - s.axis_x.font_indent; break; case Axis.Position.LOW: scr_y = chart.evarea.y + chart.evarea.height - s.axis_x.font_indent; break;
case Axis.Position.HIGH: scr_y = chart.calc_pos.y + s.axis_x.font_indent + sz.height; break; case Axis.Position.HIGH: scr_y = chart.evarea.y + s.axis_x.font_indent + 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;
@ -380,12 +380,12 @@ namespace CairoChart {
switch (s.axis_x.position) { switch (s.axis_x.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
chart.calc_pos.height -= max_rec_height + s.axis_x.font_indent chart.evarea.height -= max_rec_height + s.axis_x.font_indent
+ (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_indent);
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_indent + (s.axis_x.title.text == "" ? 0 : sz.height + s.axis_x.font_indent);
chart.calc_pos.y += tmp; chart.calc_pos.height -= tmp; chart.evarea.y += tmp; chart.evarea.height -= tmp;
break; break;
} }
} }
@ -406,7 +406,7 @@ namespace CairoChart {
switch (axis_y.position) { switch (axis_y.position) {
case Axis.Position.LOW: case Axis.Position.LOW:
ctx.move_to (chart.calc_pos.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_indent
+ (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent), + (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent),
compact_rec_y_pos (y, text_t)); compact_rec_y_pos (y, text_t));
text_t.show(ctx); text_t.show(ctx);
@ -414,7 +414,7 @@ namespace CairoChart {
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.calc_pos.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_indent + (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent);
ctx.move_to (x, scr_y); ctx.move_to (x, scr_y);
if (joint_y) if (joint_y)
ctx.line_to (chart.plot_x_max, scr_y); ctx.line_to (chart.plot_x_max, scr_y);
@ -422,7 +422,7 @@ namespace CairoChart {
ctx.line_to (double.max (x, chart.plot_x_min + (chart.plot_x_max - chart.plot_x_min) * place.zoom_x_max), scr_y); ctx.line_to (double.max (x, chart.plot_x_min + (chart.plot_x_max - chart.plot_x_min) * place.zoom_x_max), scr_y);
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
ctx.move_to (chart.calc_pos.x + chart.calc_pos.width - text_sz.width - axis_y.font_indent ctx.move_to (chart.evarea.x + chart.evarea.width - text_sz.width - axis_y.font_indent
- (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent), - (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent),
compact_rec_y_pos (y, text_t)); compact_rec_y_pos (y, text_t));
text_t.show(ctx); text_t.show(ctx);
@ -430,7 +430,7 @@ namespace CairoChart {
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.calc_pos.x + chart.calc_pos.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_indent - (axis_y.title.text == "" ? 0 : sz.width + axis_y.font_indent);
ctx.move_to (x, scr_y); ctx.move_to (x, scr_y);
if (joint_y) if (joint_y)
ctx.line_to (chart.plot_x_min, scr_y); ctx.line_to (chart.plot_x_min, scr_y);
@ -472,8 +472,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.calc_pos.x += tmp; chart.calc_pos.width -= tmp; break; 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.HIGH: chart.calc_pos.width -= max_rec_width + s.axis_y.font_indent; break; case Axis.Position.HIGH: chart.evarea.width -= max_rec_width + s.axis_y.font_indent; break;
} }
} }
@ -484,11 +484,11 @@ namespace CairoChart {
var scr_y = chart.plot_y_max - (chart.plot_y_max - chart.plot_y_min) * (s.place.zoom_y_min + s.place.zoom_y_max) / 2.0; var scr_y = chart.plot_y_max - (chart.plot_y_max - chart.plot_y_min) * (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.calc_pos.x + s.axis_y.font_indent + sz.width; var scr_x = chart.evarea.x + s.axis_y.font_indent + 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.calc_pos.x + chart.calc_pos.width - s.axis_y.font_indent; var scr_x = chart.evarea.x + chart.evarea.width - s.axis_y.font_indent;
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;
} }
@ -509,10 +509,10 @@ 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_indent + (s.axis_y.title.text == "" ? 0 : sz.width + s.axis_y.font_indent);
chart.calc_pos.x += tmp; chart.calc_pos.width -= tmp; chart.evarea.x += tmp; chart.evarea.width -= tmp;
break; break;
case Axis.Position.HIGH: case Axis.Position.HIGH:
chart.calc_pos.width -= max_rec_width + s.axis_y.font_indent chart.evarea.width -= max_rec_width + s.axis_y.font_indent
+ (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_indent); break;
} }
} }

View File

@ -415,8 +415,8 @@ int main (string[] args) {
da.draw.connect((ctx) => { da.draw.connect((ctx) => {
chart.ctx = ctx; chart.ctx = ctx;
chart.pos.width = da.get_allocated_width(); chart.area.width = da.get_allocated_width();
chart.pos.height = da.get_allocated_height(); chart.area.height = da.get_allocated_height();
chart.clear(); chart.clear();
// user's pre draw operations here... // user's pre draw operations here...