List of usage examples for org.jfree.chart.axis NumberAxis setMinorTickMarksVisible
public void setMinorTickMarksVisible(boolean flag)
From source file:org.jfree.chart.demo.selection.SelectionDemo2.java
private static JFreeChart createChart(XYDataset dataset, DatasetSelectionExtension<XYCursor> ext) { JFreeChart chart = ChartFactory.createScatterPlot("SelectionDemo2", "X", "Y", dataset); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainPannable(true);//from w w w . j a va 2s . co m plot.setRangePannable(true); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlineStroke(new BasicStroke(0.0f)); plot.setRangeGridlineStroke(new BasicStroke(0.0f)); plot.setDomainMinorGridlinesVisible(true); plot.setRangeMinorGridlinesVisible(true); XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer(); r.setSeriesFillPaint(0, r.lookupSeriesPaint(0)); r.setSeriesFillPaint(1, r.lookupSeriesPaint(1)); r.setSeriesFillPaint(2, r.lookupSeriesPaint(2)); r.setUseFillPaint(true); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickMarkInsideLength(2.0f); domainAxis.setTickMarkOutsideLength(2.0f); domainAxis.setMinorTickMarksVisible(true); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickMarkInsideLength(2.0f); rangeAxis.setTickMarkOutsideLength(2.0f); rangeAxis.setMinorTickMarksVisible(true); //add selection specific rendering IRSUtilities.setSelectedItemFillPaint(r, ext, Color.white); //register plot as selection change listener ext.addChangeListener(plot); return chart; }
From source file:org.jfree.chart.demo.selection.SelectionDemo3.java
private static JFreeChart createChart(XYDataset dataset, DatasetSelectionExtension<XYCursor> ext) { JFreeChart chart = ChartFactory.createScatterPlot("SelectionDemo3", "X", "Y", dataset); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainPannable(true);//from w ww . j a va 2 s. c o m plot.setRangePannable(true); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlineStroke(new BasicStroke(0.0f)); plot.setRangeGridlineStroke(new BasicStroke(0.0f)); plot.setDomainMinorGridlinesVisible(true); plot.setRangeMinorGridlinesVisible(true); //XYItemRenderer r = plot.getRenderer(); XYDotRenderer r = new XYDotRenderer(); r.setDotHeight(2); r.setDotWidth(2); r.setSeriesPaint(0, Color.blue); r.setSeriesPaint(1, Color.green); r.setSeriesPaint(2, Color.yellow); r.setSeriesPaint(3, Color.orange); plot.setRenderer(r); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickMarkInsideLength(2.0f); domainAxis.setTickMarkOutsideLength(2.0f); domainAxis.setMinorTickMarksVisible(true); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickMarkInsideLength(2.0f); rangeAxis.setTickMarkOutsideLength(2.0f); rangeAxis.setMinorTickMarksVisible(true); //add selection specific rendering IRSUtilities.setSelectedItemPaint(r, ext, Color.red); //register plot as selection change listener ext.addChangeListener(plot); return chart; }
From source file:org.jfree.expdemo.SelectionDemo2.java
private static JFreeChart createChart(XYDataset dataset, DatasetSelectionExtension ext) { JFreeChart chart = ChartFactory.createScatterPlot("SelectionDemo2", "X", "Y", dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainPannable(true);//from www. j a v a2s.co m plot.setRangePannable(true); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlineStroke(new BasicStroke(0.0f)); plot.setRangeGridlineStroke(new BasicStroke(0.0f)); plot.setDomainMinorGridlinesVisible(true); plot.setRangeMinorGridlinesVisible(true); XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer(); r.setSeriesFillPaint(0, r.lookupSeriesPaint(0)); r.setSeriesFillPaint(1, r.lookupSeriesPaint(1)); r.setSeriesFillPaint(2, r.lookupSeriesPaint(2)); r.setUseFillPaint(true); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickMarkInsideLength(2.0f); domainAxis.setTickMarkOutsideLength(2.0f); domainAxis.setMinorTickCount(2); domainAxis.setMinorTickMarksVisible(true); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickMarkInsideLength(2.0f); rangeAxis.setTickMarkOutsideLength(2.0f); rangeAxis.setMinorTickCount(2); rangeAxis.setMinorTickMarksVisible(true); //add selection specific rendering IRSUtilities.setSelectedItemFillPaint(r, ext, Color.white); //register plot as selection change listener ext.addSelectionChangeListener(plot); return chart; }
From source file:org.jfree.expdemo.SelectionDemo3.java
private static JFreeChart createChart(XYDataset dataset, DatasetSelectionExtension ext) { JFreeChart chart = ChartFactory.createScatterPlot("SelectionDemo3", "X", "Y", dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainPannable(true);/*from w w w .j ava 2 s .co m*/ plot.setRangePannable(true); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlineStroke(new BasicStroke(0.0f)); plot.setRangeGridlineStroke(new BasicStroke(0.0f)); plot.setDomainMinorGridlinesVisible(true); plot.setRangeMinorGridlinesVisible(true); //XYItemRenderer r = plot.getRenderer(); XYDotRenderer r = new XYDotRenderer(); r.setDotHeight(2); r.setDotWidth(2); r.setSeriesPaint(0, Color.blue); r.setSeriesPaint(1, Color.green); r.setSeriesPaint(2, Color.yellow); r.setSeriesPaint(3, Color.orange); plot.setRenderer(r); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickMarkInsideLength(2.0f); domainAxis.setTickMarkOutsideLength(2.0f); domainAxis.setMinorTickCount(2); domainAxis.setMinorTickMarksVisible(true); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickMarkInsideLength(2.0f); rangeAxis.setTickMarkOutsideLength(2.0f); rangeAxis.setMinorTickCount(2); rangeAxis.setMinorTickMarksVisible(true); //add selection specific rendering IRSUtilities.setSelectedItemPaint(r, ext, Color.red); //register plot as selection change listener ext.addSelectionChangeListener(plot); return chart; }
From source file:org.gwaspi.reports.PlinkReportLoader.java
private static void appendToCombinedRangePlot(CombinedRangeXYPlot combinedPlot, String chromosome, XYSeriesCollection seriesCol) {//from ww w.ja v a2 s. c o m XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true); renderer.setSeriesPaint(0, Color.blue); JFreeChart subchart = ChartFactory.createScatterPlot("", "Chr " + chromosome, "", seriesCol, PlotOrientation.VERTICAL, true, false, false); XYPlot subplot = (XYPlot) subchart.getPlot(); subplot.setRenderer(renderer); subplot.setBackgroundPaint(null); subplot.setDomainGridlineStroke(new BasicStroke(0.0f)); subplot.setDomainMinorGridlineStroke(new BasicStroke(0.0f)); subplot.setDomainGridlinePaint(Color.blue); subplot.setRangeGridlineStroke(new BasicStroke(0.0f)); subplot.setRangeMinorGridlineStroke(new BasicStroke(0.0f)); subplot.setRangeGridlinePaint(Color.blue); NumberAxis chrAxis = (NumberAxis) subplot.getDomainAxis(); chrAxis.setAxisLineVisible(true); chrAxis.setTickLabelsVisible(true); chrAxis.setTickMarksVisible(true); chrAxis.setTickUnit(new NumberTickUnit(10000)); chrAxis.setAutoRangeIncludesZero(false); NumberAxis log10Axis = (NumberAxis) subplot.getRangeAxis(); log10Axis.setTickMarkInsideLength(2.0f); log10Axis.setTickMarkOutsideLength(2.0f); log10Axis.setMinorTickCount(2); log10Axis.setMinorTickMarksVisible(true); log10Axis.setAxisLineVisible(true); log10Axis.setAutoRangeIncludesZero(false); XYItemRenderer lblRenderer = subplot.getRenderer(); MySeriesItemLabelGenerator lblGenerator = new MySeriesItemLabelGenerator(4.0d, chromosome); lblRenderer.setSeriesItemLabelGenerator(0, lblGenerator); lblRenderer.setSeriesItemLabelGenerator(1, lblGenerator); lblRenderer.setSeriesItemLabelFont(0, new Font("Serif", Font.PLAIN, 12)); lblRenderer.setSeriesItemLabelFont(1, new Font("Serif", Font.PLAIN, 12)); lblRenderer.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.BOTTOM_LEFT, TextAnchor.TOP_LEFT, -Math.PI / 4.0)); lblRenderer.setSeriesPositiveItemLabelPosition(1, new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.BOTTOM_LEFT, TextAnchor.TOP_LEFT, -Math.PI / 4.0)); lblRenderer.setSeriesItemLabelsVisible(0, true); lblRenderer.setSeriesItemLabelsVisible(1, true); combinedPlot.add(subplot, 1); }
From source file:org.openfaces.component.chart.impl.helpers.AxisUtil.java
public static void setupAxisPresentation(String label, Axis axis, FakeAxisStyle axisStyle) { StyleObjectModel model = axisStyle.getStyleObjectModel(); StyleBorderModel border = model.getBorder(); if (border != null) { if (border.getColor() != null) { axis.setAxisLinePaint(border.getColor()); }/*from w ww. j av a2s. c o m*/ if (!border.isNone()) { axis.setAxisLineVisible(true); axis.setAxisLineStroke(PropertiesConverter.toStroke(border)); axis.setTickMarkPaint(border.getColor()); axis.setTickMarksVisible(true); if (!axis.isTickMarksVisible()) axis.setTickMarksVisible(false); } if (border.getStyle().equalsIgnoreCase("none")) { axis.setAxisLineVisible(false); axis.setTickMarksVisible(false); if (axis.isTickMarksVisible()) axis.setTickMarksVisible(true); } } axis.setTickLabelsVisible(axisStyle.isTickLabelsVisible()); if (axisStyle.isLabelVisible() && label != null) { axis.setLabel(label); axis.setLabelPaint(model.getColor()); axis.setLabelFont(CSSUtil.getFont(model)); } if (axisStyle.isTickLabelsVisible()) { axis.setTickLabelsVisible(true); axis.setTickLabelPaint(model.getColor()); axis.setTickLabelFont(CSSUtil.getFont(model)); } else { axis.setTickLabelsVisible(false); } Double tickInterval = axisStyle.getTickInterval(); if (tickInterval != null && tickInterval != 0 && axis instanceof NumberAxis) { NumberAxis numberAxis = (NumberAxis) axis; if (tickInterval > 0) { NumberTickUnit tickUnit = new NumberTickUnit(tickInterval); numberAxis.setTickUnit(tickUnit); } else if (tickInterval == -1) { TickUnitSource tickUnits = NumberAxis.createIntegerTickUnits(); numberAxis.setStandardTickUnits(tickUnits); } else { throw new FacesException("tickInterval must be a positive number for a fixed tick interval, " + "or -1 for automatic integer tick selection: " + tickInterval); } numberAxis.setMinorTickMarksVisible(true); numberAxis.setMinorTickCount(2); numberAxis.setMinorTickMarkOutsideLength(3); numberAxis.setMinorTickMarkInsideLength(3); numberAxis.setTickMarkInsideLength(5); numberAxis.setTickMarkOutsideLength(5); } axis.setTickMarkInsideLength(axisStyle.getTickInsideLength()); axis.setTickMarkOutsideLength(axisStyle.getTickOutsideLength()); if (axisStyle.getMinorTicksVisible()) { axis.setMinorTickMarksVisible(true); if (axis instanceof ValueAxis) ((ValueAxis) axis).setMinorTickCount(axisStyle.getMinorTickCount() + 1); axis.setMinorTickMarkInsideLength(axisStyle.getMinorTickInsideLength()); axis.setMinorTickMarkOutsideLength(axisStyle.getMinorTickOutsideLength()); } else { axis.setMinorTickMarksVisible(false); } }
From source file:org.jgrasstools.gears.utils.images.LineChartGenerator.java
/** * Creates the chart image and dumps it to file. * /* ww w .j av a2 s . c o m*/ * @param chartFile the file to which to write to. * @param autoRange flag to define if to auto define the range from the bounds. * @param withLegend flag to define the legend presence. * @param imageWidth the output image width (if -1 default is used). * @param imageHeight the output image height (if -1 default is used). * @throws IOException */ @SuppressWarnings("nls") public void dumpChart(File chartFile, boolean autoRange, boolean withLegend, int imageWidth, int imageHeight) throws IOException { JFreeChart chart = ChartFactory.createXYLineChart(title, xLabel, yLabel, collection, PlotOrientation.VERTICAL, withLegend, false, false); XYPlot plot = (XYPlot) chart.getPlot(); // plot.setDomainPannable(true); // plot.setRangePannable(true); // plot.setForegroundAlpha(0.85f); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); if (autoRange) { double delta = (max - min) * 0.1; yAxis.setRange(min - delta, max + delta); yAxis.setMinorTickCount(4); yAxis.setMinorTickMarksVisible(true); } // ValueAxis xAxis = plot.getDomainAxis(); // xAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits(Locale.US)); // XYItemRenderer renderer = plot.getRenderer(); // renderer.setDrawBarOutline(false); // // flat bars look best... // renderer.setBarPainter(new StandardXYBarPainter()); // renderer.setShadowVisible(false); if (!chartFile.getName().endsWith(".png")) { chartFile = FileUtilities.substituteExtention(chartFile, "png"); } if (imageWidth == -1) { imageWidth = IMAGEWIDTH; } if (imageHeight == -1) { imageHeight = IMAGEHEIGHT; } BufferedImage bufferedImage = chart.createBufferedImage(imageWidth, imageHeight); ImageIO.write(bufferedImage, "png", chartFile); }
From source file:org.jgrasstools.gears.ui.OmsMatrixCharter.java
private JFreeChart doBarChart() { XYSeriesCollection collection = getSeriesCollection(); XYBarDataset xyBarDataset = new XYBarDataset(collection, minInterval); PlotOrientation orientation = PlotOrientation.VERTICAL; if (doHorizontal) { orientation = PlotOrientation.HORIZONTAL; }/*from ww w . j a v a 2 s . c o m*/ JFreeChart chart = ChartFactory.createHistogram(inTitle, inLabels[0], inLabels[1], xyBarDataset, orientation, doLegend, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setForegroundAlpha(0.85f); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); double delta = (max - min) * 0.1; yAxis.setRange(min, max + delta); yAxis.setMinorTickCount(4); yAxis.setMinorTickMarksVisible(true); if (inFormats != null && inFormats.length > 0 && inFormats[1].trim().length() > 0) { yAxis.setNumberFormatOverride(new DecimalFormat(inFormats[1])); } if (inFormats != null && inFormats.length > 0 && inFormats[0].trim().length() > 0) { ValueAxis domainAxis = plot.getDomainAxis(); if (domainAxis instanceof NumberAxis) { NumberAxis xAxis = (NumberAxis) domainAxis; xAxis.setNumberFormatOverride(new DecimalFormat(inFormats[0])); } } XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setBarPainter(new StandardXYBarPainter()); renderer.setShadowVisible(false); if (inColors != null) { String[] colorSplit = inColors.split(";"); for (int i = 0; i < colorSplit.length; i++) { String[] split = colorSplit[i].split(","); int r = (int) Double.parseDouble(split[0]); int g = (int) Double.parseDouble(split[1]); int b = (int) Double.parseDouble(split[2]); renderer.setSeriesPaint(i, new Color(r, g, b)); } } return chart; }
From source file:org.jgrasstools.gears.ui.OmsMatrixCharter.java
@SuppressWarnings("deprecation") private JFreeChart doLineChart() { XYSeriesCollection collection = getSeriesCollection(); PlotOrientation orientation = PlotOrientation.VERTICAL; if (doHorizontal) { orientation = PlotOrientation.HORIZONTAL; }/*from w w w .j a va2 s. c o m*/ JFreeChart chart = ChartFactory.createXYLineChart(inTitle, inLabels[0], inLabels[1], collection, orientation, doLegend, true, false); XYPlot plot = (XYPlot) chart.getPlot(); // plot.setDomainGridlinePaint(Color.red); // plot.setRangeGridlinePaint(Color.cyan); // plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYItemRenderer plotRenderer = plot.getRenderer(); if (plotRenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plotRenderer; if (doPoints) { renderer.setShapesVisible(true); renderer.setShapesFilled(true); } if (inColors != null) { String[] colorSplit = inColors.split(";"); for (int i = 0; i < colorSplit.length; i++) { String[] split = colorSplit[i].split(","); int r = (int) Double.parseDouble(split[0]); int g = (int) Double.parseDouble(split[1]); int b = (int) Double.parseDouble(split[2]); renderer.setSeriesPaint(i, new Color(r, g, b)); } } } NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); double delta = (max - min) * 0.1; yAxis.setRange(min, max + delta); yAxis.setMinorTickCount(4); yAxis.setMinorTickMarksVisible(true); if (inFormats != null && inFormats.length > 1 && inFormats[1].trim().length() > 0) { yAxis.setNumberFormatOverride(new DecimalFormat(inFormats[1])); } if (inFormats != null && inFormats.length > 0 && inFormats[0].trim().length() > 0) { ValueAxis domainAxis = plot.getDomainAxis(); if (domainAxis instanceof NumberAxis) { NumberAxis xAxis = (NumberAxis) domainAxis; xAxis.setNumberFormatOverride(new DecimalFormat(inFormats[0])); } } return chart; }
From source file:org.owasp.benchmark.score.report.Scatter.java
private JFreeChart display(String title, int height, int width, OverallResults or) { JFrame f = new JFrame(title); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Note: this is a little weird, since each point is a separate series XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries series = new XYSeries("Scores"); for (OverallResult r : or.getResults()) { series.add(r.fpr * 100, r.tpr * 100); }//from w ww . ja v a 2s .c o m dataset.addSeries(series); chart = ChartFactory.createScatterPlot(title, "False Positive Rate", "True Positive Rate", dataset, PlotOrientation.VERTICAL, true, true, false); String fontName = "Arial"; DecimalFormat pctFormat = new DecimalFormat("0'%'"); theme = (StandardChartTheme) org.jfree.chart.StandardChartTheme.createJFreeTheme(); theme.setExtraLargeFont(new Font(fontName, Font.PLAIN, 24)); // title theme.setLargeFont(new Font(fontName, Font.PLAIN, 20)); // axis-title theme.setRegularFont(new Font(fontName, Font.PLAIN, 16)); theme.setSmallFont(new Font(fontName, Font.PLAIN, 12)); theme.setRangeGridlinePaint(Color.decode("#C0C0C0")); theme.setPlotBackgroundPaint(Color.white); theme.setChartBackgroundPaint(Color.white); theme.setGridBandPaint(Color.red); theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); theme.setBarPainter(new StandardBarPainter()); theme.setAxisLabelPaint(Color.decode("#666666")); theme.apply(chart); XYPlot xyplot = chart.getXYPlot(); NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis(); NumberAxis domainAxis = (NumberAxis) xyplot.getDomainAxis(); xyplot.setOutlineVisible(true); rangeAxis.setRange(-9.99, 109.99); rangeAxis.setNumberFormatOverride(pctFormat); rangeAxis.setTickLabelPaint(Color.decode("#666666")); rangeAxis.setMinorTickCount(5); rangeAxis.setTickUnit(new NumberTickUnit(10)); rangeAxis.setAxisLineVisible(true); rangeAxis.setMinorTickMarksVisible(true); rangeAxis.setTickMarksVisible(true); rangeAxis.setLowerMargin(10); rangeAxis.setUpperMargin(10); xyplot.setRangeGridlineStroke(new BasicStroke()); xyplot.setRangeGridlinePaint(Color.lightGray); xyplot.setRangeMinorGridlinePaint(Color.decode("#DDDDDD")); xyplot.setRangeMinorGridlinesVisible(true); domainAxis.setRange(-5, 105); domainAxis.setNumberFormatOverride(pctFormat); domainAxis.setTickLabelPaint(Color.decode("#666666")); domainAxis.setMinorTickCount(5); domainAxis.setTickUnit(new NumberTickUnit(10)); domainAxis.setAxisLineVisible(true); domainAxis.setTickMarksVisible(true); domainAxis.setMinorTickMarksVisible(true); domainAxis.setLowerMargin(10); domainAxis.setUpperMargin(10); xyplot.setDomainGridlineStroke(new BasicStroke()); xyplot.setDomainGridlinePaint(Color.lightGray); xyplot.setDomainMinorGridlinePaint(Color.decode("#DDDDDD")); xyplot.setDomainMinorGridlinesVisible(true); chart.setTextAntiAlias(true); chart.setAntiAlias(true); chart.removeLegend(); chart.setPadding(new RectangleInsets(20, 20, 20, 20)); xyplot.getRenderer().setSeriesPaint(0, Color.decode("#4572a7")); // // setup item labels // XYItemRenderer renderer = xyplot.getRenderer(); // Shape circle = new Ellipse2D.Float(-2.0f, -2.0f, 7.0f, 7.0f); // for ( int i = 0; i < dataset.getSeriesCount(); i++ ) { // renderer.setSeriesShape(i, circle); // renderer.setSeriesPaint(i, Color.blue); // String letter = "" + ((String)dataset.getSeries(i).getKey()).charAt(0); // StandardXYItemLabelGenerator generator = new StandardXYItemLabelGenerator(letter); // renderer.setSeriesItemLabelGenerator(i, generator); // renderer.setSeriesItemLabelsVisible(i, true); // ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER ); // renderer.setSeriesPositiveItemLabelPosition(i, position); // } makeDataLabels(or, xyplot); makeLegend(or, 57, 48, dataset, xyplot); // put legend inside plot // LegendTitle lt = new LegendTitle(xyplot); // lt.setItemFont(theme.getSmallFont()); // lt.setPosition(RectangleEdge.RIGHT); // lt.setItemFont(theme.getSmallFont()); // XYTitleAnnotation ta = new XYTitleAnnotation(.7, .55, lt, RectangleAnchor.TOP_LEFT); // ta.setMaxWidth(0.48); // xyplot.addAnnotation(ta); // draw guessing line Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 6, 3 }, 0); XYLineAnnotation guessing = new XYLineAnnotation(-5, -5, 105, 105, dashed, Color.red); xyplot.addAnnotation(guessing); XYPointerAnnotation worse = makePointer(75, 0, "Worse than guessing", TextAnchor.TOP_CENTER, 90); xyplot.addAnnotation(worse); XYPointerAnnotation better = makePointer(25, 100, "Better than guessing", TextAnchor.BOTTOM_CENTER, 270); xyplot.addAnnotation(better); XYTextAnnotation time = new XYTextAnnotation("Tool run time: " + or.getTime(), 12, -5.6); time.setTextAnchor(TextAnchor.TOP_LEFT); time.setFont(theme.getRegularFont()); time.setPaint(Color.red); xyplot.addAnnotation(time); XYTextAnnotation stroketext = new XYTextAnnotation(" Random Guess", 88, 107); stroketext.setTextAnchor(TextAnchor.CENTER_RIGHT); stroketext.setBackgroundPaint(Color.white); stroketext.setPaint(Color.red); stroketext.setFont(theme.getRegularFont()); xyplot.addAnnotation(stroketext); XYLineAnnotation strokekey = new XYLineAnnotation(58, 107, 68, 107, dashed, Color.red); xyplot.setBackgroundPaint(Color.white); xyplot.addAnnotation(strokekey); ChartPanel cp = new ChartPanel(chart, height, width, 400, 400, 1200, 1200, false, false, false, false, false, false); f.add(cp); f.pack(); f.setLocationRelativeTo(null); // f.setVisible(true); return chart; }