scaling fixed
git-svn-id: file:///home/jan/tmp/wetterstation/trunk@94 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
parent
e1ade6c3b2
commit
a339e7ea29
|
|
@ -1,5 +1,5 @@
|
||||||
fork yes
|
#fork yes
|
||||||
#fork no
|
fork no
|
||||||
image_cfg_location image_file/
|
image_cfg_location image_file/
|
||||||
|
|
||||||
image_cfg testimage.conf
|
image_cfg testimage.conf
|
||||||
|
|
|
||||||
|
|
@ -162,12 +162,12 @@ int scale_y_coords(pix_list_ptr ptr, int c_height){
|
||||||
|
|
||||||
DEBUGOUT2(" Nullinie bei: %d\n", zero_line);
|
DEBUGOUT2(" Nullinie bei: %d\n", zero_line);
|
||||||
|
|
||||||
|
//printf("%f -- %f -- %d\n", range, pix_per_scale, zero_line);
|
||||||
if ((real_max - real_min + 1) >= real_max){
|
if ((real_max - real_min + 1) >= real_max){
|
||||||
return zero_line;
|
return zero_line;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Maximaler wert */
|
/* Maximaler wert */
|
||||||
|
|
@ -206,7 +206,7 @@ pix_list_ptr get_pix_list(int c_width){
|
||||||
table = get_type_table_by_id(conn, img_cfg.sens_id);
|
table = get_type_table_by_id(conn, img_cfg.sens_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(query, BUFFSIZE, "SELECT round(date_part('epoch', current_timestamp)) AS now, round(date_part('epoch', timestamp)) AS times, %s AS val FROM %s WHERE timestamp > (current_timestamp - INTERVAL '%d seconds') ORDER BY times ASC", img_cfg.table_field, table, img_cfg.show_interval );
|
snprintf(query, BUFFSIZE, "SELECT round(date_part('epoch', current_timestamp)) AS now, round(date_part('epoch', timestamp)) AS times, %s AS val FROM %s WHERE sens_id=%d AND timestamp > (current_timestamp - INTERVAL '%d seconds') ORDER BY times ASC", img_cfg.table_field, table, img_cfg.sens_id, img_cfg.show_interval );
|
||||||
|
|
||||||
res = pg_check_exec(conn, query);
|
res = pg_check_exec(conn, query);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,9 @@ static gdImagePtr draw_image(gdImagePtr img){
|
||||||
int offset_x_left = 60;
|
int offset_x_left = 60;
|
||||||
int offset_y_top = 5;
|
int offset_y_top = 5;
|
||||||
int offset_x_right = 20;
|
int offset_x_right = 20;
|
||||||
int offset_y_bottom = 20;
|
int offset_y_bottom = 80;
|
||||||
int dia_width = img_cfg.width - offset_x_left - offset_x_right;
|
int dia_width = img_cfg.width - offset_x_left - offset_x_right;
|
||||||
int dia_height = img_cfg.height - offset_y_top - offset_y_bottom;
|
int dia_height = 0;
|
||||||
int zero_line = 0;
|
int zero_line = 0;
|
||||||
int dia_y_padding = 10;
|
int dia_y_padding = 10;
|
||||||
int brect[8];
|
int brect[8];
|
||||||
|
|
@ -85,12 +85,13 @@ static gdImagePtr draw_image(gdImagePtr img){
|
||||||
gdImageStringTTF(img, &brect[0], headline_c, IMG_FONT, 16, 0, 10, offset_y_top + head_d.to_base, img_cfg.headline);
|
gdImageStringTTF(img, &brect[0], headline_c, IMG_FONT, 16, 0, 10, offset_y_top + head_d.to_base, img_cfg.headline);
|
||||||
offset_y_top = (offset_y_top * 2) + head_d.height;
|
offset_y_top = (offset_y_top * 2) + head_d.height;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dia_height = img_cfg.height - offset_y_top - offset_y_bottom;
|
||||||
|
|
||||||
/* Werte holen */
|
/* Werte holen */
|
||||||
pix_list = get_pix_list(dia_width);
|
pix_list = get_pix_list(dia_width);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Diagramhintergrund */
|
/* Diagramhintergrund */
|
||||||
gdImageFilledRectangle(img, offset_x_left, offset_y_top, img_cfg.width - offset_x_right, img_cfg.height - offset_y_bottom, dia_bg_c);
|
gdImageFilledRectangle(img, offset_x_left, offset_y_top, img_cfg.width - offset_x_right, img_cfg.height - offset_y_bottom, dia_bg_c);
|
||||||
|
|
||||||
|
|
@ -117,7 +118,7 @@ static gdImagePtr draw_image(gdImagePtr img){
|
||||||
|
|
||||||
/* Werte Zeichnen */
|
/* Werte Zeichnen */
|
||||||
for (; pix_list->next; pix_list = pix_list->next){
|
for (; pix_list->next; pix_list = pix_list->next){
|
||||||
gdImageLine(img, (offset_x_left + pix_list->x_pix_coord), (zero_line + offset_y_top + pix_list->y_pix_coord), (offset_x_left + pix_list->next->x_pix_coord), (zero_line + offset_y_top + pix_list->next->y_pix_coord), val_line_c);
|
gdImageLine(img, (offset_x_left + pix_list->x_pix_coord), (offset_y_top + pix_list->y_pix_coord), (offset_x_left + pix_list->next->x_pix_coord), (offset_y_top + pix_list->next->y_pix_coord), val_line_c);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdImageRectangle(img, offset_x_left, offset_y_top, img_cfg.width - offset_x_right, img_cfg.height - offset_y_bottom, dia_border_c);
|
gdImageRectangle(img, offset_x_left, offset_y_top, img_cfg.width - offset_x_right, img_cfg.height - offset_y_bottom, dia_border_c);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ show_interval 10d
|
||||||
label_interval 1d
|
label_interval 1d
|
||||||
label_sum no
|
label_sum no
|
||||||
width 800
|
width 800
|
||||||
height 250
|
height 400
|
||||||
sensor_id 1
|
sensor_id 1
|
||||||
value_koeffizient 0.1
|
value_koeffizient 0.1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue