How to add graphics to your Spark program
In this recipe, we discuss how to use JFreeChart to add a graphic chart to your Spark 2.0.0 program.
How to do it...
- Set up the JFreeChart library. JFreeChart JARs can be downloaded from the https://sourceforge.net/projects/jfreechart/files/ site.
Â
- The JFreeChart version we have covered in this book is JFreeChart 1.0.19, as can be seen in the following screenshot. It can be downloaded from the https://sourceforge.net/projects/jfreechart/files/1.%20JFreeChart/1.0.19/jfreechart-1.0.19.zip/download site:
![](https://static.packt-cdn.com/products/9781789959208/graphics/c3e34cb0-925f-4bcd-aeca-f07f2b122789.png)
- Once the ZIP file is downloaded, extract it. We extracted the ZIP file under
C:\
for a Windows machine, then proceed to find thelib
directory under the extracted destination directory. - We then find the two libraries we need (JFreeChart requires JCommon),
JFreeChart-1.0.19.jar
andJCommon-1.0.23
:
![](https://static.packt-cdn.com/products/9781789959208/graphics/f7983b78-675c-49ee-b58c-17ff9327caff.png)
- Now we copy the two previously mentioned JARs into the
C:\spark-2.0.0-bin-hadoop2.7\examples\jars\
directory.
Â
- This directory, as mentioned in the previous setup...