List of usage examples for org.jfree.util ShapeUtilities createRegularCross
public static Shape createRegularCross(final float l, final float t)
From source file:org.gumtree.vis.core.internal.StaticValues.java
public static Shape[] createLocalMarkerShape() { Shape[] shapeSeries = new Shape[13]; shapeSeries[0] = null;/*from w ww . j av a2s . co m*/ shapeSeries[1] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[0]; shapeSeries[2] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[1]; shapeSeries[3] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[2]; shapeSeries[4] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[3]; shapeSeries[5] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[4]; shapeSeries[6] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[5]; shapeSeries[7] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[6]; shapeSeries[8] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[7]; shapeSeries[9] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[8]; shapeSeries[10] = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[9]; shapeSeries[11] = ShapeUtilities.createDiagonalCross(3f, 0.5f); shapeSeries[12] = ShapeUtilities.createRegularCross(3f, 0.5f); return shapeSeries; }
From source file:org.apache.qpid.disttest.charting.chartbuilder.SeriesPainter.java
private Shape buildShape(String shapeName) { if ("cross".equalsIgnoreCase(shapeName)) { return ShapeUtilities.createRegularCross(1, 1); } else {//from w ww .ja va2 s . c o m throw new IllegalArgumentException("Unrecognised shape name : '" + shapeName + "'"); } }
From source file:y.graphs.ChartHelperELF.java
private static JFreeChart createChart(final TimeSeriesCollection dataset, Date from, Date to, Config config, ArrayList<ConfigSerie> series) { final JFreeChart chart = ChartFactory.createTimeSeriesChart(Config.getResource("MsgTitleMagGraph"), Config.getResource("TitleDate"), Config.getResource("MsgTitleMagGraphYAxis"), dataset, true, // include legend true, // tooltips false // urls );// w w w .j av a2 s.c o m chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); LegendTitle lt = new LegendTitle(plot); lt.setItemFont(new Font("Dialog", Font.PLAIN, 12)); lt.setBackgroundPaint(Color.white); lt.setFrame(new BlockBorder(Color.white)); lt.setVerticalAlignment(VerticalAlignment.CENTER); XYTitleAnnotation ta = new XYTitleAnnotation(config.getLegendX(), config.getLegendY(), lt, RectangleAnchor.TOP_RIGHT); ta.setMaxWidth(config.getLegendSize()); plot.addAnnotation(ta); chart.removeLegend(); plot.setBackgroundPaint(config.getColorBackgroundELF()); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); final Stroke lineStroke = new BasicStroke((float) config.getLineWidthELF()); for (int si = 0; si < series.size(); si++) { final ConfigSerie cs = series.get(si); renderer.setSeriesLinesVisible(si, cs.isDrawLine()); final float size = cs.getShapeSize(); renderer.setSeriesShapesVisible(si, size > 0); if (size > 0) renderer.setSeriesShape(si, ShapeUtilities.createRegularCross(size, size)); renderer.setSeriesStroke(si, lineStroke); // renderer.setSeriesOutlineStroke(si, lineStroke); renderer.setSeriesPaint(si, cs.getColor()); } plot.setRenderer(renderer); // x axis final DateAxis rangeAxis = (DateAxis) plot.getDomainAxis(); // rangeAxis.setStandardTickUnits(DateAxis.createStandardDateTickUnits()); // Returns a collection of standard date tick units that uses the default time zone. This collection will be used by default, but you are free to create your own collection if you want to rangeAxis.setAutoRange(true); // rangeAxis.setRange(from, to); rangeAxis.setLowerMargin(0.01); rangeAxis.setUpperMargin(0.01); { final Font axisFont = config.getAxisFont(); if (axisFont != null) { rangeAxis.setLabelFont(axisFont); plot.getRangeAxis().setLabelFont(axisFont); } } final String xaxisFmt = config.getAxisFormat(); if (xaxisFmt == null || xaxisFmt.isEmpty()) { double diffInDays = (to.getTime() - from.getTime()) / (1000.0 * 60.0 * 60.0 * 24.0); if (diffInDays < 2) rangeAxis.setDateFormatOverride( new SimpleDateFormat(Config.DEFAULT_TIMEFMT, DateFormatSymbols.getInstance())); else rangeAxis.setDateFormatOverride( new SimpleDateFormat(Config.DEFAULT_SHORTTIMEFMT, DateFormatSymbols.getInstance())); } else rangeAxis.setDateFormatOverride(new SimpleDateFormat(xaxisFmt, DateFormatSymbols.getInstance())); final ValueAxis domain = plot.getRangeAxis(); if (config.getForceYmin() != 0 || config.getForceYmax() != 0) domain.setRange(ElfValue.valueIntToDouble(config.getForceYmin()), ElfValue.valueIntToDouble(config.getForceYmax())); // title final Font titleFont = config.getTitleFont(); if (titleFont != null) chart.getTitle().setFont(titleFont); return chart; }
From source file:y.graphs.ChartHelperSRB.java
private static JFreeChart createChart(final TimeSeriesCollection dataset, Date from, Date to, Config config, ArrayList<ConfigSerie> series) { final JFreeChart chart = ChartFactory.createTimeSeriesChart(Config.getResource("MsgTitleSrbGraph"), Config.getResource("TitleDate"), Config.getResource("MsgTitleSrbGraphYAxis"), dataset, true, // include legend true, // tooltips false // urls );/* www . ja v a2s.c o m*/ chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); LegendTitle lt = new LegendTitle(plot); lt.setItemFont(new Font("Dialog", Font.PLAIN, 12)); lt.setBackgroundPaint(Color.white); lt.setFrame(new BlockBorder(Color.white)); lt.setVerticalAlignment(VerticalAlignment.CENTER); XYTitleAnnotation ta = new XYTitleAnnotation(config.getLegendX(), config.getLegendY(), lt, RectangleAnchor.TOP_RIGHT); ta.setMaxWidth(config.getLegendSize()); plot.addAnnotation(ta); chart.removeLegend(); plot.setBackgroundPaint(config.getColorBackgroundSRB()); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); final Stroke lineStroke = new BasicStroke((float) config.getLineWidthSRB()); for (int si = 0; si < series.size(); si++) { final ConfigSerie cs = series.get(si); renderer.setSeriesLinesVisible(si, cs.isDrawLine()); final float size = cs.getShapeSize(); renderer.setSeriesShapesVisible(si, size > 0); if (size > 0) renderer.setSeriesShape(si, ShapeUtilities.createRegularCross(size, size)); renderer.setSeriesStroke(si, lineStroke); // renderer.setSeriesOutlineStroke(si, lineStroke); renderer.setSeriesPaint(si, cs.getColor()); } plot.setRenderer(renderer); // x axis final DateAxis rangeAxis = (DateAxis) plot.getDomainAxis(); // rangeAxis.setStandardTickUnits(DateAxis.createStandardDateTickUnits()); // Returns a collection of standard date tick units that uses the default time zone. This collection will be used by default, but you are free to create your own collection if you want to rangeAxis.setAutoRange(true); // rangeAxis.setRange(from, to); rangeAxis.setLowerMargin(0.01); rangeAxis.setUpperMargin(0.01); { final Font axisFont = config.getAxisFont(); if (axisFont != null) { rangeAxis.setLabelFont(axisFont); plot.getRangeAxis().setLabelFont(axisFont); } } final String xaxisFmt = config.getAxisFormat(); if (xaxisFmt == null || xaxisFmt.isEmpty()) { double diffInDays = (to.getTime() - from.getTime()) / (1000.0 * 60.0 * 60.0 * 24.0); if (diffInDays < 2) rangeAxis.setDateFormatOverride( new SimpleDateFormat(Config.DEFAULT_TIMEFMT, DateFormatSymbols.getInstance())); else rangeAxis.setDateFormatOverride( new SimpleDateFormat(Config.DEFAULT_SHORTTIMEFMT, DateFormatSymbols.getInstance())); } else rangeAxis.setDateFormatOverride(new SimpleDateFormat(xaxisFmt, DateFormatSymbols.getInstance())); final ValueAxis domain = plot.getRangeAxis(); if (config.getForceYmin() != 0 || config.getForceYmax() != 0) domain.setRange(ElfValue.valueIntToDouble(config.getForceYmin()), ElfValue.valueIntToDouble(config.getForceYmax())); // title final Font titleFont = config.getTitleFont(); if (titleFont != null) chart.getTitle().setFont(titleFont); return chart; }
From source file:regression.gui.RegressionChart.java
/** * Creates a chart./*from w w w . ja v a 2s .com*/ * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createScatterPlot("Wykres funkcji regresji", // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesShape(0, ShapeUtilities.createRegularCross(3, 3)); renderer.setSeriesShape(2, ShapeUtilities.createRegularCross(3, 3)); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); renderer.setSeriesLinesVisible(2, false); plot.setRenderer(renderer); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
From source file:jhplot.HChart.java
/** * Get shape depending on the marker index. * /* w w w . ja va 2 s . c o m*/ * @param index * @return */ private Shape getShape(int index, float size) { // Shape s = ShapeUtilities.createDiamond(4F); double x = -0.5 * size; if (index == 0) return new java.awt.geom.Ellipse2D.Double(x, x, size, size); if (index == 1) return new java.awt.geom.Rectangle2D.Double(x, x, size, size); if (index == 2) return ShapeUtilities.createDiamond(size); if (index == 3) return ShapeUtilities.createDownTriangle(size); if (index == 4) return new java.awt.geom.Ellipse2D.Double(x, x, size, size); if (index == 5) return new java.awt.geom.Rectangle2D.Double(x, x, size, size); if (index == 6) return ShapeUtilities.createDiamond(size); if (index == 7) return ShapeUtilities.createDownTriangle(size); if (index == 7) return ShapeUtilities.createRegularCross(0, size); if (index == 8) return ShapeUtilities.createDiagonalCross(0, size); if (index == 9) return ShapeUtilities.createDiagonalCross(0, size); if (index == 10) return ShapeUtilities.createDiagonalCross(0, size); if (index == 11) new java.awt.geom.Ellipse2D.Double(0.5, 0.5, 1, 1); if (index == 12) return ShapeUtilities.createDiagonalCross(0, size); return new java.awt.geom.Ellipse2D.Double(x, x, size, size); }