30
30
import org .jfree .data .xy .XYSeriesCollection ;
31
31
import org .openide .util .NbBundle ;
32
32
import java .math .BigDecimal ;
33
+ import org .jfree .chart .plot .XYPlot ;
34
+ import org .jfree .chart .axis .NumberAxis ;
35
+ import org .jfree .chart .axis .NumberTickUnit ;
33
36
34
37
/**
35
38
*
@@ -39,6 +42,7 @@ public class BridgingCentralityMetric extends GraphDistance implements Statistic
39
42
40
43
private static final Logger logger = Logger .getLogger (BridgingCentralityMetric .class .getName ());
41
44
45
+ public static final String BETWEENNESS_CENTRALITY = "betweennesscentrality2" ;
42
46
public static final String BRIDGING_CENTRALITY = "bridgingcentrality" ;
43
47
public static final String BRIDGING_COEFFICIENT = "bridgingcoefficient" ;
44
48
@@ -147,8 +151,8 @@ private void initializeAttributeColunms(GraphModel graphModel) {
147
151
148
152
Table nodeTable = graphModel .getNodeTable ();
149
153
150
- if ( ! nodeTable .hasColumn (BETWEENNESS ) ){
151
- nodeTable .addColumn (BETWEENNESS , "Betweenness Centrality" , BigDecimal .class , new BigDecimal ("0" ));
154
+ if ( ! nodeTable .hasColumn (BETWEENNESS_CENTRALITY ) ){
155
+ nodeTable .addColumn (BETWEENNESS_CENTRALITY , "Betweenness Centrality" , BigDecimal .class , new BigDecimal ("0" ));
152
156
}
153
157
154
158
if ( ! nodeTable .hasColumn (BRIDGING_COEFFICIENT ) ){
@@ -314,7 +318,7 @@ private void saveCalculatedValues(Graph graph, HashMap<Node, Integer> indicies,
314
318
//The bridging centrality is just a multiplication of two other metrics
315
319
bridging_cent [s_index ] = bridging_coef * mybetweenness [s_index ];
316
320
317
- s .setAttribute (BETWEENNESS , new BigDecimal (nodeBetweenness [s_index ]));
321
+ s .setAttribute (BETWEENNESS_CENTRALITY , new BigDecimal (nodeBetweenness [s_index ]));
318
322
s .setAttribute (BRIDGING_COEFFICIENT , new BigDecimal (bridging_coef ));
319
323
s .setAttribute (BRIDGING_CENTRALITY , new BigDecimal (bridging_cent [s_index ]));
320
324
}
@@ -471,20 +475,26 @@ private String createImageFile(TempDir tempDir, double[] pVals, String pName, St
471
475
472
476
XYSeriesCollection dataset = new XYSeriesCollection ();
473
477
dataset .addSeries (dSeries );
478
+ dataset .setAutoWidth (true );
474
479
475
480
JFreeChart chart = ChartFactory .createXYLineChart (
476
481
pName ,
477
482
pX ,
478
483
pY ,
479
484
dataset ,
480
- PlotOrientation .HORIZONTAL ,
485
+ PlotOrientation .VERTICAL ,
481
486
true ,
482
487
false ,
483
488
false );
484
489
490
+ XYPlot xyPlot = (XYPlot ) chart .getPlot ();
491
+ NumberAxis domain = (NumberAxis ) xyPlot .getDomainAxis ();
492
+ domain .setRange (0.00 , domain .getUpperBound ());
493
+ domain .setTickUnit (new NumberTickUnit (domain .getUpperBound ()/10 ));
494
+
485
495
chart .removeLegend ();
486
496
ChartUtils .decorateChart (chart );
487
- ChartUtils .scaleChart (chart , dSeries , normalized );
497
+ // ChartUtils.scaleChart(chart, dSeries, normalized);
488
498
489
499
return ChartUtils .renderChart (chart , pName + ".png" );
490
500
}
0 commit comments