List of usage examples for org.jfree.chart JFreeChart removeLegend
public void removeLegend()
From source file:org.gephi.statistics.plugin.PageRank.java
/** * * @return/*from www .j a va 2 s .co m*/ */ public String getReport() { //distribution of values Map<Double, Integer> dist = new HashMap<Double, Integer>(); for (int i = 0; i < pageranks.length; i++) { Double d = pageranks[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, "PageRanks"); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries); JFreeChart chart = ChartFactory.createXYLineChart("PageRank Distribution", "Score", "Count", dataset, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, true); String imageFile = ChartUtils.renderChart(chart, "pageranks.png"); String report = "<HTML> <BODY> <h1>PageRank Report </h1> " + "<hr> <br />" + "<h2> Parameters: </h2>" + "Epsilon = " + epsilon + "<br>" + "Probability = " + probability + "<br> <h2> Results: </h2>" + imageFile + "<br /><br />" + "<h2> Algorithm: </h2>" + "Sergey Brin, Lawrence Page, <i>The Anatomy of a Large-Scale Hypertextual Web Search Engine</i>, in Proceedings of the seventh International Conference on the World Wide Web (WWW1998):107-117<br />" + "</BODY> </HTML>"; return report; }
From source file:org.fhaes.fhsamplesize.view.SSIZCurveChart.java
/** * Create the chart./*from www . j av a 2s.co m*/ * * @param eventsPerCenturyDataset * @return */ private static JFreeChart createChart(final XYDataset eventsPerCenturyDataset, Integer xcross, Integer ycross) { // JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(null, "Number of series resampled", "Number of events", // eventsPerCenturyDataset, true, true, false); JFreeChart jfreechart = ChartFactory.createScatterPlot(null, "Number of series resampled", "Number of events per century", eventsPerCenturyDataset); jfreechart.setBackgroundPaint(Color.WHITE); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setInsets(new RectangleInsets(5D, 5D, 5D, 20D)); xyplot.setBackgroundPaint(Color.WHITE); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); // xyplot.setDomainGridlinePaint(Color.white); // xyplot.setRangeGridlinePaint(Color.white); DeviationRenderer deviationrenderer = new DeviationRenderer(true, false); deviationrenderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1)); deviationrenderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1)); deviationrenderer.setSeriesStroke(1, new BasicStroke(3F, 1, 1)); deviationrenderer.setSeriesFillPaint(0, new Color(255, 200, 200)); deviationrenderer.setSeriesFillPaint(1, new Color(200, 200, 255)); xyplot.setRenderer(deviationrenderer); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setAutoRangeIncludesZero(false); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); jfreechart.removeLegend(); if (xcross != null && ycross != null) { XYPlot xyp = jfreechart.getXYPlot(); xyp.setRangeCrosshairVisible(true); xyp.setRangeCrosshairValue(ycross, true); xyp.setRangeCrosshairLockedOnData(true); xyp.setDomainCrosshairVisible(true); xyp.setDomainCrosshairValue(xcross, true); xyp.setDomainCrosshairLockedOnData(true); } // Initialize the chart variable for later use chart = jfreechart; return jfreechart; }
From source file:org.gephi.statistics.plugin.ConnectedComponents.java
public String getReport() { Map<Integer, Integer> sizeDist = new HashMap<Integer, Integer>(); for (int v : componentsSize) { if (!sizeDist.containsKey(v)) { sizeDist.put(v, 0);//from w ww . j a v a 2 s. co m } sizeDist.put(v, sizeDist.get(v) + 1); } //Distribution series XYSeries dSeries = ChartUtils.createXYSeries(sizeDist, "Size Distribution"); XYSeriesCollection dataset1 = new XYSeriesCollection(); dataset1.addSeries(dSeries); JFreeChart chart = ChartFactory.createXYLineChart("Size Distribution", "Size (number of nodes)", "Count", dataset1, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, false); String imageFile = ChartUtils.renderChart(chart, "cc-size-distribution.png"); NumberFormat f = new DecimalFormat("#0.000"); String report = "<HTML> <BODY> <h1>Connected Components Report </h1> " + "<hr>" + "<br>" + "<h2> Parameters: </h2>" + "Network Interpretation: " + (isDirected ? "directed" : "undirected") + "<br>" + "<br> <h2> Results: </h2>" + "Number of Weakly Connected Components: " + componentCount + "<br>" + (isDirected ? "Number of Stronlgy Connected Components: " + stronglyCount + "<br>" : "") + "<br /><br />" + imageFile + "<br />" + "<h2> Algorithm: </h2>" + "Robert Tarjan, <i>Depth-First Search and Linear Graph Algorithms</i>, in SIAM Journal on Computing 1 (2): 146160 (1972)<br />" + "</BODY> </HTML>"; return report; }
From source file:org.jax.haplotype.analysis.visualization.GenomicGraphFactory.java
/** * Creates a plot which contains multiple chromosome histograms * @param chromosomeHistograms//from www .ja va2s .c o m * the chromosome histograms * @param xAxisLabel * the X axis label * @param yAxisLabel * the Y axis label * @return * the object for the multiple chromosome plots */ public JFreeChart createMultiChromosomeHistogram( final List<? extends ChromosomeHistogramValues> chromosomeHistograms, final String xAxisLabel, final String yAxisLabel) { // create the y-axis that is shared by all of the chromosomes NumberAxis yAxis = new NumberAxis(); if (yAxisLabel != null) { yAxis.setLabel(yAxisLabel); } // the combined plot makes all of the chromosomes to share the same // y-axis but to have thier own x-axis CombinedRangeXYPlot combinedChromosomePlot = new CombinedRangeXYPlot(yAxis); combinedChromosomePlot.setGap(4.0); // iterate through the chromosomes adding a new plot for each one for (ChromosomeHistogramValues currChromHist : chromosomeHistograms) { // use a weight to ensure that the amount of space that the // subgraph gets on the x-axis is proportional to the chromosome's // extent final int currWeight = (int) (currChromHist.getExtentInBasePairs() / 1000 + 1); final NumberAxis currXAxis = new NumberAxis(); currXAxis.setAutoRangeIncludesZero(false); currXAxis.setTickLabelsVisible(false); currXAxis.setTickMarksVisible(false); currXAxis.setLabel(Integer.toString(currChromHist.getChromosomeNumber())); final XYPlot currPlot = this.createSnpIntervalHistogramPlot(currChromHist.getIntervals(), currChromHist.getVisualInterval(), currXAxis, null); combinedChromosomePlot.add(currPlot, currWeight); } JFreeChart multiChromosomeChart = new JFreeChart(combinedChromosomePlot); multiChromosomeChart.removeLegend(); return multiChromosomeChart; }
From source file:asl.util.PlotMaker2.java
public void writePlot(String fileName) { //System.out.format("== plotTitle=[%s] fileName=[%s]\n", plotTitle, fileName); File outputFile = new File(fileName); // Check that we will be able to output the file without problems and if not --> return if (!checkFileOut(outputFile)) { System.out.format("== plotMaker: request to output plot=[%s] but we are unable to create it " + " --> skip plot\n", fileName); return;//from w w w .j a v a 2s .c om } NumberAxis horizontalAxis = new NumberAxis("x-axis default"); // x = domain if (fileName.contains("nlnm") || fileName.contains("coher") || fileName.contains("stn")) { // NLNM or StationDeviation horizontalAxis = new LogarithmicAxis("Period (sec)"); horizontalAxis.setRange(new Range(1, 11000)); horizontalAxis.setTickUnit(new NumberTickUnit(5.0)); } else { // EventCompareSynthetics/StrongMotion horizontalAxis = new NumberAxis("Time (s)"); double x[] = panels.get(0).getTraces().get(0).getxData(); horizontalAxis.setRange(new Range(x[0], x[x.length - 1])); } CombinedDomainXYPlot combinedPlot = new CombinedDomainXYPlot(horizontalAxis); combinedPlot.setGap(15.); // Loop over (3) panels for this plot: for (Panel panel : panels) { NumberAxis verticalAxis = new NumberAxis("y-axis default"); // y = range if (fileName.contains("nlnm") || fileName.contains("stn")) { // NLNM or StationDeviation verticalAxis = new NumberAxis("PSD 10log10(m**2/s**4)/Hz dB"); verticalAxis.setRange(new Range(-190, -95)); verticalAxis.setTickUnit(new NumberTickUnit(5.0)); } else if (fileName.contains("coher")) { // Coherence verticalAxis = new NumberAxis("Coherence, Gamma"); verticalAxis.setRange(new Range(0, 1.2)); verticalAxis.setTickUnit(new NumberTickUnit(0.1)); } else { // EventCompareSynthetics/StrongMotion verticalAxis = new NumberAxis("Displacement (m)"); } Font fontPlain = new Font("Verdana", Font.PLAIN, 14); Font fontBold = new Font("Verdana", Font.BOLD, 18); verticalAxis.setLabelFont(fontBold); verticalAxis.setTickLabelFont(fontPlain); horizontalAxis.setLabelFont(fontBold); horizontalAxis.setTickLabelFont(fontPlain); XYSeriesCollection seriesCollection = new XYSeriesCollection(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); XYPlot xyplot = new XYPlot((XYDataset) seriesCollection, horizontalAxis, verticalAxis, renderer); xyplot.setDomainGridlinesVisible(true); xyplot.setRangeGridlinesVisible(true); xyplot.setRangeGridlinePaint(Color.black); xyplot.setDomainGridlinePaint(Color.black); // Plot each trace on this panel: int iTrace = 0; for (Trace trace : panel.getTraces()) { XYSeries series = new XYSeries(trace.getName()); double xdata[] = trace.getxData(); double ydata[] = trace.getyData(); for (int k = 0; k < xdata.length; k++) { series.add(xdata[k], ydata[k]); } renderer.setSeriesPaint(iTrace, trace.getColor()); renderer.setSeriesStroke(iTrace, trace.getStroke()); renderer.setSeriesLinesVisible(iTrace, true); renderer.setSeriesShapesVisible(iTrace, false); seriesCollection.addSeries(series); iTrace++; } // Add Annotations for each trace - This is done in a separate loop so that // the upper/lower limits for this panel will be known double xmin = horizontalAxis.getRange().getLowerBound(); double xmax = horizontalAxis.getRange().getUpperBound(); double ymin = verticalAxis.getRange().getLowerBound(); double ymax = verticalAxis.getRange().getUpperBound(); double delX = Math.abs(xmax - xmin); double delY = Math.abs(ymax - ymin); // Annotation (x,y) in normalized units - where upper-right corner = (1,1) double xAnn = 0.97; // Right center coords of the trace name (e.g., "00-LHZ") double yAnn = 0.95; double yOff = 0.05; // Vertical distance between different trace legends iTrace = 0; for (Trace trace : panel.getTraces()) { if (!trace.getName().contains("NLNM") && !trace.getName().contains("NHNM")) { // x1 > x2 > x3, e.g.: // o-------o 00-LHZ // x3 x2 x1 double scale = .01; // Controls distance between trace label and line segment double xL = .04; // Length of trace line segment in legend double xAnn2 = xAnn - scale * trace.getName().length(); double xAnn3 = xAnn - scale * trace.getName().length() - xL; double x1 = xAnn * delX + xmin; // Right hand x-coord of text in range units double x2 = xAnn2 * delX + xmin; // x-coord of line segment end in range units double x3 = xAnn3 * delX + xmin; // x-coord of line segment end in range units double y = (yAnn - (iTrace * yOff)) * delY + ymin; if (horizontalAxis instanceof LogarithmicAxis) { double logMin = Math.log10(xmin); double logMax = Math.log10(xmax); delX = logMax - logMin; x1 = Math.pow(10, xAnn * delX + logMin); x2 = Math.pow(10, xAnn2 * delX + logMin); x3 = Math.pow(10, xAnn3 * delX + logMin); } xyplot.addAnnotation(new XYLineAnnotation(x3, y, x2, y, trace.getStroke(), trace.getColor())); XYTextAnnotation xyText = new XYTextAnnotation(trace.getName(), x1, y); xyText.setFont(new Font("Verdana", Font.BOLD, 18)); xyText.setTextAnchor(TextAnchor.CENTER_RIGHT); xyplot.addAnnotation(xyText); } iTrace++; } combinedPlot.add(xyplot, 1); } // panel final JFreeChart chart = new JFreeChart(combinedPlot); chart.setTitle(new TextTitle(plotTitle, new Font("Verdana", Font.BOLD, 18))); chart.removeLegend(); try { ChartUtilities.saveChartAsPNG(outputFile, chart, 1400, 1400); } catch (IOException e) { System.err.println("Problem occurred creating chart."); } }
From source file:asl.plotmaker.PlotMaker2.java
public void writePlot(String fileName) { // System.out.format("== plotTitle=[%s] fileName=[%s]\n", plotTitle, // fileName); File outputFile = new File(fileName); // Check that we will be able to output the file without problems and if // not --> return if (!checkFileOut(outputFile)) { // System.out.format("== plotMaker: request to output plot=[%s] but we are unable to create it " // + " --> skip plot\n", fileName ); logger.warn("== Request to output plot=[{}] but we are unable to create it " + " --> skip plot\n", fileName);//www . j a va2 s .co m return; } NumberAxis horizontalAxis = new NumberAxis("x-axis default"); // x = // domain if (fileName.contains("alnm") || fileName.contains("nlnm") || fileName.contains("coher") || fileName.contains("stn")) { // NLNM or StationDeviation horizontalAxis = new LogarithmicAxis("Period (sec)"); horizontalAxis.setRange(new Range(1, 11000)); horizontalAxis.setTickUnit(new NumberTickUnit(5.0)); } else { // EventCompareSynthetics/StrongMotion horizontalAxis = new NumberAxis("Time (s)"); double x[] = panels.get(0).getTraces().get(0).getxData(); horizontalAxis.setRange(new Range(x[0], x[x.length - 1])); } CombinedDomainXYPlot combinedPlot = new CombinedDomainXYPlot(horizontalAxis); combinedPlot.setGap(15.); // Loop over (3) panels for this plot: for (Panel panel : panels) { NumberAxis verticalAxis = new NumberAxis("y-axis default"); // y = // range if (fileName.contains("alnm") || fileName.contains("nlnm") || fileName.contains("stn")) { // NLNM // or // StationDeviation verticalAxis = new NumberAxis("PSD 10log10(m**2/s**4)/Hz dB"); verticalAxis.setRange(new Range(-190, -80)); verticalAxis.setTickUnit(new NumberTickUnit(5.0)); } else if (fileName.contains("coher")) { // Coherence verticalAxis = new NumberAxis("Coherence, Gamma"); verticalAxis.setRange(new Range(0, 1.2)); verticalAxis.setTickUnit(new NumberTickUnit(0.1)); } else { // EventCompareSynthetics/StrongMotion verticalAxis = new NumberAxis("Displacement (m)"); } Font fontPlain = new Font("Verdana", Font.PLAIN, 14); Font fontBold = new Font("Verdana", Font.BOLD, 18); verticalAxis.setLabelFont(fontBold); verticalAxis.setTickLabelFont(fontPlain); horizontalAxis.setLabelFont(fontBold); horizontalAxis.setTickLabelFont(fontPlain); XYSeriesCollection seriesCollection = new XYSeriesCollection(); XYDotRenderer renderer = new XYDotRenderer(); XYPlot xyplot = new XYPlot(seriesCollection, horizontalAxis, verticalAxis, renderer); xyplot.setDomainGridlinesVisible(true); xyplot.setRangeGridlinesVisible(true); xyplot.setRangeGridlinePaint(Color.black); xyplot.setDomainGridlinePaint(Color.black); // Plot each trace on this panel: int iTrace = 0; for (Trace trace : panel.getTraces()) { XYSeries series = new XYSeries(trace.getName()); double xdata[] = trace.getxData(); double ydata[] = trace.getyData(); for (int k = 0; k < xdata.length; k++) { series.add(xdata[k], ydata[k]); } renderer.setSeriesPaint(iTrace, trace.getColor()); renderer.setSeriesStroke(iTrace, trace.getStroke()); seriesCollection.addSeries(series); iTrace++; } // Add Annotations for each trace - This is done in a separate loop // so that // the upper/lower limits for this panel will be known double xmin = horizontalAxis.getRange().getLowerBound(); double xmax = horizontalAxis.getRange().getUpperBound(); double ymin = verticalAxis.getRange().getLowerBound(); double ymax = verticalAxis.getRange().getUpperBound(); double delX = Math.abs(xmax - xmin); double delY = Math.abs(ymax - ymin); // Annotation (x,y) in normalized units - where upper-right corner = // (1,1) double xAnn = 0.97; // Right center coords of the trace name (e.g., // "00-LHZ") double yAnn = 0.95; double yOff = 0.05; // Vertical distance between different trace // legends iTrace = 0; for (Trace trace : panel.getTraces()) { if (!trace.getName().contains("NLNM") && !trace.getName().contains("NHNM") && !trace.getName().contains("ALNM")) { // x1 > x2 > x3, e.g.: // o-------o 00-LHZ // x3 x2 x1 double scale = .01; // Controls distance between trace label // and line segment double xL = .04; // Length of trace line segment in legend double xAnn2 = xAnn - scale * trace.getName().length(); double xAnn3 = xAnn - scale * trace.getName().length() - xL; double x1 = xAnn * delX + xmin; // Right hand x-coord of // text in range units double x2 = xAnn2 * delX + xmin; // x-coord of line segment // end in range units double x3 = xAnn3 * delX + xmin; // x-coord of line segment // end in range units double y = (yAnn - (iTrace * yOff)) * delY + ymin; if (horizontalAxis instanceof LogarithmicAxis) { double logMin = Math.log10(xmin); double logMax = Math.log10(xmax); delX = logMax - logMin; x1 = Math.pow(10, xAnn * delX + logMin); x2 = Math.pow(10, xAnn2 * delX + logMin); x3 = Math.pow(10, xAnn3 * delX + logMin); } xyplot.addAnnotation(new XYLineAnnotation(x3, y, x2, y, trace.getStroke(), trace.getColor())); XYTextAnnotation xyText = new XYTextAnnotation(trace.getName(), x1, y); xyText.setFont(new Font("Verdana", Font.BOLD, 18)); xyText.setTextAnchor(TextAnchor.CENTER_RIGHT); xyplot.addAnnotation(xyText); } iTrace++; } combinedPlot.add(xyplot, 1); } // panel final JFreeChart chart = new JFreeChart(combinedPlot); chart.setTitle(new TextTitle(plotTitle, new Font("Verdana", Font.BOLD, 18))); chart.removeLegend(); try { ChartUtilities.saveChartAsPNG(outputFile, chart, 1400, 1400); } catch (IOException e) { // System.err.println("Problem occurred creating chart."); logger.error("IOException:", e); } }
From source file:org.gephi.statistics.plugin.Hits.java
/** * * @return//from ww w . j a v a 2 s . co m */ public String getReport() { //distribution of hub values Map<Double, Integer> distHubs = new HashMap<Double, Integer>(); for (Node node : hub_list) { int n_index = indicies.get(node); Double d = hubs[n_index]; if (distHubs.containsKey(d)) { Integer v = distHubs.get(d); distHubs.put(d, v + 1); } else { distHubs.put(d, 1); } } //distribution of authority values Map<Double, Integer> distAuthorities = new HashMap<Double, Integer>(); for (Node node : auth_list) { int n_index = indicies.get(node); Double d = authority[n_index]; if (distAuthorities.containsKey(d)) { Integer v = distAuthorities.get(d); distAuthorities.put(d, v + 1); } else { distAuthorities.put(d, 1); } } //Distribution of hub series XYSeries dHubsSeries = ChartUtils.createXYSeries(distHubs, "Hubs"); //Distribution of authority series XYSeries dAuthsSeries = ChartUtils.createXYSeries(distAuthorities, "Authority"); XYSeriesCollection datasetHubs = new XYSeriesCollection(); datasetHubs.addSeries(dHubsSeries); XYSeriesCollection datasetAuths = new XYSeriesCollection(); datasetAuths.addSeries(dAuthsSeries); JFreeChart chart = ChartFactory.createXYLineChart("Hubs Distribution", "Score", "Count", datasetHubs, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dHubsSeries, true); String imageFile1 = ChartUtils.renderChart(chart, "hubs.png"); JFreeChart chart2 = ChartFactory.createXYLineChart("Authority Distribution", "Score", "Count", datasetAuths, PlotOrientation.VERTICAL, true, false, false); chart2.removeLegend(); ChartUtils.decorateChart(chart2); ChartUtils.scaleChart(chart2, dAuthsSeries, true); String imageFile2 = ChartUtils.renderChart(chart2, "authorities.png"); String report = "<HTML> <BODY> <h1> HITS Metric Report </h1>" + "<hr>" + "<br />" + "<h2> Parameters: </h2> Ε = " + this.epsilon + "<br /> <h2> Results: </h2><br />" + imageFile1 + "<br />" + imageFile2 + "<br /><br />" + "<h2> Algorithm: </h2>" + "Jon M. Kleinberg, <i>Authoritative Sources in a Hyperlinked Environment</i>, in Journal of the ACM 46 (5): 604632 (1999)<br />" + "</BODY> </HTML>"; return report; }
From source file:org.jfree.eastwood.ChartEngine.java
/** * Creates a line chart./*from w w w.j a v a 2 s. c o m*/ * * @return A line chart. */ private static JFreeChart createLineChart() { GXYPlot plot = new GXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseShapesVisible(false); plot.setRenderer(renderer); JFreeChart chart = new JFreeChart(plot); chart.removeLegend(); chart.setBackgroundPaint(Color.white); renderer.setBasePaint(new Color(0xFF9900)); renderer.setBaseStroke(new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); renderer.setAutoPopulateSeriesPaint(false); renderer.setItemLabelsVisible(true); renderer.setItemLabelGenerator(new GXYPlot.LabelGenerator()); renderer.setItemLabelPaint(new Color(0x333435)); renderer.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT)); GValueAxis xAxis = new GValueAxis(); xAxis.setTickLabelsVisible(false); xAxis.setTickMarksVisible(false); plot.setDomainAxis(xAxis); GValueAxis yAxis = new GValueAxis(); yAxis.setTickLabelsVisible(false); yAxis.setTickMarksVisible(false); plot.setRangeAxis(yAxis); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); return chart; }
From source file:at.ac.tuwien.inso.subcat.ui.widgets.TrendChart.java
public JFreeChart createChart(SelectedChart chart) { assert (chart != null); CategoryAxis domainAxis = new CategoryAxis("Date"); plot = new CombinedDomainCategoryPlot(domainAxis); if (drawingSupplier == null) { drawingSupplier = plot.getDrawingSupplier(); } else {/* www . jav a 2s . c o m*/ plot.setDrawingSupplier(drawingSupplier); } switch (chart) { case LINE: plot.add(trendPlot, 1); break; case BAR: plot.add(sizePlot, 1); break; case BOTH: plot.add(trendPlot, 1); plot.add(sizePlot, 2); break; default: assert (false); } JFreeChart result = new JFreeChart(null, null, plot, true); result.removeLegend(); return result; }
From source file:org.jfree.eastwood.ChartEngine.java
/** * Creates a sparkline chart.// w w w .j a v a 2 s. c o m * * @return A sparkline chart. */ private static JFreeChart createSparklineChart() { GXYPlot plot = new GXYPlot(); plot.setInsets(RectangleInsets.ZERO_INSETS); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseShapesVisible(false); plot.setRenderer(renderer); JFreeChart chart = new JFreeChart(plot); chart.setPadding(RectangleInsets.ZERO_INSETS); chart.removeLegend(); chart.setBackgroundPaint(Color.white); renderer.setBasePaint(new Color(0xFF9900)); renderer.setBaseStroke(new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); renderer.setAutoPopulateSeriesPaint(false); GValueAxis xAxis = new GValueAxis(); xAxis.setVisible(false); plot.setDomainAxis(xAxis); GValueAxis yAxis = new GValueAxis(); yAxis.setVisible(false); plot.setRangeAxis(yAxis); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); return chart; }