Came across a use case where one dataset has to be compared against a set of other datasets.
A simple example is to compare salary against the sum of tax, rent, car and other expenses. An obvious choice is to display salary as a bar and other expenses in a stacked area so that we can easily check which dataset value is higher.
Used JFreeChart library to create the chart and iText to create the PDF. There is a limited support to create charts in Java. JFreeChart is the only popular library available. It has various examples but this particular example is not covered anywhere.
http://www.jfree.org/jfreechart/samples.html
Here is the final chart shown in the PDF. It is generated using a BarRenderer and multiple AreaRenderers.
Here is the source code for download.
https://drive.google.com/file/d/1raQE8q4pLnArnrDdbub7kVFLhr8VCY5u/view?usp=sharing
A simple example is to compare salary against the sum of tax, rent, car and other expenses. An obvious choice is to display salary as a bar and other expenses in a stacked area so that we can easily check which dataset value is higher.
Used JFreeChart library to create the chart and iText to create the PDF. There is a limited support to create charts in Java. JFreeChart is the only popular library available. It has various examples but this particular example is not covered anywhere.
http://www.jfree.org/jfreechart/samples.html
Here is the final chart shown in the PDF. It is generated using a BarRenderer and multiple AreaRenderers.
Here is the source code for download.
https://drive.google.com/file/d/1raQE8q4pLnArnrDdbub7kVFLhr8VCY5u/view?usp=sharing

No comments:
Post a Comment