OK In progress...

This commit is contained in:
Kolan Sh 2018-01-18 12:55:20 +03:00
parent 2d1f588393
commit cb90a82119
3 changed files with 9 additions and 9 deletions

View File

@ -57,9 +57,6 @@ namespace CairoChart {
*/
public int zoom_1st_idx { get; protected set; default = 0; }
public double title_width { get; protected set; default = 0.0; }
public double title_height { get; protected set; default = 0.0; }
public double title_indent = 4;
public Line.Style selection_style = Line.Style ();
@ -102,9 +99,7 @@ namespace CairoChart {
chart.selection_style = this.selection_style;
chart.series = this.series;
chart.title = this.title.copy();
chart.title_height = this.title_height;
chart.title_indent = this.title_indent;
chart.title_width = this.title_width;
chart.pos = this.pos;
chart.zoom_1st_idx = this.zoom_1st_idx;
return chart;
@ -164,7 +159,7 @@ namespace CairoChart {
}
protected virtual void draw_chart_title () {
var sz = title.get_size(ctx);
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;
calc_pos.height -= title_height;
color = title.color;

View File

@ -304,8 +304,11 @@ namespace CairoChart {
case Axis.Position.LOW: print_y = chart.pos.y + chart.pos.height - s.axis_x.font_indent
- (chart.legend.position == Legend.Position.BOTTOM ? chart.legend.height : 0);
break;
case Axis.Position.HIGH: print_y = chart.pos.y + chart.title_height + s.axis_x.font_indent
+ (chart.legend.position == Legend.Position.TOP ? chart.legend.height : 0);
case Axis.Position.HIGH:
var title_height = chart.title.get_height(chart.ctx) + (chart.legend.position == Legend.Position.TOP ?
chart.title_indent * 2 : chart.title_indent);
print_y = chart.pos.y + title_height + s.axis_x.font_indent
+ (chart.legend.position == Legend.Position.TOP ? chart.legend.height : 0);
switch (s.axis_x.type) {
case Axis.Type.NUMBERS:
print_y += sz.height;

View File

@ -52,7 +52,9 @@ namespace CairoChart {
switch (position) {
case Position.TOP:
x0 = (chart.pos.width - width) / 2;
y0 = chart.title_height;
var title_height = chart.title.get_height(chart.ctx) + (chart.legend.position == Legend.Position.TOP ?
chart.title_indent * 2 : chart.title_indent);
y0 = title_height;
break;
case Position.BOTTOM: