List of usage examples for org.jfree.chart.urls StandardPieURLGenerator StandardPieURLGenerator
public StandardPieURLGenerator(String prefix, String categoryParamName)
From source file:nl.wur.plantbreeding.www.marker2seq.GoDistribution.java
/** * Generate the Pie chart for a set of given Go terms. * @param distrib a HashMap of GO name and GO frequency * @param title the title of the GO graph * @param url the url used for the tooltips * @param session the HttpSession used to save the file * @param legend Print the legend or not * @param tooltips Add tooltip or not//w w w. j a va 2 s .c om * @param urls Add urls or not (link in the graph) * @param max Maximum number of item to display * @return a list containing the filename and the map for the figure * @throws IOException when something happens while writting the image */ public static String[] generateDistribution(final HashMap<String, Integer> distrib, final String title, final String url, final HttpSession session, final boolean legend, final boolean tooltips, final boolean urls, final int max) throws IOException { final PieChart piec = new PieChart(); final PieDataset piedata = piec.createDataset(distrib); final JFreeChart chart = piec.createChart(piedata, title, legend, tooltips, urls); final PiePlot plot = (PiePlot) chart.getPlot(); if (distrib.size() >= max) { plot.setLabelGenerator(null); } plot.setURLGenerator(new StandardPieURLGenerator(url, "section")); final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); final String filename = ServletUtilities.saveChartAsPNG(chart, 500, 400, info, session); final String map = ChartUtilities.getImageMap(filename, info); final String[] output = { filename, map }; return output; }
From source file:nl.wur.plantbreeding.www.marker2seq.GoDistribution.java
/** * Generate the Pie chart for a set of given Go terms. * @param gotermlist of String (here GO names) * @param title the title of the GO graph * @param url the url used for the tooltips * @param session the HttpSession used to save the file * @param legend Print the legend or not * @param tooltips Add tooltip or not/* w w w.ja v a 2 s . c o m*/ * @param urls Add urls or not (link in the graph) * @param max Maximum number of item to display * @return a list containing the filename and the map for the figure * @throws IOException when something happens while writting the image */ public static String[] generateDistribution(final List<String> gotermlist, final String title, final String url, final HttpSession session, final boolean legend, final boolean tooltips, final boolean urls, final int max) throws IOException { final PieChart piec = new PieChart(); final PieDataset dataset = piec.createDataset(gotermlist); final JFreeChart chart = piec.createChart(dataset, title, legend, tooltips, urls); final PiePlot plot = (PiePlot) chart.getPlot(); if (gotermlist.size() >= max) { plot.setLabelGenerator(null); } plot.setURLGenerator(new StandardPieURLGenerator(url, "section")); final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); final String filename = ServletUtilities.saveChartAsPNG(chart, 500, 400, info, session); final String map = ChartUtilities.getImageMap(filename, info); final String[] output = { filename, map }; return output; }
From source file:tdunnick.jphineas.console.queue.Charts.java
private JFreeChart createPieChart(String title, PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart(title, // chart title dataset, // data false, // legend true, // tool tips false); // urls PiePlot plot = (PiePlot) chart.getPlot(); // add a URL map to this image for selection o f constraints plot.setURLGenerator(new StandardPieURLGenerator("", "constraint")); // simple labels use less horizontal space plot.setSimpleLabels(true);/*from ww w . ja va 2 s. c om*/ return chart; }