List of usage examples for java.awt Color PINK
Color PINK
To view the source code for java.awt Color PINK.
Click Source Link
From source file:sentimentanalyzer.ChartController.java
public Color getRandomColor() { Color[] picker = new Color[10]; picker[0] = Color.ORANGE;// www . j a v a2 s. c o m picker[1] = Color.BLUE; picker[2] = Color.GREEN; picker[3] = Color.YELLOW; picker[4] = Color.BLACK; picker[5] = Color.PINK; picker[6] = Color.CYAN; picker[7] = Color.MAGENTA; picker[8] = Color.RED; picker[9] = Color.GRAY; int index = new Random().nextInt(picker.length); return picker[index]; }
From source file:com.jaspersoft.studio.components.chart.editor.wizard.BaseSettingsFactory.java
/** * *//*from w w w. jav a2s .c o m*/ public static final ChartThemeSettings createChartThemeSettings() { ChartThemeSettings settings = new ChartThemeSettings(); ChartSettings chartSettings = settings.getChartSettings(); chartSettings.setBackgroundPaint(new GradientPaintProvider(CHART_BACKGROUND1, CHART_BACKGROUND2)); chartSettings.setBackgroundImage( new FileImageProvider("net/sf/jasperreports/chartthemes/simple/jasperreports.png")); chartSettings.setBackgroundImageAlignment(new Integer(Align.TOP_RIGHT)); chartSettings.setBackgroundImageAlpha(new Float(1f)); chartSettings.setBorderVisible(Boolean.FALSE); chartSettings.setBorderPaint(new ColorProvider(Color.BLACK)); chartSettings.setBorderStroke(new BasicStroke(1f)); chartSettings.setAntiAlias(Boolean.TRUE); chartSettings.setTextAntiAlias(Boolean.TRUE); chartSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); TitleSettings titleSettings = settings.getTitleSettings(); titleSettings.setShowTitle(Boolean.TRUE); titleSettings.setPosition(EdgeEnum.TOP); titleSettings.setForegroundPaint(new ColorProvider(Color.black)); titleSettings.setBackgroundPaint(new ColorProvider(TITLE_BACKGROUND)); titleSettings.getFont().setBold(Boolean.TRUE); titleSettings.getFont().setFontSize(22); titleSettings.setHorizontalAlignment(HorizontalAlignment.CENTER); titleSettings.setVerticalAlignment(VerticalAlignment.TOP); titleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); TitleSettings subtitleSettings = settings.getSubtitleSettings(); subtitleSettings.setShowTitle(Boolean.TRUE); subtitleSettings.setPosition(EdgeEnum.TOP); subtitleSettings.setForegroundPaint(new ColorProvider(Color.BLACK)); subtitleSettings.setBackgroundPaint(new ColorProvider(SUBTITLE_BACKGROUND)); subtitleSettings.getFont().setBold(Boolean.TRUE); subtitleSettings.setHorizontalAlignment(HorizontalAlignment.CENTER); subtitleSettings.setVerticalAlignment(VerticalAlignment.TOP); subtitleSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); LegendSettings legendSettings = settings.getLegendSettings(); legendSettings.setShowLegend(Boolean.TRUE); legendSettings.setPosition(EdgeEnum.BOTTOM); legendSettings.setForegroundPaint(new ColorProvider(Color.black)); legendSettings.setBackgroundPaint(new ColorProvider(Color.white)); legendSettings.getFont().setBold(Boolean.TRUE); legendSettings.getFont().setFontSize(7); legendSettings.setHorizontalAlignment(HorizontalAlignment.CENTER); legendSettings.setVerticalAlignment(VerticalAlignment.BOTTOM); //FIXMETHEME legendSettings.setBlockFrame(); legendSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); PlotSettings plotSettings = settings.getPlotSettings(); plotSettings.setOrientation(PlotOrientation.VERTICAL); // plotSettings.setForegroundAlpha(new Float(0.5f)); plotSettings.setBackgroundPaint(new ColorProvider(Color.white)); plotSettings.setBackgroundAlpha(new Float(0.0f)); plotSettings.setBackgroundImage( new FileImageProvider("net/sf/jasperreports/chartthemes/simple/jasperreports.png")); plotSettings.setBackgroundImageAlpha(new Float(0.5f)); plotSettings.setBackgroundImageAlignment(new Integer(Align.NORTH_WEST)); plotSettings.setLabelRotation(new Double(0)); plotSettings.setPadding(new RectangleInsets(UnitType.ABSOLUTE, 1.1, 2.2, 3.3, 4.4)); plotSettings.setOutlineVisible(Boolean.TRUE); plotSettings.setOutlinePaint(new ColorProvider(Color.BLACK)); plotSettings.setOutlineStroke(new BasicStroke(1f)); plotSettings.setSeriesColorSequence(COLORS); // plotSettings.setSeriesGradientPaintSequence(GRADIENT_PAINTS); plotSettings.setSeriesOutlinePaintSequence(COLORS_DARKER); plotSettings.setSeriesStrokeSequence(STROKES); plotSettings.setSeriesOutlineStrokeSequence(OUTLINE_STROKES); plotSettings.setDomainGridlineVisible(Boolean.TRUE); plotSettings.setDomainGridlinePaint(new ColorProvider(Color.BLACK)); plotSettings.setDomainGridlineStroke(new BasicStroke(0.5f)); plotSettings.setRangeGridlineVisible(Boolean.TRUE); plotSettings.setRangeGridlinePaint(new ColorProvider(Color.BLACK)); plotSettings.setRangeGridlineStroke(new BasicStroke(0.5f)); plotSettings.getTickLabelFont().setFontName("Arial"); plotSettings.getTickLabelFont().setBold(Boolean.TRUE); plotSettings.getTickLabelFont().setFontSize(10); plotSettings.getDisplayFont().setFontName("Arial"); plotSettings.getDisplayFont().setBold(Boolean.TRUE); plotSettings.getDisplayFont().setFontSize(12); AxisSettings domainAxisSettings = settings.getDomainAxisSettings(); domainAxisSettings.setVisible(Boolean.TRUE); domainAxisSettings.setLocation(AxisLocation.BOTTOM_OR_RIGHT); domainAxisSettings.setLinePaint(new ColorProvider(Color.white)); domainAxisSettings.setLineStroke(new BasicStroke(1f)); domainAxisSettings.setLineVisible(Boolean.TRUE); // domainAxisSettings.setLabel("Domain Axis"); domainAxisSettings.setLabelAngle(new Double(0.0)); domainAxisSettings.setLabelPaint(new ColorProvider(Color.black)); domainAxisSettings.getLabelFont().setBold(Boolean.TRUE); domainAxisSettings.getLabelFont().setItalic(Boolean.FALSE); domainAxisSettings.getLabelFont().setFontName("Times New Roman"); domainAxisSettings.getLabelFont().setFontSize(10); domainAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1)); domainAxisSettings.setLabelVisible(Boolean.TRUE); domainAxisSettings.setTickLabelPaint(new ColorProvider(Color.cyan)); domainAxisSettings.getTickLabelFont().setBold(Boolean.TRUE); domainAxisSettings.getTickLabelFont().setItalic(Boolean.FALSE); domainAxisSettings.getTickLabelFont().setFontName("Times New Roman"); domainAxisSettings.getTickLabelFont().setFontSize(7); domainAxisSettings.getTickLabelFont().setItalic(Boolean.TRUE); domainAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5)); domainAxisSettings.setTickLabelsVisible(Boolean.TRUE); domainAxisSettings.setTickMarksInsideLength(new Float(0.1f)); domainAxisSettings.setTickMarksOutsideLength(new Float(0.2f)); domainAxisSettings.setTickMarksPaint(new ColorProvider(Color.black)); domainAxisSettings.setTickMarksStroke(new BasicStroke(1f)); domainAxisSettings.setTickMarksVisible(Boolean.TRUE); domainAxisSettings.setTickCount(new Integer(5)); AxisSettings rangeAxisSettings = settings.getRangeAxisSettings(); rangeAxisSettings.setVisible(Boolean.TRUE); rangeAxisSettings.setLocation(AxisLocation.TOP_OR_RIGHT); rangeAxisSettings.setLinePaint(new ColorProvider(Color.white)); rangeAxisSettings.setLineStroke(new BasicStroke(1f)); rangeAxisSettings.setLineVisible(Boolean.TRUE); // rangeAxisSettings.setLabel("Range Axis"); rangeAxisSettings.setLabelAngle(new Double(Math.PI / 2.0)); rangeAxisSettings.setLabelPaint(new ColorProvider(Color.black)); rangeAxisSettings.getLabelFont().setBold(Boolean.TRUE); rangeAxisSettings.getLabelFont().setItalic(Boolean.FALSE); rangeAxisSettings.getLabelFont().setFontName("Times New Roman"); rangeAxisSettings.getLabelFont().setFontSize(10); rangeAxisSettings.setLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 1, 1)); rangeAxisSettings.setLabelVisible(Boolean.TRUE); rangeAxisSettings.setTickLabelPaint(new ColorProvider(Color.pink)); rangeAxisSettings.getTickLabelFont().setBold(Boolean.FALSE); rangeAxisSettings.getTickLabelFont().setItalic(Boolean.FALSE); rangeAxisSettings.getTickLabelFont().setFontName("Times New Roman"); rangeAxisSettings.getTickLabelFont().setFontSize(7); rangeAxisSettings.getTickLabelFont().setItalic(Boolean.TRUE); rangeAxisSettings.setTickLabelInsets(new RectangleInsets(UnitType.ABSOLUTE, 0.5, 0.5, 0.5, 0.5)); rangeAxisSettings.setTickLabelsVisible(Boolean.TRUE); rangeAxisSettings.setTickMarksInsideLength(new Float(0.2f)); rangeAxisSettings.setTickMarksOutsideLength(new Float(0.1f)); rangeAxisSettings.setTickMarksPaint(new ColorProvider(Color.black)); rangeAxisSettings.setTickMarksStroke(new BasicStroke(1f)); rangeAxisSettings.setTickMarksVisible(Boolean.TRUE); rangeAxisSettings.setTickCount(new Integer(6)); return settings; }
From source file:org.tsho.dmc2.core.chart.DmcLyapunovPlot.java
public boolean renderArea(Graphics2D g2, Rectangle2D dataArea) { CoreStatusEvent statusEv = new CoreStatusEvent(this); g2.setPaint(paint);/*from w w w. j a v a2 s.co m*/ final double parHStep, parVStep; double parHLower = domainAxis.getRange().getLowerBound(); double parHUpper = domainAxis.getRange().getUpperBound(); double parVLower = rangeAxis.getRange().getLowerBound(); double parVUpper = rangeAxis.getRange().getUpperBound(); parHStep = Math.abs(parHUpper - parHLower) / dataArea.getWidth(); parVStep = Math.abs(parVUpper - parVLower) / dataArea.getHeight(); final BufferedImage image = new BufferedImage((int) dataArea.getWidth(), (int) dataArea.getHeight(), BufferedImage.TYPE_INT_RGB); WritableRaster raster = image.getRaster(); DataBufferInt dataBuffer = (DataBufferInt) raster.getDataBuffer(); int[] data = dataBuffer.getData(); final double parHStart = parHLower + parHStep / 2; final double parVStart = parVUpper - parVStep / 2; for (int i = 0; i < (int) dataArea.getWidth(); i++) { for (int j = 0; j < (int) dataArea.getHeight(); j++) { parameters.put(firstParLabel, parHStart + i * parHStep); parameters.put(secondParLabel, parVStart - j * parVStep); double[] result; int color; try { result = Lua.evaluateLyapunovExponents(model, parameters, initialPoint, iterations); } catch (ModelException e) { String mess = "Exception while:\n" + dumpVariableDoubles(parameters) + dumpVariableDoubles(initialPoint); throw new ModelException(mess, e); } if (result == null) { System.out.println("i: " + i + " j: " + j); System.out.println("par1: " + parHStart + i * parHStep); System.out.println("par2: " + parVStart + j * parVStep); g2.drawImage(image, null, (int) dataArea.getX() + 1, (int) dataArea.getY() + 1); statusEv.setStatusString("exception"); statusEv.setType(CoreStatusEvent.STRING); notifyCoreStatusListeners(statusEv); return false; } // both zero if (Math.abs(result[0]) < epsilon && Math.abs(result[1]) < epsilon) { color = Color.black.getRGB(); } // one zero one positive else if (Math.abs(result[0]) < epsilon && result[1] > 0 || Math.abs(result[1]) < epsilon && result[0] > 0) { color = Color.red.getRGB(); } // one zero one negative else if (Math.abs(result[0]) < epsilon && result[1] < 0 || Math.abs(result[1]) < epsilon && result[0] < 0) { color = Color.blue.getRGB(); } // one positive one negative else if (result[0] < 0 && result[1] > 0 || result[1] < 0 && result[0] > 0) { color = Color.green.getRGB(); } // both positive else if (result[0] > 0 && result[1] > 0) { color = Color.orange.getRGB(); } // both negative else if (result[0] < 0 && result[1] < 0) { color = Color.pink.getRGB(); } else { // impossible color = Color.yellow.getRGB(); } data[i + j * (int) dataArea.getWidth()] = color; if (stopped == true) { return false; } if (j == (int) dataArea.getHeight() - 1) { g2.drawImage(image, null, (int) dataArea.getX() + 1, (int) dataArea.getY() + 1); statusEv.setPercent(0); statusEv.setType(CoreStatusEvent.COUNT | CoreStatusEvent.PERCENT); notifyCoreStatusListeners(statusEv); } } } return true; }
From source file:Engine.Player.java
public ArrayList<DPolygon> GetPolygons(double x, double y) { /*Cube head = new Cube(- halfHeadSize + x, - halfHeadSize + y, ViewFrom[2] - halfHeadSize + epsBody, halfHeadSize * 2.0, halfHeadSize * 2.0, halfHeadSize * 2.0, Color.YELLOW, PlayerId); head.Polys[2].DrawablePolygon.texture = GenerateTerrain.img; //from w ww.j ava 2s .c o m Cube neck = new Cube(- halfNeckSize + x, - halfNeckSize + y, ViewFrom[2] - headSize + halfNeckSize, halfNeckSize * 2.0, halfNeckSize * 2.0, halfNeckSize, Color.PINK, PlayerId); Cube corpus = new Cube(- halfCorupsXSize + x, - halfCorupsYSize + y, ViewFrom[2] - corpusZSize - headSize + halfNeckSize - epsBody, halfCorupsXSize * 2.0, halfCorupsYSize * 2.0, 2 * halfCorpusZSize, Color.BLUE, PlayerId); Cube legs = new Cube(- halfLegSizeX + x, - halfLegSizeY + y, ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody, 2 * halfLegSizeX, 2 * halfLegSizeY, legZSize, Color.MAGENTA, PlayerId); Cube hands = new Cube(- halfHandsXSize + x, - halfHandsYSize + y, ViewFrom[2] - handsZSize - headSize + halfNeckSize - epsBody, halfHandsXSize * 2.0, halfHandsYSize * 2.0, handsZSize, Color.CYAN, PlayerId); ArrayList<DPolygon> all = new ArrayList<DPolygon>(); rot += 0.01; head.rotation = rot; head.setRotAdd(); head.updatePoly(); neck.rotation = rot; neck.updatePoly(); corpus.rotation = rot; corpus.updatePoly(); legs.rotation = rot; legs.updatePoly(); hands.rotation = rot; hands.updatePoly(); AddArrayToArrayList(all, head.GetPolygons()); AddArrayToArrayList(all, neck.GetPolygons()); AddArrayToArrayList(all, corpus.GetPolygons()); AddArrayToArrayList(all, hands.GetPolygons()); AddArrayToArrayList(all, legs.GetPolygons());*/ //rot = Math.PI*0.75; //rot += 0.01; /*if (MoveDirection != null) { //0 if (Math.abs(MoveDirection.getX()) < 0.1 && MoveDirection.getY() > 0.1) rot = 0; //1/4 if (MoveDirection.getX() > 0.1 && MoveDirection.getY() > 0.1) rot = -Math.PI / 4.0; //1/2 if (MoveDirection.getX() > 0.1 && Math.abs(MoveDirection.getY()) < 0.1) rot = -Math.PI / 2.0; //3/4 if (MoveDirection.getX() > 0.1 && MoveDirection.getY() < 0.1) rot = -3.0 * Math.PI / 4.0; //1 if (Math.abs(MoveDirection.getX()) < 0.1 && MoveDirection.getY() < 0.1) rot = -Math.PI; //5/4 if (MoveDirection.getX() < 0.1 && MoveDirection.getY() < 0.1) rot = -5.0 * Math.PI / 4.0; //3/2 if (MoveDirection.getX() < 0.1 && Math.abs(MoveDirection.getY()) < 0.1) rot = -3.0 * Math.PI / 2.0; //7/4 if (MoveDirection.getX() < 0.1 && MoveDirection.getY() > 0.1) rot = -7.0 * Math.PI / 4.0; rot += 2 * Math.PI / 4; }*/ if (PositionIFace != null) { rot = Math.PI / 4.0; Vector3D v1 = new Vector3D(PositionIFace.getX(), PositionIFace.getY(), 0); Vector3D v2 = new Vector3D(ViewFrom[0], ViewFrom[1], 0); Vector3D v3 = (v1.subtract(v2)).normalize(); Vector3D cross = Vector3D.crossProduct(v3, new Vector3D(1, 0, 0)); double dot = Vector3D.dotProduct(v3, new Vector3D(1, 0, 0)); double angle = Math.atan2(cross.getZ(), dot); rot += -angle; } double xx = -halfHeadSize + x; double yy = -halfHeadSize + y; double[] r = rotatePoint(xx, yy, xx, yy, rot - Math.PI * 0.75); Cube head = new Cube(r[0], r[1], ViewFrom[2] - halfHeadSize + epsBody, halfHeadSize * 2.0, halfHeadSize * 2.0, halfHeadSize * 2.0, Color.YELLOW, PlayerId); head.Polys[2].DrawablePolygon.texture = GenerateTerrain.img; Cube neck = new Cube(-halfNeckSize + x, -halfNeckSize + y, ViewFrom[2] - headSize + halfNeckSize, halfNeckSize * 2.0, halfNeckSize * 2.0, halfNeckSize, Color.PINK, PlayerId); Cube corpus = new Cube(-halfCorupsXSize + x, -halfCorupsYSize + y, ViewFrom[2] - corpusZSize - headSize + halfNeckSize - epsBody, halfCorupsXSize * 2.0, halfCorupsYSize * 2.0, 2 * halfCorpusZSize, Color.BLUE, PlayerId); Cube legs = new Cube(-halfLegSizeX + x, -halfLegSizeY + y, ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody, 2 * halfLegSizeX, 2 * halfLegSizeY, legZSize, Color.MAGENTA, PlayerId); xx = -halfHandsXSize + x; yy = -halfHandsYSize + y;//- halfHandsYSize + (halfHandsYSize / 2.0) + y; r = rotatePoint(xx, yy, x - 0.5, y - halfHandsYSize, rot - Math.PI * 0.75); Cube handLeft = new Cube(r[0], r[1], ViewFrom[2] - handsZSize - headSize + halfNeckSize - epsBody, 1, halfHandsYSize * 2.0, handsZSize, Color.CYAN, PlayerId); xx = halfHandsXSize + x - 1; yy = -halfHandsYSize + y;//- halfHandsYSize + (halfHandsYSize / 2.0) + y; r = rotatePoint(xx, yy, x - 0.5, y - halfHandsYSize, rot - Math.PI * 0.75); Cube handRight = new Cube(r[0], r[1], ViewFrom[2] - handsZSize - headSize + halfNeckSize - epsBody, 1, halfHandsYSize * 2.0, handsZSize, Color.CYAN, PlayerId); xx = -2 + x; yy = -halfLegSizeY + y;//- halfHandsYSize + (halfHandsYSize / 2.0) + y; r = rotatePoint(xx, yy, x - 0.75, y - halfLegSizeY, rot - Math.PI * 0.75); Cube legLeft = new Cube(r[0], r[1], ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody, 1.5, halfLegSizeY * 2.0, legZSize, Color.CYAN, PlayerId); xx = 2 + x - 1.5; yy = -halfLegSizeY + y;//- halfHandsYSize + (halfHandsYSize / 2.0) + y; r = rotatePoint(xx, yy, x - 0.75, y - halfLegSizeY, rot - Math.PI * 0.75); Cube legRight = new Cube(r[0], r[1], ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody, 1.5, halfLegSizeY * 2.0, legZSize, Color.CYAN, PlayerId); //Cube legs = new Cube(- halfLegSizeX + x, - halfLegSizeY + y, ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody, // 2 * halfLegSizeX, 2 * halfLegSizeY, legZSize, Color.MAGENTA, PlayerId); ArrayList<DPolygon> all = new ArrayList<DPolygon>(); //rot += 0.00; head.rotation = rot; head.setRotAdd(); head.updatePoly(); neck.rotation = rot; neck.updatePoly(); corpus.rotation = rot; corpus.updatePoly(); legs.rotation = rot; legs.updatePoly(); handLeft.rotation = rot; handLeft.updatePoly(); handRight.rotation = rot; handRight.updatePoly(); legLeft.rotation = rot; legLeft.updatePoly(); legRight.rotation = rot; legRight.updatePoly(); AddArrayToArrayList(all, head.GetPolygons()); AddArrayToArrayList(all, neck.GetPolygons()); AddArrayToArrayList(all, corpus.GetPolygons()); AddArrayToArrayList(all, handLeft.GetPolygons()); AddArrayToArrayList(all, handRight.GetPolygons()); AddArrayToArrayList(all, legLeft.GetPolygons()); AddArrayToArrayList(all, legRight.GetPolygons()); /* //rot = Math.PI*0.75; rot += 0.01; double xx = - halfHeadSize + x; double yy = - halfHeadSize + y; double[]r = rotatePoint(xx, yy, xx, yy, rot - Math.PI*0.75); Cube head = new Cube(r[0], r[1], ViewFrom[2] - halfHeadSize + epsBody, halfHeadSize * 2.0, halfHeadSize * 2.0, halfHeadSize * 2.0, Color.YELLOW, PlayerId, x, y, rot - Math.PI*0.75); head.Polys[2].DrawablePolygon.texture = GenerateTerrain.img; Cube neck = new Cube(- halfNeckSize + x, - halfNeckSize + y, ViewFrom[2] - headSize + halfNeckSize, halfNeckSize * 2.0, halfNeckSize * 2.0, halfNeckSize, Color.PINK, PlayerId, x, y, rot - Math.PI*0.75); Cube corpus = new Cube(- halfCorupsXSize + x, - halfCorupsYSize + y, ViewFrom[2] - corpusZSize - headSize + halfNeckSize - epsBody, halfCorupsXSize * 2.0, halfCorupsYSize * 2.0, 2 * halfCorpusZSize, Color.BLUE, PlayerId, x, y, rot - Math.PI*0.75); Cube legs = new Cube(- halfLegSizeX + x, - halfLegSizeY + y, ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody, 2 * halfLegSizeX, 2 * halfLegSizeY, legZSize, Color.MAGENTA, PlayerId, x, y, rot - Math.PI*0.75); //xx = - halfHandsXSize + 0.5 + x; //yy = - halfHandsYSize + (halfHandsYSize / 2.0) + y; Cube hands = new Cube(- halfHandsXSize + x, - halfHandsYSize + y, ViewFrom[2] - handsZSize - headSize + halfNeckSize - epsBody, 1, halfHandsYSize * 2.0, handsZSize, Color.CYAN, PlayerId, x, y, rot - Math.PI*0.75); ArrayList<DPolygon> all = new ArrayList<DPolygon>(); AddArrayToArrayList(all, head.GetPolygons()); AddArrayToArrayList(all, neck.GetPolygons()); AddArrayToArrayList(all, corpus.GetPolygons()); AddArrayToArrayList(all, hands.GetPolygons()); AddArrayToArrayList(all, legs.GetPolygons());*/ return all; }
From source file:com.bdb.weather.display.freeplot.HistoricalFreePlot.java
/** * Create the series for temperature values. * //from ww w. ja va 2 s .c o m * @param stroke The stroke that is used to draw the series * @param timeMethod The method that is used to "get" the date from the record */ private List<FreePlotSeries<HistoricalRecord>> createTemperatureSeries(Stroke stroke, Function<HistoricalRecord, TemporalAccessor> timeMethod) { List<FreePlotSeries<HistoricalRecord>> list = new ArrayList<>(); int n = 0; list.add(new FreePlotSeries<>(OUTDOOR_TEMPERATURE_SERIES_NAME, n++, StageUtilities.toAwtColor(ColorPreferences.getInstance().getOutdoorTempColorPref()), stroke, HistoricalRecord::getAvgOutdoorTemperature, timeMethod, INTERVAL_CLASS)); list.add(new FreePlotSeries<>(INDOOR_TEMPERATURE_SERIES_NAME, n++, StageUtilities.toAwtColor(ColorPreferences.getInstance().getIndoorTempColorPref()), stroke, HistoricalRecord::getIndoorTemperature, timeMethod, INTERVAL_CLASS)); list.add(new FreePlotSeries<>(DEW_POINT_SERIES_NAME, n++, Color.BLUE, stroke, HistoricalRecord::getDewPoint, timeMethod, INTERVAL_CLASS)); list.add(new FreePlotSeries<>(HEAT_INDEX_SERIES_NAME, n++, Color.MAGENTA, stroke, HistoricalRecord::getHeatIndex, timeMethod, INTERVAL_CLASS)); list.add(new FreePlotSeries<>(WIND_CHILL_SERIES_NAME, n++, Color.PINK, stroke, HistoricalRecord::getWindChill, timeMethod, INTERVAL_CLASS)); for (Sensor sensor : ws.getSensorManager().getExtraSensors(SensorType.THERMOMETER)) { Object[] args = { sensor.getSensorId() }; Class[] argTypes = { int.class }; //list.add(new FreePlotSeries(sensor.getName(), n++, Color.BLUE.brighter(), stroke, HistoricalRecord.class.getMethod("getTemperatureForSensor", argTypes), args, timeMethod, INTERVAL_CLASS)); } return list; }
From source file:com.bdb.weather.display.freeplot.SummaryFreePlot.java
/** * Create the JFreeChart series for the pressure values. * /*from www . ja va2s.co m*/ * @param stroke The stroke for the series */ private List<FreePlotSeries<SummaryRecord>> createPressureSeries(Stroke stroke) { List<FreePlotSeries<SummaryRecord>> list = new ArrayList<>(); int n = 0; list.add(new FreePlotSeries<>(MAX_BARO_PRESSURE_SERIES_NAME, n++, Color.ORANGE, stroke, SummaryRecord::getMaxBaroPressure, dateMethod, period)); list.add(new FreePlotSeries<>(MIN_BARO_PRESSURE_SERIES_NAME, n++, Color.PINK, stroke, SummaryRecord::getMinBaroPressure, dateMethod, period)); list.add(new FreePlotSeries<>(MEAN_BARO_PRESSURE_SERIES_NAME, n++, Color.PINK, stroke, SummaryRecord::getAvgBaroPressure, dateMethod, period)); return list; }
From source file:coreferenceresolver.gui.MarkupGUI.java
private JScrollPane newReviewPanel(Review review, int reviewId) throws BadLocationException { //Model//from w w w . jav a2 s . com ReviewElement reviewElement = new ReviewElement(); ScrollablePanel reviewPanel = new ScrollablePanel(); reviewPanel.setLayout(new BoxLayout(reviewPanel, BoxLayout.PAGE_AXIS)); JTextField title = new JTextField("NEW REVIEW " + reviewId); title.setBackground(Color.pink); reviewPanel.add(title); JTextArea reviewContentTxtArea = new JTextArea(); reviewContentTxtArea.setLineWrap(true); reviewContentTxtArea.setWrapStyleWord(true); reviewContentTxtArea.setEditable(false); reviewContentTxtArea.setText(review.getRawContent()); int chainId = 0; for (CorefChain cc : review.getCorefChains()) { for (int npId : cc.getChain()) { NounPhrase np = review.getNounPhrases().get(npId); Object highlighTag = reviewContentTxtArea.getHighlighter().addHighlight(np.getOffsetBegin(), np.getOffsetEnd() + 1, highlightPainters.get(chainId)); this.markupReviews.get(reviewId).getNounPhrases().get(npId).highlighterTag = highlighTag; } ++chainId; } reviewPanel.add(reviewContentTxtArea); ScrollablePanel markupsPanel = new ScrollablePanel(); markupsPanel.setLayout(new BoxLayout(markupsPanel, BoxLayout.PAGE_AXIS)); for (int i = 0; i < review.getNounPhrases().size(); ++i) { JScrollPane newMarkupPanel = newMarkupPanel(review.getNounPhrases().get(i), reviewElement); markupsPanel.add(newMarkupPanel); } JScrollPane scrollMarkupsPanel = new JScrollPane(markupsPanel); //Add Dimension for scrolling Dimension curScreenDimen = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); scrollMarkupsPanel.setPreferredSize(new Dimension((int) curScreenDimen.getWidth() - 50, 400)); reviewPanel.add(scrollMarkupsPanel); //MODEL reviewElement.reviewTextArea = reviewContentTxtArea; reviewElements.add(reviewElement); reviewPanel.add(new JSeparator(SwingConstants.HORIZONTAL)); reviewPanel.add(Box.createVerticalStrut(20)); JScrollPane scrollReviewPanel = new JScrollPane(reviewPanel); return scrollReviewPanel; }
From source file:view.statistics.IssueChart.java
private void showChartBtn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showChartBtn1ActionPerformed String option = "" + optionCombo.getSelectedItem(); String chartType = "" + chartCombo.getSelectedItem(); if (option.equals("Blood Components")) { try {/* w w w.j a va 2s . c om*/ int cryoCount = 0; int ffpCount = 0; int freshBloodCount = 0; int plasmaCount = 0; int plateletsCount = 0; ResultSet rst = null; String year = "" + yearCombo.getSelectedItem(); String month = "" + monthCombo.getSelectedItem(); rst = IssueController.getIssueInfo(year, month); while (rst.next()) { String type = rst.getString("BloodType"); if (type.equalsIgnoreCase("CRYO")) { cryoCount++; } else if (type.equalsIgnoreCase("FFP")) { ffpCount++; } else if (type.equalsIgnoreCase("Fresh Blood")) { freshBloodCount++; } else if (type.equalsIgnoreCase("Plasma/CSP")) { plasmaCount++; } else if (type.equalsIgnoreCase("Platelets")) { plateletsCount++; } } if (chartType.equals("Pie Chart")) { DefaultPieDataset piedataset = new DefaultPieDataset(); piedataset.setValue("CRYO", cryoCount); piedataset.setValue("FFP", ffpCount); piedataset.setValue("Fresh Blood", freshBloodCount); piedataset.setValue("Plasma/CSP", plasmaCount); piedataset.setValue("Platelets", plateletsCount); JFreeChart chart = ChartFactory.createPieChart3D("Issued Blood Components", piedataset, true, true, true); ChartPanel panel = new ChartPanel(chart); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(cryoCount, "Issued Values", "CRYO"); dataset.setValue(ffpCount, "Issued Values", "FFP"); dataset.setValue(freshBloodCount, "Issued Values", "Fresh Blood"); dataset.setValue(plasmaCount, "Issued Values", "Plasma/CSP"); dataset.setValue(plateletsCount, "Issued Values", "Platelets"); if (chartType.equals("Bar Chart")) { JFreeChart chart = ChartFactory.createBarChart3D("Issued Bloood Components", "Blood Component", "Issued Values", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else if (chartType.equals("Line Chart")) { JFreeChart chart = ChartFactory.createLineChart3D("Issued Blood Components", "Blood Component", "Issued Values", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "-1Data Error!", "Warning!", JOptionPane.OK_OPTION); } catch (ClassNotFoundException ex) { Logger.getLogger(IssueChart.class.getName()).log(Level.SEVERE, null, ex); } } else if (option.equals("Blood Groups")) { try { int Apos = 0; int Bpos = 0; int Aneg = 0; int Bneg = 0; int ABpos = 0; int Opos = 0; int ABneg = 0; int Oneg = 0; ResultSet rst = null; String year = "" + yearCombo.getSelectedItem(); String month = "" + monthCombo.getSelectedItem(); rst = IssueController.getIssueInfo(year, month); while (rst.next()) { String type = rst.getString("BloodGroup"); if (type.equalsIgnoreCase("A+")) { Apos++; } else if (type.equalsIgnoreCase("B+")) { Bpos++; } else if (type.equalsIgnoreCase("A-")) { Aneg++; } else if (type.equalsIgnoreCase("B-")) { Bneg++; } else if (type.equalsIgnoreCase("AB+")) { ABpos++; } else if (type.equalsIgnoreCase("AB-")) { ABneg++; } else if (type.equalsIgnoreCase("O+")) { Opos++; } else if (type.equalsIgnoreCase("O-")) { Oneg++; } } if (chartType.equals("Pie Chart")) { DefaultPieDataset piedataset = new DefaultPieDataset(); piedataset.setValue("A+", Apos); piedataset.setValue("A-", Aneg); piedataset.setValue("B+", Bpos); piedataset.setValue("B-", Bneg); piedataset.setValue("AB+", ABpos); piedataset.setValue("AB-", ABneg); piedataset.setValue("O+", Opos); piedataset.setValue("O-", Oneg); JFreeChart chart = ChartFactory.createPieChart3D("Issued Blood Groups", piedataset, true, true, true); ChartPanel panel = new ChartPanel(chart); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(Apos, "Issued Values", "A+"); dataset.setValue(Aneg, "Issued Values", "A-"); dataset.setValue(Bpos, "Issued Values", "B+"); dataset.setValue(Bneg, "Issued Values", "B-"); dataset.setValue(ABpos, "Issued Values", "AB+"); dataset.setValue(ABneg, "Issued Values", "AB-"); dataset.setValue(Opos, "Issued Values", "O+"); dataset.setValue(Oneg, "Issued Values", "O-"); if (chartType.equals("Bar Chart")) { JFreeChart chart = ChartFactory.createBarChart3D("Issued Bloood Groups", "Blood Group", "Issued Values", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else if (chartType.equals("Line Chart")) { JFreeChart chart = ChartFactory.createLineChart3D("Issued Blood Groups", "Blood Group", "Issued Values", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "0Data Error!", "Warning!", JOptionPane.OK_OPTION); } catch (ClassNotFoundException ex) { Logger.getLogger(IssueChart.class.getName()).log(Level.SEVERE, null, ex); } } else if (option.equals("Gender")) { try { int male = 0; int female = 0; ResultSet rst = null; String year = "" + yearCombo.getSelectedItem(); String month = "" + monthCombo.getSelectedItem(); rst = IssueController.getRequesteeInfo(year, month); while (rst.next()) { String type = rst.getString("Gender"); if (type.equalsIgnoreCase("Male")) { male++; } else if (type.equalsIgnoreCase("Female")) { female++; } } if (chartType.equals("Pie Chart")) { DefaultPieDataset piedataset = new DefaultPieDataset(); piedataset.setValue("Male", male); piedataset.setValue("Female", female); JFreeChart chart = ChartFactory.createPieChart3D("Blood Requestees", piedataset, true, true, true); ChartPanel panel = new ChartPanel(chart); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(male, "", "Male"); dataset.setValue(female, "", "Female"); if (chartType.equals("Bar Chart")) { JFreeChart chart = ChartFactory.createBarChart3D("Blood Requestees", "Gender", "", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else if (chartType.equals("Line Chart")) { JFreeChart chart = ChartFactory.createLineChart3D("Blood Requestees", "Gender", "", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "1Data Error!", "Warning!", JOptionPane.OK_OPTION); } catch (ClassNotFoundException ex) { Logger.getLogger(IssueChart.class.getName()).log(Level.SEVERE, null, ex); } } else if (option.equals("Hospitals")) { try { String[] hospitals = new String[10]; int[] hospitalCount = new int[10]; int noOfHospitals = 0; ResultSet rst = null; String year = "" + yearCombo.getSelectedItem(); String month = "" + monthCombo.getSelectedItem(); rst = SampleDetailsController.getAllHospitals(); while (rst.next()) { hospitals[noOfHospitals] = rst.getString("Name"); hospitalCount[noOfHospitals] = 0; noOfHospitals++; } rst = IssueController.getRequesteeInfo(year, month); while (rst.next()) { String type = rst.getString("Hospital"); for (int i = 0; i < noOfHospitals; i++) { if (type.equalsIgnoreCase(hospitals[i])) { hospitalCount[i]++; } } } if (chartType.equals("Pie Chart")) { DefaultPieDataset piedataset = new DefaultPieDataset(); for (int i = 0; i < noOfHospitals; i++) { piedataset.setValue(hospitals[i], hospitalCount[i]); } JFreeChart chart = ChartFactory.createPieChart3D("Issued Hospitals", piedataset, true, true, true); ChartPanel panel = new ChartPanel(chart); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < noOfHospitals; i++) { dataset.setValue(hospitalCount[i], "Issued Values", hospitals[i]); } if (chartType.equals("Bar Chart")) { JFreeChart chart = ChartFactory.createBarChart3D("Issued Hospitals", "Hospital", "Issued Values", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else if (chartType.equals("Line Chart")) { JFreeChart chart = ChartFactory.createLineChart3D("Issued Hospitals", "Hospital", "Issued Values", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } } } catch (SQLException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, "2Data Error!", "Warning!", JOptionPane.OK_OPTION); } catch (ClassNotFoundException ex) { Logger.getLogger(IssueChart.class.getName()).log(Level.SEVERE, null, ex); } } else if (option.equals("Age Groups")) { try { int[] ages = new int[10]; for (int i = 0; i < 10; i++) { ages[i] = 0; } ResultSet rst = null; String year = "" + yearCombo.getSelectedItem(); String month = "" + monthCombo.getSelectedItem(); rst = IssueController.getRequesteeInfo(year, month); while (rst.next()) { int age = Integer.parseInt(rst.getString("Age")); if (age <= 10 && age > 0) { ages[0]++; } else if (age <= 20 && age > 10) { ages[1]++; } else if (age <= 30 && age > 20) { ages[2]++; } else if (age <= 40 && age > 30) { ages[3]++; } else if (age <= 50 && age > 40) { ages[4]++; } else if (age <= 60 && age > 50) { ages[5]++; } else if (age <= 70 && age > 60) { ages[6]++; } else if (age <= 80 && age > 70) { ages[7]++; } else if (age <= 90 && age > 80) { ages[8]++; } else if (age <= 100 && age > 90) { ages[9]++; } } rst = IssueController.getRequesteeInfo(year, month); if (chartType.equals("Pie Chart")) { DefaultPieDataset piedataset = new DefaultPieDataset(); for (int i = 0; i < 10; i++) { piedataset.setValue(i * 10 + "-" + (i * 10 + 10), ages[i]); } JFreeChart chart = ChartFactory.createPieChart3D("Issued Age Groups", piedataset, true, true, true); ChartPanel panel = new ChartPanel(chart); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < 10; i++) { dataset.setValue(ages[i], "Issued Values", i * 10 + "-" + (i * 10 + 10)); } if (chartType.equals("Bar Chart")) { JFreeChart chart = ChartFactory.createBarChart3D("Issued Age Groups", "Age Groups", "Issued Values", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } else if (chartType.equals("Line Chart")) { JFreeChart chart = ChartFactory.createLineChart3D("Issued Age Groups", "Age Groups", "Issued Values", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.PINK); chart.getTitle().setPaint(Color.RED); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); chartArea.add(panel); panel.setSize(chartArea.getSize()); panel.setVisible(true); } } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "3Data Error!", "Warning!", JOptionPane.OK_OPTION); } catch (ClassNotFoundException ex) { Logger.getLogger(IssueChart.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:cs.stats.gui.StatsCharts.java
private ChartPanel createChart(String axisLabel, int type) { int width = (screenSize.width - (screenSize.width / 35)); int height = (int) (screenSize.height - (screenSize.height / (double) 4)); //int width = (screenSize.width - (screenSize.width / 35)) / 2; //int height = (int) (screenSize.height - (screenSize.height / (double) 4)) / 2; lastValue = new double[SUBPLOT_COUNT]; //================= visualise standard chart ========================== CombinedDomainXYPlot combineddomainxyplot = new CombinedDomainXYPlot(new DateAxis("Time")); lastValue[0] = 100D;//from ww w . j a va2 s. c o m TimeSeries timeseries = null; XYPlot xyplot = null; //add new timeseries to modularity row datasets[type] = new TimeSeriesCollection(); NumberAxis numberaxis = new NumberAxis(axisLabel); numberaxis.setAutoRangeIncludesZero(true); //fast StandardXYItemRenderer xyItemRender = new StandardXYItemRenderer(); //original //xyItemRender = new StandardXYItemRenderer(); xyItemRender.setSeriesStroke(0, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(1, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(2, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(3, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(4, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(5, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(6, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(7, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(8, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(9, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); //TODO colours need to be defined statically before the renderer is created! xyplot = new XYPlot(datasets[type], null, numberaxis, xyItemRender); switch (type) { case 0: { xyItemRender.setSeriesPaint(0, Color.BLACK); timeseries = new TimeSeries("Reply rate 1.0", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(1, Color.BLUE); timeseries = new TimeSeries("Reply rate 0.9", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(2, Color.ORANGE); timeseries = new TimeSeries("Reply rate 0.8", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(3, Color.GREEN); timeseries = new TimeSeries("Reply rate 0.7", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(4, Color.MAGENTA); timeseries = new TimeSeries("Reply rate 0.6", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(5, Color.LIGHT_GRAY); timeseries = new TimeSeries("Reply rate 0.5", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(6, Color.YELLOW); timeseries = new TimeSeries("Reply rate 0.4", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); // xyItemRender.setSeriesPaint(7, Color.PINK); // timeseries = new TimeSeries("Reply rate 0.3", org.jfree.data.time.Hour.class); // datasets[type].addSeries(timeseries); // // xyItemRender.setSeriesPaint(8, Color.RED); // timeseries = new TimeSeries("Reply rate 0.2", org.jfree.data.time.Hour.class); // datasets[type].addSeries(timeseries); // // xyItemRender.setSeriesPaint(9, Color.CYAN); // timeseries = new TimeSeries("Reply rate 0.1", org.jfree.data.time.Hour.class); // datasets[type].addSeries(timeseries); } break; case 1: { xyItemRender.setSeriesPaint(0, Color.BLACK); timeseries = new TimeSeries("0% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(1, Color.BLUE); timeseries = new TimeSeries("1% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(2, Color.ORANGE); timeseries = new TimeSeries("2% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(3, Color.GREEN); timeseries = new TimeSeries("3% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(4, Color.MAGENTA); timeseries = new TimeSeries("3.5% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(5, Color.LIGHT_GRAY); timeseries = new TimeSeries("4% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(6, Color.YELLOW); timeseries = new TimeSeries("4.5% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(7, Color.PINK); timeseries = new TimeSeries("5% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(8, Color.RED); timeseries = new TimeSeries("5.5% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(9, Color.CYAN); timeseries = new TimeSeries("6% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); } break; case 2: { xyItemRender.setSeriesPaint(0, Color.GRAY); timeseries = new TimeSeries("Average number of thread replies (per hour)", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); } break; case 3: { xyItemRender.setSeriesPaint(0, Color.GREEN); timeseries = new TimeSeries("New thread arrival activity change (%)", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(1, Color.BLUE); timeseries = new TimeSeries("Thread reply activity change (%)", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); } break; case 4: { xyItemRender.setSeriesPaint(0, Color.GREEN); timeseries = new TimeSeries("Mean thread aswer time", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); } break; } NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis(); //rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setTickUnit(new NumberTickUnit(0.1)); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.add(xyplot); ChartPanel chart = null; switch (type) { case 0: { jfreechart1 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart1.getSubtitle(0); //set legend fonts jfreechart1.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart1.setBorderPaint(Color.black); jfreechart1.setBorderVisible(true); jfreechart1.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis1 = combineddomainxyplot.getDomainAxis(); dateAxis1 = (DateAxis) valueAxis1; dateAxis1.setTickUnit(new DateTickUnit(1, 1)); if (scope1 == 0) { valueAxis1.setAutoRange(true); } else { valueAxis1.setFixedAutoRange(scope1); } chart = new ChartPanel(jfreechart1); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); //chart.add(buildPlotDisplayManagementPanel(valueAxis1, dateAxis1, ddlScope1)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart1.setAntiAlias(false); } break; case 1: { jfreechart2 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart2.getSubtitle(0); //set legend fonts jfreechart2.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart2.setBorderPaint(Color.black); jfreechart2.setBorderVisible(true); jfreechart2.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis2 = combineddomainxyplot.getDomainAxis(); dateAxis2 = (DateAxis) valueAxis2; dateAxis2.setTickUnit(new DateTickUnit(1, 1)); if (scope2 == 0) { valueAxis2.setAutoRange(true); } else { valueAxis2.setFixedAutoRange(scope2); } chart = new ChartPanel(jfreechart2); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart2.setAntiAlias(false); } break; case 2: { jfreechart3 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart3.getSubtitle(0); //set legend fonts jfreechart3.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart3.setBorderPaint(Color.black); jfreechart3.setBorderVisible(true); jfreechart3.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis3 = combineddomainxyplot.getDomainAxis(); dateAxis3 = (DateAxis) valueAxis3; if (scope3 == 0) { valueAxis3.setAutoRange(true); } else { valueAxis3.setFixedAutoRange(scope3); } chart = new ChartPanel(jfreechart3); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); chart.add(buildPlotDisplayManagementPanel(valueAxis3, dateAxis3, ddlScope3)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart3.setAntiAlias(false); } break; case 3: { jfreechart4 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart4.getSubtitle(0); //set legend fonts jfreechart4.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart4.setBorderPaint(Color.black); jfreechart4.setBorderVisible(true); jfreechart4.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis4 = combineddomainxyplot.getDomainAxis(); dateAxis4 = (DateAxis) valueAxis4; if (scope4 == 0) { valueAxis4.setAutoRange(true); } else { valueAxis4.setFixedAutoRange(scope4); } chart = new ChartPanel(jfreechart4); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); chart.add(buildPlotDisplayManagementPanel(valueAxis4, dateAxis4, ddlScope4)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart4.setAntiAlias(false); } break; case 4: { jfreechart5 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart5.getSubtitle(0); //set legend fonts jfreechart5.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart5.setBorderPaint(Color.black); jfreechart5.setBorderVisible(true); jfreechart5.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis5 = combineddomainxyplot.getDomainAxis(); dateAxis5 = (DateAxis) valueAxis5; if (scope5 == 0) { valueAxis5.setAutoRange(true); } else { valueAxis5.setFixedAutoRange(scope5); } chart = new ChartPanel(jfreechart5); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); chart.add(buildPlotDisplayManagementPanel(valueAxis5, dateAxis5, ddlScope5)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart5.setAntiAlias(false); } break; } return chart; }
From source file:com.bdb.weather.display.freeplot.SummaryFreePlot.java
/** * Create the JFreeChart series for the Solar Radiation values. * /*from ww w .ja v a2s . co m*/ * @param stroke The stroke for the series */ private List<FreePlotSeries<SummaryRecord>> createSolarRadiationSeries(Stroke stroke) { List<FreePlotSeries<SummaryRecord>> list = new ArrayList<>(); int n = 0; list.add(new FreePlotSeries<>(MAX_SOLAR_RADIATION_NAME, n++, Color.ORANGE, stroke, SummaryRecord::getMaxSolarRadiation, dateMethod, period)); list.add(new FreePlotSeries<>(MEAN_SOLAR_RADIATION_NAME, n++, Color.PINK, stroke, SummaryRecord::getAvgSolarRadiation, dateMethod, period)); return list; }