Contains factories to create box charts.
Provides converters for datasets used for box charts.
CategoryChartFactories contains all high-level factories to conveniently create charts based on category datasets.
Provides converters for datasets used for category charts and multiple pie charts.
CategoryLabelGenerators contains factories for creating label generators for category charts.
CategoryLabelGenerators contains factories for creating label generators for category charts.
chart.labelGenerator = CategoryLabelGenerator(value => value.toString)
The following list contains various ways on how to create and set label generators for category charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = BarChart(data) chart.labelGenerator = (dataset: CategoryDataset, series: Comparable[_], category: Comparable[_]) => dataset.getValue(series,category).toString chart.labelGenerator = CategoryLabelGenerator { (dataset, series, category) => dataset.getValue(series,category).toString } chart.labelGenerator = CategoryLabelGenerator(_.getValue(_,_).toString) chart.labelGenerator = CategoryLabelGenerator(value => value.toString) chart.labelGenerator = CategoryLabelGenerator(_.toString) chart.labelGenerator = CategoryLabelGenerator.Default
CategoryToolTipGenerators contains factories for creating tool tip generators for category charts.
CategoryToolTipGenerators contains factories for creating tool tip generators for category charts.
chart.tooltipGenerator = CategoryToolTipGenerator(value => value.toString)
The following list contains various ways on how to create and set tool tip generators for category charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = BarChart(data) chart.tooltipGenerator = (dataset: CategoryDataset, series: Comparable[_], category: Comparable[_]) => dataset.getValue(series,category).toString chart.tooltipGenerator = CategoryToolTipGenerator { (dataset, series, category) => dataset.getValue(series,category).toString } chart.tooltipGenerator = CategoryToolTipGenerator(_.getValue(_,_).toString) chart.tooltipGenerator = CategoryToolTipGenerator(value => value.toString) chart.tooltipGenerator = CategoryToolTipGenerator(_.toString) chart.tooltipGenerator = CategoryToolTipGenerator.Default
ChartFactories contains all high-level factories to conveniently create charts.
ChartFactories contains all high-level factories to conveniently create charts.
val data = for (i <- 1 to 5) yield (i,i) val chart = XYLineChart(data)
The only argument needed to create a chart is a dataset:
val data = for (i <- 1 to 5) yield (i,i) val dataset = data.toXYSeriesCollection("some data") val chart = XYLineChart(dataset)
The default theme used is the JFreeChart theme. To apply a different theme to the charts created by the factories, simply define an implicit chart theme in scope, e.g. the darkness theme from JFreeChart:
implicit val theme = org.jfree.chart.StandardChartTheme.createDarknessTheme
Contains all enrichments.
Contains all enrichments.
ChartFactories contains all high-level factories to conveniently create charts.
val data = for (i <- 1 to 5) yield (i,i) val chart = XYLineChart(data)
Exporting contains enrichments to conveniently export charts to disk.
chart.saveAsPNG("/tmp/chart.png")
LabelGenerators contains means to conveniently create label generators for all supported chart types.
val chart = PieChart(data) chart.labelGenerator = PieLabelGenerator(value => value.toString)
RichPlot contains enriched plot types to conveniently work with the plot domain, range and marking.
chart.plot.domain.axis.label.text = "my label" chart.plot.range.markers += ((1,1))
ToolTipGenerators contains means to conveniently create tool tip generators for all supported chart types.
val chart = PieChart(data) chart.tooltipGenerator = PieToolTipGenerator(value => value.toString)
Provides the Converter type class and a generic ConverterCompanion for it.
Provides all dataset converters.
Exporting contains enrichments to conveniently export charts to disk.
Exporting contains enrichments to conveniently export charts to disk.
chart.saveAsPNG("/tmp/chart.png")
Charts may be exported into the following formats:
"com.itextpdf" % "itextpdf"
on your class path"org.jfree" % "jfreesvg"
on your class pathThere are different stages in which charts may be exported: encoding, writing and the actual saving of the file, which is demonstrated by the following code snippet:
val bytes = chart.encodeAsPNG() chart.writeAsPNG(System.out) chart.saveAsPNG("/tmp/chart.png")
Contains imports from other libraries, most notably JFreeChart.
LabelGenerators contains means to conveniently create label generators for all supported chart types.
LabelGenerators contains means to conveniently create label generators for all supported chart types.
val chart = PieChart(data) chart.labelGenerator = PieLabelGenerator(value => value.toString)
CategoryLabelGenerators contains factories for creating label generators for category charts.
chart.labelGenerator = CategoryLabelGenerator(value => value.toString)
PieLabelGenerators contains factories for creating label generators for pie charts.
chart.labelGenerator = PieLabelGenerator(value => value.toString)
XYLabelGenerators contains factories for creating label generators for xy charts.
chart.labelGenerator = XYLabelGenerator(value => value.toString)
MarkerConversions contains type class based conversions
from certain types to Marker
instances.
MarkerConversions contains type class based conversions
from certain types to Marker
instances.
chart.plot.domain.markers += 1
All numeric types and numeric ranges are supported to create simple value markers:
chart.plot.range.markers += 3 chart.plot.range.markers += 3L chart.plot.range.markers += 3.0 chart.plot.range.markers += ((1.0,2.0))
There is also an additional conversion type class for the domain of CategoryCharts you can
use for CategoryMarker
s, which support arbitrary Comparable
s like String
:
chart.plot.domain.markers += "category"
The legacy JFreeChart classes can still be used directly:
chart.plot.range.markers += new ValueMarker(3.0) chart.plot.range.markers += new IntervalMarker(1.0, 2.0) chart.plot.domain.markers += new CategoryMarker("category")
Contains factories to create pie charts and other pie-like chart.
Provides converters for datasets used for pie charts and ring charts.
PieLabelGenerators contains factories for creating label generators for pie charts.
PieLabelGenerators contains factories for creating label generators for pie charts.
chart.labelGenerator = PieLabelGenerator(value => value.toString)
The following list contains various ways on how to create and set label generators for pie charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = PieChart(data) chart.labelGenerator = (dataset: PieDataset, key: Comparable[_]) => dataset.getValue(key).toString chart.labelGenerator = PieLabelGenerator { (dataset, key) => dataset.getValue(key).toString } chart.labelGenerator = PieLabelGenerator(_.getValue(_).toString) chart.labelGenerator = PieLabelGenerator(value => value.toString) chart.labelGenerator = PieLabelGenerator(_.toString) chart.labelGenerator = PieLabelGenerator.Default
PieToolTipGenerators contains factories for creating tool tip generators for pie charts.
PieToolTipGenerators contains factories for creating tool tip generators for pie charts.
chart.tooltipGenerator = PieToolTipGenerator(value => value.toString)
The following list contains various ways on how to create and set tool tip generators for pie charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = PieChart(data) chart.tooltipGenerator = (dataset: PieDataset, key: Comparable[_]) => dataset.getValue(key).toString chart.tooltipGenerator = PieToolTipGenerator { (dataset, key) => dataset.getValue(key).toString } chart.tooltipGenerator = PieToolTipGenerator(_.getValue(_).toString) chart.tooltipGenerator = PieToolTipGenerator(value => value.toString) chart.tooltipGenerator = PieToolTipGenerator(_.toString) chart.tooltipGenerator = PieToolTipGenerator.Default
Contains enrichments for collections for conversions to datasets.
Contains enrichments for collections for conversions to datasets. To see which conversions are provided have a look at the classes defined below.
RichPlot contains enriched plot types to conveniently work with the plot domain, range and marking.
RichPlot contains enriched plot types to conveniently work with the plot domain, range and marking.
chart.plot.domain.axis.label.text = "my label" chart.plot.range.markers += ((1,1))
There are enrichments concerning the handling of markers in plots:
chart.plot.domain.markers += 1 chart.plot.range.markers += ((1,1)) for (marker <- chart.plot.range.markers) { // do something with marker }
MarkerConversions contains type class based conversions
from certain types to Marker
instances.
chart.plot.domain.markers += 1
Contains factories to create spider web charts aka radar charts.
Provides converters for TableXYDatasets
.
ToolTipGenerators contains means to conveniently create tool tip generators for all supported chart types.
ToolTipGenerators contains means to conveniently create tool tip generators for all supported chart types.
val chart = PieChart(data) chart.tooltipGenerator = PieToolTipGenerator(value => value.toString)
CategoryToolTipGenerators contains factories for creating tool tip generators for category charts.
chart.tooltipGenerator = CategoryToolTipGenerator(value => value.toString)
PieToolTipGenerators contains factories for creating tool tip generators for pie charts.
chart.tooltipGenerator = PieToolTipGenerator(value => value.toString)
XYToolTipGenerators contains factories for creating tool tip generators for xy charts.
chart.tooltipGenerator = XYToolTipGenerator(value => value.toString)
XYChartFactories contains all high-level factories to conveniently create xy charts.
Provides converters for datasets used for xy charts.
XYLabelGenerators contains factories for creating label generators for xy charts.
XYLabelGenerators contains factories for creating label generators for xy charts.
chart.labelGenerator = XYLabelGenerator(value => value.toString)
The following list contains various ways on how to create and set label generators for xy charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = XYLineChart(data) chart.labelGenerator = (dataset: XYDataset, series: Comparable[_], item: Int) => val idx = dataset.indexOf(series) dataset.getY(idx, item).toString } chart.labelGenerator = XYLabelGenerator { (dataset, series, item) => val idx = dataset.indexOf(series) dataset.getY(idx,item).toString } chart.labelGenerator = XYLabelGenerator(value => value.toString) chart.labelGenerator = XYLabelGenerator(_.toString) chart.labelGenerator = XYLabelGenerator((x,y) => s"""($x,$y)""") chart.labelGenerator = XYLabelGenerator.Default
XYToolTipGenerators contains factories for creating tool tip generators for xy charts.
XYToolTipGenerators contains factories for creating tool tip generators for xy charts.
chart.tooltipGenerator = XYToolTipGenerator(value => value.toString)
The following list contains various ways on how to create and set tool tip generators for xy charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = XYLineChart(data) chart.tooltipGenerator = (dataset: XYDataset, series: Comparable[_], item: Int) => val idx = dataset.indexOf(series) dataset.getY(idx, item).toString } chart.tooltipGenerator = XYToolTipGenerator { (dataset, series, item) => val idx = dataset.indexOf(series) dataset.getY(idx,item).toString } chart.tooltipGenerator = XYToolTipGenerator(value => value.toString) chart.tooltipGenerator = XYToolTipGenerator(_.toString) chart.tooltipGenerator = XYToolTipGenerator((x,y) => s"""($x,$y)""") chart.tooltipGenerator = XYToolTipGenerator.Default
Contains factories to create box charts.
Provides converters for datasets used for box charts.
CategoryChartFactories contains all high-level factories to conveniently create charts based on category datasets.
Provides converters for datasets used for category charts and multiple pie charts.
CategoryLabelGenerators contains factories for creating label generators for category charts.
CategoryLabelGenerators contains factories for creating label generators for category charts.
chart.labelGenerator = CategoryLabelGenerator(value => value.toString)
The following list contains various ways on how to create and set label generators for category charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = BarChart(data) chart.labelGenerator = (dataset: CategoryDataset, series: Comparable[_], category: Comparable[_]) => dataset.getValue(series,category).toString chart.labelGenerator = CategoryLabelGenerator { (dataset, series, category) => dataset.getValue(series,category).toString } chart.labelGenerator = CategoryLabelGenerator(_.getValue(_,_).toString) chart.labelGenerator = CategoryLabelGenerator(value => value.toString) chart.labelGenerator = CategoryLabelGenerator(_.toString) chart.labelGenerator = CategoryLabelGenerator.Default
CategoryToolTipGenerators contains factories for creating tool tip generators for category charts.
CategoryToolTipGenerators contains factories for creating tool tip generators for category charts.
chart.tooltipGenerator = CategoryToolTipGenerator(value => value.toString)
The following list contains various ways on how to create and set tool tip generators for category charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = BarChart(data) chart.tooltipGenerator = (dataset: CategoryDataset, series: Comparable[_], category: Comparable[_]) => dataset.getValue(series,category).toString chart.tooltipGenerator = CategoryToolTipGenerator { (dataset, series, category) => dataset.getValue(series,category).toString } chart.tooltipGenerator = CategoryToolTipGenerator(_.getValue(_,_).toString) chart.tooltipGenerator = CategoryToolTipGenerator(value => value.toString) chart.tooltipGenerator = CategoryToolTipGenerator(_.toString) chart.tooltipGenerator = CategoryToolTipGenerator.Default
ChartFactories contains all high-level factories to conveniently create charts.
ChartFactories contains all high-level factories to conveniently create charts.
val data = for (i <- 1 to 5) yield (i,i) val chart = XYLineChart(data)
The only argument needed to create a chart is a dataset:
val data = for (i <- 1 to 5) yield (i,i) val dataset = data.toXYSeriesCollection("some data") val chart = XYLineChart(dataset)
The default theme used is the JFreeChart theme. To apply a different theme to the charts created by the factories, simply define an implicit chart theme in scope, e.g. the darkness theme from JFreeChart:
implicit val theme = org.jfree.chart.StandardChartTheme.createDarknessTheme
Contains all enrichments.
Contains all enrichments.
ChartFactories contains all high-level factories to conveniently create charts.
val data = for (i <- 1 to 5) yield (i,i) val chart = XYLineChart(data)
Exporting contains enrichments to conveniently export charts to disk.
chart.saveAsPNG("/tmp/chart.png")
LabelGenerators contains means to conveniently create label generators for all supported chart types.
val chart = PieChart(data) chart.labelGenerator = PieLabelGenerator(value => value.toString)
RichPlot contains enriched plot types to conveniently work with the plot domain, range and marking.
chart.plot.domain.axis.label.text = "my label" chart.plot.range.markers += ((1,1))
ToolTipGenerators contains means to conveniently create tool tip generators for all supported chart types.
val chart = PieChart(data) chart.tooltipGenerator = PieToolTipGenerator(value => value.toString)
Provides the Converter type class and a generic ConverterCompanion for it.
Provides all dataset converters.
Exporting contains enrichments to conveniently export charts to disk.
Exporting contains enrichments to conveniently export charts to disk.
chart.saveAsPNG("/tmp/chart.png")
Charts may be exported into the following formats:
"com.itextpdf" % "itextpdf"
on your class path"org.jfree" % "jfreesvg"
on your class pathThere are different stages in which charts may be exported: encoding, writing and the actual saving of the file, which is demonstrated by the following code snippet:
val bytes = chart.encodeAsPNG() chart.writeAsPNG(System.out) chart.saveAsPNG("/tmp/chart.png")
Contains imports from other libraries, most notably JFreeChart.
LabelGenerators contains means to conveniently create label generators for all supported chart types.
LabelGenerators contains means to conveniently create label generators for all supported chart types.
val chart = PieChart(data) chart.labelGenerator = PieLabelGenerator(value => value.toString)
CategoryLabelGenerators contains factories for creating label generators for category charts.
chart.labelGenerator = CategoryLabelGenerator(value => value.toString)
PieLabelGenerators contains factories for creating label generators for pie charts.
chart.labelGenerator = PieLabelGenerator(value => value.toString)
XYLabelGenerators contains factories for creating label generators for xy charts.
chart.labelGenerator = XYLabelGenerator(value => value.toString)
MarkerConversions contains type class based conversions
from certain types to Marker
instances.
MarkerConversions contains type class based conversions
from certain types to Marker
instances.
chart.plot.domain.markers += 1
All numeric types and numeric ranges are supported to create simple value markers:
chart.plot.range.markers += 3 chart.plot.range.markers += 3L chart.plot.range.markers += 3.0 chart.plot.range.markers += ((1.0,2.0))
There is also an additional conversion type class for the domain of CategoryCharts you can
use for CategoryMarker
s, which support arbitrary Comparable
s like String
:
chart.plot.domain.markers += "category"
The legacy JFreeChart classes can still be used directly:
chart.plot.range.markers += new ValueMarker(3.0) chart.plot.range.markers += new IntervalMarker(1.0, 2.0) chart.plot.domain.markers += new CategoryMarker("category")
Contains factories to create pie charts and other pie-like chart.
Provides converters for datasets used for pie charts and ring charts.
PieLabelGenerators contains factories for creating label generators for pie charts.
PieLabelGenerators contains factories for creating label generators for pie charts.
chart.labelGenerator = PieLabelGenerator(value => value.toString)
The following list contains various ways on how to create and set label generators for pie charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = PieChart(data) chart.labelGenerator = (dataset: PieDataset, key: Comparable[_]) => dataset.getValue(key).toString chart.labelGenerator = PieLabelGenerator { (dataset, key) => dataset.getValue(key).toString } chart.labelGenerator = PieLabelGenerator(_.getValue(_).toString) chart.labelGenerator = PieLabelGenerator(value => value.toString) chart.labelGenerator = PieLabelGenerator(_.toString) chart.labelGenerator = PieLabelGenerator.Default
PieToolTipGenerators contains factories for creating tool tip generators for pie charts.
PieToolTipGenerators contains factories for creating tool tip generators for pie charts.
chart.tooltipGenerator = PieToolTipGenerator(value => value.toString)
The following list contains various ways on how to create and set tool tip generators for pie charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = PieChart(data) chart.tooltipGenerator = (dataset: PieDataset, key: Comparable[_]) => dataset.getValue(key).toString chart.tooltipGenerator = PieToolTipGenerator { (dataset, key) => dataset.getValue(key).toString } chart.tooltipGenerator = PieToolTipGenerator(_.getValue(_).toString) chart.tooltipGenerator = PieToolTipGenerator(value => value.toString) chart.tooltipGenerator = PieToolTipGenerator(_.toString) chart.tooltipGenerator = PieToolTipGenerator.Default
Contains enrichments for collections for conversions to datasets.
Contains enrichments for collections for conversions to datasets. To see which conversions are provided have a look at the classes defined below.
RichPlot contains enriched plot types to conveniently work with the plot domain, range and marking.
RichPlot contains enriched plot types to conveniently work with the plot domain, range and marking.
chart.plot.domain.axis.label.text = "my label" chart.plot.range.markers += ((1,1))
There are enrichments concerning the handling of markers in plots:
chart.plot.domain.markers += 1 chart.plot.range.markers += ((1,1)) for (marker <- chart.plot.range.markers) { // do something with marker }
MarkerConversions contains type class based conversions
from certain types to Marker
instances.
chart.plot.domain.markers += 1
Contains factories to create spider web charts aka radar charts.
Provides converters for TableXYDatasets
.
ToolTipGenerators contains means to conveniently create tool tip generators for all supported chart types.
ToolTipGenerators contains means to conveniently create tool tip generators for all supported chart types.
val chart = PieChart(data) chart.tooltipGenerator = PieToolTipGenerator(value => value.toString)
CategoryToolTipGenerators contains factories for creating tool tip generators for category charts.
chart.tooltipGenerator = CategoryToolTipGenerator(value => value.toString)
PieToolTipGenerators contains factories for creating tool tip generators for pie charts.
chart.tooltipGenerator = PieToolTipGenerator(value => value.toString)
XYToolTipGenerators contains factories for creating tool tip generators for xy charts.
chart.tooltipGenerator = XYToolTipGenerator(value => value.toString)
XYChartFactories contains all high-level factories to conveniently create xy charts.
Provides converters for datasets used for xy charts.
XYLabelGenerators contains factories for creating label generators for xy charts.
XYLabelGenerators contains factories for creating label generators for xy charts.
chart.labelGenerator = XYLabelGenerator(value => value.toString)
The following list contains various ways on how to create and set label generators for xy charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = XYLineChart(data) chart.labelGenerator = (dataset: XYDataset, series: Comparable[_], item: Int) => val idx = dataset.indexOf(series) dataset.getY(idx, item).toString } chart.labelGenerator = XYLabelGenerator { (dataset, series, item) => val idx = dataset.indexOf(series) dataset.getY(idx,item).toString } chart.labelGenerator = XYLabelGenerator(value => value.toString) chart.labelGenerator = XYLabelGenerator(_.toString) chart.labelGenerator = XYLabelGenerator((x,y) => s"""($x,$y)""") chart.labelGenerator = XYLabelGenerator.Default
XYToolTipGenerators contains factories for creating tool tip generators for xy charts.
XYToolTipGenerators contains factories for creating tool tip generators for xy charts.
chart.tooltipGenerator = XYToolTipGenerator(value => value.toString)
The following list contains various ways on how to create and set tool tip generators for xy charts:
val data = for (i <- 1 to 5) yield (i,i) val chart = XYLineChart(data) chart.tooltipGenerator = (dataset: XYDataset, series: Comparable[_], item: Int) => val idx = dataset.indexOf(series) dataset.getY(idx, item).toString } chart.tooltipGenerator = XYToolTipGenerator { (dataset, series, item) => val idx = dataset.indexOf(series) dataset.getY(idx,item).toString } chart.tooltipGenerator = XYToolTipGenerator(value => value.toString) chart.tooltipGenerator = XYToolTipGenerator(_.toString) chart.tooltipGenerator = XYToolTipGenerator((x,y) => s"""($x,$y)""") chart.tooltipGenerator = XYToolTipGenerator.Default
This package provides a la carte imports. It is organized into modules following the Scala's Selfless Trait Pattern. Some of these modules depend on each other. In this case, there is often a short documentation in the higher-level module and links to the lower-level modules. Have a look for yourself and start at the highest-level all you can eat module Charting.