public class ChartsUtils extends Object
Constructor and Description |
---|
ChartsUtils() |
Modifier and Type | Method and Description |
---|---|
static org.jfree.chart.JFreeChart |
buildBoxPlot(Number[] numbers,
String dataName)
Build a new box-plot from an array of numbers using a default title and yLabel.
|
static org.jfree.chart.JFreeChart |
buildHistogram(Number[] numbers,
String dataName,
int divisions)
Build new histogram from the given numbers array using a default title and xLabel.
|
static org.jfree.chart.JFreeChart |
buildScatterPlot(Number[] numbers,
String dataName,
boolean useLines,
boolean useLinearRegression)
Build new scatter plot from numbers array using a default title and xLabel.
|
static org.jfree.chart.JFreeChart |
buildScatterPlot(org.jfree.data.xy.XYSeriesCollection data,
String title,
String xLabel,
String yLabel,
boolean useLines,
boolean useLinearRegression)
Build new Scatter plot.
|
private static String |
getMessage(String resName) |
static String |
getStatisticsReportHTML(String dataName,
BigDecimal[] statistics,
org.jfree.chart.JFreeChart boxPlot,
org.jfree.chart.JFreeChart scatterPlot,
org.jfree.chart.JFreeChart histogram,
Dimension boxPlotDimension,
Dimension scatterPlotDimension,
Dimension histogramDimension)
Prepares a HTML report for the given statistics data and charts.
|
private static org.jfree.data.xy.XYDataset |
regress(org.jfree.data.xy.XYSeriesCollection data)
Calculates linear regression points from a XYSeriesCollection data set
Code obtained from http://pwnt.be/2009/08/17/simple-linear-regression-with-jfreechart
|
static void |
setScatterPlotLinearRegressionEnabled(org.jfree.chart.JFreeChart scatterPlot,
boolean enabled)
Modify a scatter plot to show linear regression or not.
|
static void |
setScatterPlotLinesEnabled(org.jfree.chart.JFreeChart scatterPlot,
boolean enabled)
Modify a scatter plot to show lines instead or shapes or not.
|
private static void |
writeBoxPlot(StringBuilder sb,
org.jfree.chart.JFreeChart boxPlot,
Dimension dimension) |
private static void |
writeChart(StringBuilder sb,
org.jfree.chart.JFreeChart chart,
Dimension dimension,
String fileName) |
private static void |
writeHistogram(StringBuilder sb,
org.jfree.chart.JFreeChart histogram,
Dimension dimension) |
private static void |
writeScatterPlot(StringBuilder sb,
org.jfree.chart.JFreeChart scatterPlot,
Dimension dimension) |
private static void |
writeStatistic(StringBuilder sb,
String resName,
BigDecimal number) |
public static String getStatisticsReportHTML(String dataName, BigDecimal[] statistics, org.jfree.chart.JFreeChart boxPlot, org.jfree.chart.JFreeChart scatterPlot, org.jfree.chart.JFreeChart histogram, Dimension boxPlotDimension, Dimension scatterPlotDimension, Dimension histogramDimension)
getAllStatistics
of the StatisticsUtils
class.dataName
- Name of the datastatistics
- Statistics obtained from the method getAllStatistics
of the StatisticsUtils
classboxPlot
- Box-plot jfreechart or nullscatterPlot
- Scatter-plot jfreechart or nullhistogram
- Histogram-plot jfreechart or nullboxPlotDimension
- Dimension for the box-plot or null to use a default dimensionscatterPlotDimension
- Dimension for the scatter plot or null to use a default dimensionhistogramDimension
- Dimension for the histogram or null to use a default dimensionpublic static org.jfree.chart.JFreeChart buildBoxPlot(Number[] numbers, String dataName)
numbers
- Numbers for building box-plotdataName
- Name of the numbers datapublic static org.jfree.chart.JFreeChart buildScatterPlot(Number[] numbers, String dataName, boolean useLines, boolean useLinearRegression)
numbers
- Numbers for the scatter plotdataName
- Name of the numbers datauseLines
- Indicates if lines have to be drawn instead of shapesuseLinearRegression
- Indicates if the scatter plot has to have linear regreesion line drawnpublic static org.jfree.chart.JFreeChart buildScatterPlot(org.jfree.data.xy.XYSeriesCollection data, String title, String xLabel, String yLabel, boolean useLines, boolean useLinearRegression)
data
- Data for the plottitle
- Title for the chartxLabel
- Text for x labelyLabel
- Text for y labeluseLines
- Indicates if lines have to be drawn instead of shapesuseLinearRegression
- Indicates if the scatter plot has to have linear regreesion line drawnpublic static org.jfree.chart.JFreeChart buildHistogram(Number[] numbers, String dataName, int divisions)
numbers
- Numbers for the histogramdataName
- Name of the numbers datadivisions
- Divisions for the histogrampublic static void setScatterPlotLinesEnabled(org.jfree.chart.JFreeChart scatterPlot, boolean enabled)
scatterPlot
- Scatter plot to modifyenabled
- Indicates if lines have to be shownpublic static void setScatterPlotLinearRegressionEnabled(org.jfree.chart.JFreeChart scatterPlot, boolean enabled)
scatterPlot
- Scatter plot to modifyenabled
- Indicates if linear regression has to be shownprivate static org.jfree.data.xy.XYDataset regress(org.jfree.data.xy.XYSeriesCollection data)
private static void writeStatistic(StringBuilder sb, String resName, BigDecimal number)
private static void writeBoxPlot(StringBuilder sb, org.jfree.chart.JFreeChart boxPlot, Dimension dimension) throws IOException
IOException
private static void writeScatterPlot(StringBuilder sb, org.jfree.chart.JFreeChart scatterPlot, Dimension dimension) throws IOException
IOException
private static void writeHistogram(StringBuilder sb, org.jfree.chart.JFreeChart histogram, Dimension dimension) throws IOException
IOException
private static void writeChart(StringBuilder sb, org.jfree.chart.JFreeChart chart, Dimension dimension, String fileName) throws IOException
IOException
Copyright © 2007–2016 Gephi Consortium. All rights reserved.