List of usage examples for org.jfree.chart.plot RingPlot setShadowGenerator
public void setShadowGenerator(ShadowGenerator generator)
From source file:i2p.bote.web.PeerInfoTag.java
private String createDhtChart(DhtPeerStats dhtStats) throws IOException { RingPlot plot; int numDhtPeers = dhtStats.getData().size(); if (numDhtPeers == 0) { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("", 100); plot = new RingPlot(dataset); plot.setSectionPaint("", Color.gray); } else {/*from w ww .j a va 2s . co m*/ int reachable = 0; for (List<String> row : dhtStats.getData()) { if (_t("No").equals(row.get(4))) reachable += 1; } int unreachable = numDhtPeers - reachable; DefaultPieDataset dataset = new DefaultPieDataset(); if (reachable > 0) dataset.setValue(_t("Reachable"), reachable); if (unreachable > 0) dataset.setValue(_t("Unreachable"), unreachable); plot = new RingPlot(dataset); plot.setSectionPaint(_t("Reachable"), Color.green); plot.setSectionPaint(_t("Unreachable"), Color.red); } plot.setLabelGenerator(null); plot.setShadowGenerator(null); JFreeChart dhtChart = new JFreeChart(_t("Kademlia Peers:"), JFreeChart.DEFAULT_TITLE_FONT, plot, numDhtPeers == 0 ? false : true); return ServletUtilities.saveChartAsPNG(dhtChart, 400, 300, null); }
From source file:i2p.bote.web.PeerInfoTag.java
private String createRelayChart(RelayPeer[] relayPeers) throws IOException { RingPlot plot; if (relayPeers.length == 0) { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("", 100); plot = new RingPlot(dataset); plot.setSectionPaint("", Color.gray); } else {//from www. ja v a 2 s . co m int good = 0; int untested = 0; for (RelayPeer relayPeer : relayPeers) { int reachability = relayPeer.getReachability(); if (reachability == 0) untested += 1; else if (reachability > 80) good += 1; } int bad = relayPeers.length - good - untested; DefaultPieDataset dataset = new DefaultPieDataset(); if (good > 0) dataset.setValue(_t("Good"), good); if (bad > 0) dataset.setValue(_t("Unreliable"), bad); if (untested > 0) dataset.setValue(_t("Untested"), untested); plot = new RingPlot(dataset); plot.setSectionPaint(_t("Good"), Color.green); plot.setSectionPaint(_t("Unreliable"), Color.red); plot.setSectionPaint(_t("Untested"), Color.orange); } plot.setLabelGenerator(null); plot.setShadowGenerator(null); JFreeChart chart = new JFreeChart(_t("Relay Peers:"), JFreeChart.DEFAULT_TITLE_FONT, plot, relayPeers.length == 0 ? false : true); return ServletUtilities.saveChartAsPNG(chart, 400, 300, null); }