In progress...

This commit is contained in:
Kolan Sh 2018-01-15 16:18:47 +03:00
parent 328a579ad7
commit dcfb85126e
2 changed files with 6 additions and 6 deletions

View File

@ -110,13 +110,13 @@ namespace CairoChart {
time = dt.format(time_format) + dsec_str; time = dt.format(time_format) + dsec_str;
} }
public virtual void calc_rec_sizes (Chart chart, out double max_rec_width, out double max_rec_height, bool is_horizontal = true) { public virtual void calc_rec_sizes (Chart chart, out double max_rec_width, out double max_rec_height, bool horizontal = true) {
max_rec_width = max_rec_height = 0; max_rec_width = max_rec_height = 0;
for (var i = 0; i < nrecords; ++i) { for (var i = 0; i < nrecords; ++i) {
Float128 x = (int64)(zoom_min + (zoom_max - zoom_min) / nrecords * i) + 1.0/3.0; Float128 x = (int64)(zoom_min + (zoom_max - zoom_min) / nrecords * i) + 1.0/3.0;
switch (type) { switch (type) {
case Axis.Type.NUMBERS: case Axis.Type.NUMBERS:
var text = new Text (format.printf((LongDouble)x) + (is_horizontal ? "_" : ""), font_style); var text = new Text (format.printf((LongDouble)x) + (horizontal ? "_" : ""), font_style);
var sz = text.get_size(chart.context); var sz = text.get_size(chart.context);
max_rec_width = double.max (max_rec_width, sz.width); max_rec_width = double.max (max_rec_width, sz.width);
max_rec_height = double.max (max_rec_height, sz.height); max_rec_height = double.max (max_rec_height, sz.height);
@ -127,13 +127,13 @@ namespace CairoChart {
var h = 0.0; var h = 0.0;
if (date_format != "") { if (date_format != "") {
var text = new Text (date + (is_horizontal ? "_" : ""), font_style); var text = new Text (date + (horizontal ? "_" : ""), font_style);
var sz = text.get_size(chart.context); var sz = text.get_size(chart.context);
max_rec_width = double.max (max_rec_width, sz.width); max_rec_width = double.max (max_rec_width, sz.width);
h = sz.height; h = sz.height;
} }
if (time_format != "") { if (time_format != "") {
var text = new Text (time + (is_horizontal ? "_" : ""), font_style); var text = new Text (time + (horizontal ? "_" : ""), font_style);
var sz = text.get_size(chart.context); var sz = text.get_size(chart.context);
max_rec_width = double.max (max_rec_width, sz.width); max_rec_width = double.max (max_rec_width, sz.width);
h += sz.height; h += sz.height;