mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-27 08:55:51 +08:00
labels added
This commit is contained in:
+15
-4
@@ -201,9 +201,11 @@ class plot = fun ~size ~width ~height ~packing () ->
|
|||||||
dr#set_foreground (`NAME "black");
|
dr#set_foreground (`NAME "black");
|
||||||
dr#lines [(0, y v); (width-width/size, y v)])
|
dr#lines [(0, y v); (width-width/size, y v)])
|
||||||
csts;
|
csts;
|
||||||
|
|
||||||
|
let margin = 3 in
|
||||||
|
let title_y = ref margin in
|
||||||
Hashtbl.iter
|
Hashtbl.iter
|
||||||
(fun _ a ->
|
(fun title a ->
|
||||||
(* Draw *)
|
(* Draw *)
|
||||||
let curve = ref [] in
|
let curve = ref [] in
|
||||||
assert (size = Array.length a.array);
|
assert (size = Array.length a.array);
|
||||||
@@ -218,8 +220,17 @@ class plot = fun ~size ~width ~height ~packing () ->
|
|||||||
dr#set_foreground (`NAME a.color);
|
dr#set_foreground (`NAME a.color);
|
||||||
dr#lines !curve;
|
dr#lines !curve;
|
||||||
end;
|
end;
|
||||||
(new GDraw.drawable da#misc#window)#put_pixmap ~x:0 ~y:0 dr#pixmap)
|
|
||||||
curves
|
(* Title *)
|
||||||
|
Pango.Layout.set_text layout title;
|
||||||
|
let (w, h) = Pango.Layout.get_pixel_size layout in
|
||||||
|
dr#rectangle ~x:(width-h-margin) ~y:!title_y ~width:h ~height:h ~filled:true ();
|
||||||
|
|
||||||
|
dr#set_foreground `BLACK;
|
||||||
|
dr#put_layout ~x:(width-2*margin-w-h) ~y:(!title_y) layout;
|
||||||
|
title_y := !title_y + h + margin)
|
||||||
|
curves;
|
||||||
|
(new GDraw.drawable da#misc#window)#put_pixmap ~x:0 ~y:0 dr#pixmap
|
||||||
with
|
with
|
||||||
exc ->
|
exc ->
|
||||||
prerr_endline (Printexc.to_string exc)
|
prerr_endline (Printexc.to_string exc)
|
||||||
|
|||||||
Reference in New Issue
Block a user