{"id":620,"date":"2014-06-29T00:53:13","date_gmt":"2014-06-28T22:53:13","guid":{"rendered":"http:\/\/www.thelins.se\/johan\/blog\/?p=620"},"modified":"2014-06-29T00:53:13","modified_gmt":"2014-06-28T22:53:13","slug":"introducing-grapher","status":"publish","type":"post","link":"https:\/\/www.thelins.se\/johan\/blog\/2014\/06\/introducing-grapher\/","title":{"rendered":"Introducing Grapher"},"content":{"rendered":"<p>I just found myself in the situation where i need to be able to create bargraphs.<\/p>\n<p><a href=\"https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-i.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-621\" src=\"https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-i.png\" alt=\"part-i\" width=\"600\" height=\"170\" srcset=\"https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-i.png 600w, https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-i-300x85.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a> <\/p>\n<p>The design is fairly limited: a row of stacked bars with optional labels under and inside each bar.<\/p>\n<p><a href=\"https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-ii.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-622 size-full\" src=\"https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-ii.png\" alt=\"part-ii\" width=\"600\" height=\"170\" srcset=\"https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-ii.png 600w, https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-ii-300x85.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a> <\/p>\n<p>I also want to be able to color the bars.<\/p>\n<p><a href=\"https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-iii.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-623 size-full\" src=\"https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-iii.png\" alt=\"part-iii\" width=\"600\" height=\"170\" srcset=\"https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-iii.png 600w, https:\/\/www.thelins.se\/johan\/blog\/wp-content\/uploads\/2014\/06\/part-iii-300x85.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>I wrote a quick little PyQt-based Python program. It lets you write things like this:<\/p>\n<p><code>bs = BarGraphStack()<br \/>\nbg = BarGraph()<br \/>\nbg.setTitle(\"Image Size\")<br \/>\nbg.addBar(Bar(6349, Qt.Qt.darkGray, \"6 349KiB\", \"kernel(bz)\"))<br \/>\nbg.addBar(Bar(25240, Qt.Qt.lightGray, \"25 240KiB\", \"rootfs\"))<br \/>\nbs.addBarGraph(bg)<br \/>\ni = bs.render();<br \/>\n# i is a QImage<\/code><\/p>\n<p>You can get the latest source code from the <a href=\"https:\/\/github.com\/e8johan\/grapher\">Grapher github repository<\/a>. It is probably obvious that this is Python code written by a C++ guy, but I hope that it still might be useful.<\/p>\n<p>Now I need to add some steps to feed it data automatically, but that is for another day.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just found myself in the situation where i need to be able to create bargraphs. The design is fairly limited: a row of stacked bars with optional labels under and inside each bar. I also want to be able to color the bars. I wrote a quick little PyQt-based Python program. It lets you &hellip; <a href=\"https:\/\/www.thelins.se\/johan\/blog\/2014\/06\/introducing-grapher\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Introducing Grapher<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-620","post","type-post","status-publish","format-standard","hentry","category-qt"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts\/620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/comments?post=620"}],"version-history":[{"count":1,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts\/620\/revisions"}],"predecessor-version":[{"id":624,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts\/620\/revisions\/624"}],"wp:attachment":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/media?parent=620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/categories?post=620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/tags?post=620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}