{"id":973,"date":"2013-02-21T09:47:21","date_gmt":"2013-02-21T15:47:21","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=973"},"modified":"2013-02-23T19:59:00","modified_gmt":"2013-02-24T01:59:00","slug":"jfreechart-for-the-win","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/973","title":{"rendered":"JFreeChart for the win"},"content":{"rendered":"<p><a href=\"http:\/\/www.mooreds.com\/wordpress\/wp-content\/uploads\/2013\/02\/test3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-980\" alt=\"test\" src=\"http:\/\/www.mooreds.com\/wordpress\/wp-content\/uploads\/2013\/02\/test3-300x300.jpg\" width=\"300\" height=\"300\" srcset=\"http:\/\/edit.mooreds.com\/wordpress\/wp-content\/uploads\/2013\/02\/test3-300x300.jpg 300w, http:\/\/edit.mooreds.com\/wordpress\/wp-content\/uploads\/2013\/02\/test3-150x150.jpg 150w, http:\/\/edit.mooreds.com\/wordpress\/wp-content\/uploads\/2013\/02\/test3.jpg 500w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I wanted to make some charts showing linear regressions, but they needed to be images (so libraries like <a href=\"http:\/\/d3js.org\/\">d3.js<\/a> were out).\u00a0 My first inclination was to use <a href=\"https:\/\/developers.google.com\/chart\/image\/\">Google&#8217;s Image Charts API<\/a>, but it has been deprecated.\u00a0 I looked around and couldn&#8217;t find anything like it.<\/p>\n<p>So, it looked like I&#8217;d need to code something up.\u00a0 Some searching around turned up some great open source projects.\u00a0 Using <a href=\"http:\/\/www.jfree.org\/jfreechart\/\">JFreeChart<\/a> and <a href=\"http:\/\/commons.apache.org\/math\/userguide\/stat.html#a1.4_Simple_regression\">Apache Commons Math<\/a>, and some blog posts (this one about <a href=\"http:\/\/pwnt.be\/2009\/08\/17\/simple-linear-regression-with-jfreechart\">regression<\/a>, this one about <a href=\"http:\/\/www.zetcode.com\/gfx\/java2d\/basicdrawing\/\">drawing dashed lines<\/a>) and a post on StackOverflow about <a href=\"http:\/\/stackoverflow.com\/questions\/6594748\/making-a-scatter-plot-using-2d-array-and-jfreechart\">scatter plot basics<\/a>, I was able to put together the above regression line chart in about half a day.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to make some charts showing linear regressions, but they needed to be images (so libraries like d3.js were out).\u00a0 My first inclination was to use Google&#8217;s Image Charts [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6],"tags":[],"class_list":["post-973","post","type-post","status-publish","format-standard","hentry","category-java","category-programming"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=973"}],"version-history":[{"count":6,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/973\/revisions"}],"predecessor-version":[{"id":986,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/973\/revisions\/986"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}