use of org.jfree.data.xy.XYSeries in project gephi by gephi.
the class EigenvectorCentrality method getReport.
/**
*
* @return
*/
@Override
public String getReport() {
//distribution of values
Map<Double, Integer> dist = new HashMap<>();
for (int i = 0; i < centralities.length; i++) {
Double d = centralities[i];
if (dist.containsKey(d)) {
Integer v = dist.get(d);
dist.put(d, v + 1);
} else {
dist.put(d, 1);
}
}
//Distribution series
XYSeries dSeries = ChartUtils.createXYSeries(dist, "Eigenvector Centralities");
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(dSeries);
JFreeChart chart = ChartFactory.createScatterPlot("Eigenvector Centrality Distribution", "Score", "Count", dataset, PlotOrientation.VERTICAL, true, false, false);
chart.removeLegend();
ChartUtils.decorateChart(chart);
ChartUtils.scaleChart(chart, dSeries, true);
String imageFile = ChartUtils.renderChart(chart, "eigenvector-centralities.png");
String report = "<HTML> <BODY> <h1>Eigenvector Centrality Report</h1> " + "<hr>" + "<h2> Parameters: </h2>" + "Network Interpretation: " + (isDirected ? "directed" : "undirected") + "<br>" + "Number of iterations: " + numRuns + "<br>" + "Sum change: " + sumChange + "<br> <h2> Results: </h2>" + imageFile + "</BODY></HTML>";
return report;
}
use of org.jfree.data.xy.XYSeries in project gephi by gephi.
the class GraphDistance method createImageFile.
private String createImageFile(TempDir tempDir, double[] pVals, String pName, String pX, String pY) {
//distribution of values
Map<Double, Integer> dist = new HashMap<>();
for (int i = 0; i < N; i++) {
Double d = pVals[i];
if (dist.containsKey(d)) {
Integer v = dist.get(d);
dist.put(d, v + 1);
} else {
dist.put(d, 1);
}
}
//Distribution series
XYSeries dSeries = ChartUtils.createXYSeries(dist, pName);
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(dSeries);
JFreeChart chart = ChartFactory.createXYLineChart(pName, pX, pY, dataset, PlotOrientation.VERTICAL, true, false, false);
chart.removeLegend();
ChartUtils.decorateChart(chart);
ChartUtils.scaleChart(chart, dSeries, isNormalized);
return ChartUtils.renderChart(chart, pName + ".png");
}
use of org.jfree.data.xy.XYSeries in project gephi by gephi.
the class WeightedDegree method getReport.
@Override
public String getReport() {
String report;
if (isDirected) {
report = getDirectedReport();
} else {
//Distribution series
XYSeries dSeries = ChartUtils.createXYSeries(degreeDist, "Degree Distribution");
XYSeriesCollection dataset1 = new XYSeriesCollection();
dataset1.addSeries(dSeries);
JFreeChart chart1 = ChartFactory.createXYLineChart("Degree Distribution", "Value", "Count", dataset1, PlotOrientation.VERTICAL, true, false, false);
chart1.removeLegend();
ChartUtils.decorateChart(chart1);
ChartUtils.scaleChart(chart1, dSeries, false);
String degreeImageFile = ChartUtils.renderChart(chart1, "w-degree-distribution.png");
NumberFormat f = new DecimalFormat("#0.000");
report = "<HTML> <BODY> <h1>Weighted Degree Report </h1> " + "<hr>" + "<br> <h2> Results: </h2>" + "Average Weighted Degree: " + f.format(avgWDegree) + "<br /><br />" + degreeImageFile + "</BODY></HTML>";
}
return report;
}
use of org.jfree.data.xy.XYSeries in project gephi by gephi.
the class DynamicClusteringCoefficient method getReport.
@Override
public String getReport() {
//Time series
XYSeries dSeries = ChartUtils.createXYSeries(averages, "Clustering Coefficient Time Series");
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(dSeries);
JFreeChart chart = ChartFactory.createXYLineChart("Clustering Coefficient", "Time", "Average Clustering Coefficient", dataset, PlotOrientation.VERTICAL, true, false, false);
chart.removeLegend();
ChartUtils.decorateChart(chart);
ChartUtils.scaleChart(chart, dSeries, false);
String coefficientImageFile = ChartUtils.renderChart(chart, "coefficient-ts.png");
NumberFormat f = new DecimalFormat("#0.000000");
String report = "<HTML> <BODY> <h1>Dynamic Clustering Coefficient Report </h1> " + "<hr>" + "<br> Bounds: from " + f.format(bounds.getLow()) + " to " + f.format(bounds.getHigh()) + "<br> Window: " + window + "<br> Tick: " + tick + "<br><br><h2> Average clustering cloefficient over time: </h2>" + "<br /><br />" + coefficientImageFile;
/*for (Interval<Double> average : averages) {
report += average.toString(dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) + "<br />";
}*/
report += "<br /><br /></BODY></HTML>";
return report;
}
use of org.jfree.data.xy.XYSeries in project gephi by gephi.
the class ChartUtils method createXYSeries.
public static XYSeries createXYSeries(Map data, String name) {
XYSeries series = new XYSeries(name);
for (Iterator it = data.entrySet().iterator(); it.hasNext(); ) {
Map.Entry d = (Map.Entry) it.next();
Number x = (Number) d.getKey();
Number y = (Number) d.getValue();
series.add(x, y);
}
return series;
}
Aggregations