Re: [Vala] vala-list Digest, Vol 143, Issue 1



Thank you, there are no examples at all for LibDazzle + Vala. When I first
found vala and asked on Reddit
<https://www.reddit.com/r/vala/comments/9tui22/build_a_graph_with_vala/>
for a widget to display graphs, no one answered anything.
So soon I made a very bad one
<https://www.reddit.com/r/vala/comments/a09p11/graph_in_vala_with_canvas_custom_widget_and/>.
(I needed it for the laboratory at the University)
In the code of your message for some reason there were no spaces, here is
the corrected version <https://pastebin.com/V1AkuAvm>.

пт, 3 янв. 2020 г. в 15:45, <vala-list-request gnome org>:

Send vala-list mailing list submissions to
        vala-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.gnome.org/mailman/listinfo/vala-list
or, via email, send a message with subject or body 'help' to
        vala-list-request gnome org

You can reach the person managing the list at
        vala-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of vala-list digest..."


Today's Topics:

   1. Snippet: Dazzle.GraphView hello world (grindhold)


----------------------------------------------------------------------

Message: 1
Date: Fri, 3 Jan 2020 13:35:59 +0100
From: grindhold <grindhold skarphed org>
To: vala-list gnome org
Subject: [Vala] Snippet: Dazzle.GraphView hello world
Message-ID: <cd31780b-67f0-4918-216c-01b34eff4d25 skarphed org>
Content-Type: text/plain; charset="utf-8"

Because i could not find one and i wanted to play around with it, I
wrote a hello-world-style application that uses libdazzle's graphview
courtesy to chergert.

I figured this could be useful to other people who want to get started
with it and prefer not to dig through gnome-usage's source.


Compile with: valac --pkg gtk+-3.0 --pkg libdazzle-1.0 <file.vala>

 1. publicstaticintmain(string[]argv){
 2. Gtk.init(refargv);
 3. varwin =newGtk.Window();
 4. vargv =newDazzle.GraphView();
 5. vargm =newDazzle.GraphModel();
 6. varb =newGtk.Button.with_label("add datapoint");
 7. varbox =newGtk.Box(Gtk.Orientation.VERTICAL,10);
 8. vargc =newDazzle.GraphColumn("The Value",Type.from_name("gdouble"));
 9. vargr =newDazzle.GraphLineRenderer();
10. varl =newGtk.Label("asdf");
11. ?
12. gm.set_timespan(TimeSpan.MINUTE);
13. gm.set_max_samples(30);
14. gm.add_column(gc);
15. ?
16. b.clicked.connect(()=>{
17. Dazzle.GraphModelItergi;
18. gm.push(outgi ,GLib.get_monotonic_time());
19. Dazzle.GraphModel.iter_set_value(gi,0,Random.double_range(0,100));
20. message("added");
21. });
22. gm.changed.connect(()=>{message("changed");});
23. box.expand=true;
24. gv.expand=true;
25. box.pack_start(b,false,false,0);
26. Gdk.RGBA linecol =Gdk.RGBA();
27. linecol.red =1.0;linecol.green=0.0;linecol.blue=0.0;linecol.alpha=1.0;
28. gr.stroke_color_rgba=linecol;
29. gr.line_width =1;
30. gr.column =0;
31. gv.add_renderer(gr);
32. box.pack_start(gv,true,true,0);
33. box.pack_start(l,false,false,0);
34. gv.set_model (gm);
35. win.add(box);
36. win.show_all();
37. win.delete_event.connect(()=>{Gtk.main_quit();returntrue;});
38.
39. Gtk.main();
40. return0;
41. }

Enjoy :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 35472 bytes
Desc: not available
URL: <
https://mail.gnome.org/archives/vala-list/attachments/20200103/fc81c898/attachment.bin


------------------------------

Subject: Digest Footer

_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list


------------------------------

End of vala-list Digest, Vol 143, Issue 1
*****************************************



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]