- Start a new project in IntelliJ or in an IDE of your choice. Make sure the necessary JAR files are included.
- The package statement for the recipe is as follows:
package spark.ml.cookbook.chapter12
- Import the necessary packages for Scala, Spark, and JFreeChart:
import org.apache.log4j.{Level, Logger}import org.apache.spark.sql.SQLContextimport org.apache.spark.{SparkConf, SparkContext}import org.jfree.chart.axis.{CategoryAxis, CategoryLabelPositions}import org.jfree.chart.{ChartFactory, ChartFrame, JFreeChart}import org.jfree.chart.plot.{CategoryPlot, PlotOrientation}import org.jfree.data.category.DefaultCategoryDataset
- We will define a function to display our JFreeChart within a window:
def show(chart: JFreeChart) ...