List of usage examples for java.awt Color blue
Color blue
To view the source code for java.awt Color blue.
Click Source Link
From source file:com.bdb.weather.display.current.Hygrometer.java
private ChartViewer createChartElements() { humidityPlot.addLayer(//from ww w .j a v a 2 s .com new DialBackground(new GradientPaint(0.0f, 0.0f, Color.LIGHT_GRAY, 100.0f, 0.0f, Color.blue))); StandardDialScale scale = new StandardDialScale(Humidity.MIN_HUMIDITY.get(), Humidity.MAX_HUMIDITY.get(), 240.0, -300.0, 10.0, 9); scale.setTickLabelFont(scale.getTickLabelFont().deriveFont(14.0F).deriveFont(Font.PLAIN)); scale.setTickRadius(.9); scale.setTickLabelFormatter(new DecimalFormat("#")); scale.setTickLabelOffset(.2); scale.setTickLabelPaint(Color.BLACK); humidityPlot.addScale(0, scale); humidityPlot.setDialFrame(new StandardDialFrame()); DialValueIndicator valueInd = new DialValueIndicator(0); valueInd.setNumberFormat(new DecimalFormat("# '%rH'")); Color c = new Color(255, 255, 255, 0); valueInd.setBackgroundPaint(c); valueInd.setOutlinePaint(c); valueInd.setPaint(Color.cyan); humidityPlot.addLayer(valueInd); double angle = valueInd.getAngle(); double radius = valueInd.getRadius(); trendAnnotation.setPaint(Color.cyan); trendAnnotation.setAngle(angle); trendAnnotation.setRadius(radius + .1); humidityPlot.addLayer(trendAnnotation); DialPointer.Pointer pointer = new DialPointer.Pointer(0); humidityPlot.addPointer(pointer); DialCap cap = new DialCap(); cap.setRadius(cap.getRadius() * 1.5); humidityPlot.setCap(cap); range = new StandardDialRange(Humidity.MIN_HUMIDITY.get(), Humidity.MAX_HUMIDITY.get(), Color.BLACK); range.setInnerRadius(.40); range.setOuterRadius(.45); range.setScaleIndex(0); humidityPlot.addLayer(range); JFreeChart chart = new JFreeChart(humidityPlot); chart.setBackgroundPaint(Color.GRAY); ChartViewer chartViewer = new ChartViewer(chart); //chartViewer.setMinHeight(100); //chartViewer.setMinWidth(100); //chartViewer.setMaxHeight(400); //chartViewer.setMaxWidth(400); //chartViewer.setBackground(Color.GRAY); return chartViewer; }
From source file:graficarordenamiento.Graficador.java
public void crearGrafico() { // Creando el Grafico chart = ChartFactory.createBarChart("Grfico de barras", null, null, dataset, PlotOrientation.VERTICAL, false, false, false);/*from www . ja va2 s .c o m*/ chart.setBackgroundPaint(new GradientPaint(0, 0, Color.WHITE, 700, 0, Color.BLACK.brighter(), false)); chart.setBackgroundImageAlpha(0.5f); final CategoryPlot plot = chart.getCategoryPlot(); plot.setNoDataMessage("NO DATA!"); plot.setRangeGridlinePaint(Color.red); plot.setBackgroundPaint(new GradientPaint(0, 0, Color.LIGHT_GRAY, 0, 100, Color.darkGray)); plot.setBackgroundImageAlpha(0.5f); //plot.setDomainGridlinesVisible(true); BarRenderer rend = (BarRenderer) plot.getRenderer(); final ItemLabelPosition e = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0); GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); rend.setSeriesPaint(0, gp0); rend.setSeriesPaint(1, gp1); rend.setSeriesPaint(2, gp2); plot.setRenderer(rend); // change the margin at the top of the range axis... final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); // set up gradient paints for series... }
From source file:net.sf.dynamicreports.test.jasper.chart.GroupedStackedBarChartTest.java
@Override protected void configureReport(JasperReportBuilder rb) { TextColumnBuilder<String> column1; TextColumnBuilder<Integer> column2; Locale.setDefault(Locale.ENGLISH); rb.columns(column1 = col.column("Column1", "field1", String.class), column2 = col.column("Column2", "field2", Integer.class)) .summary(/*from w ww . jav a 2 s.c om*/ cht.groupedStackedBarChart().setCategory(column1) .series(cht.groupedSerie(column2).setSeries(column1).setGroup(column1)) .setShowLabels(true).setShowTickLabels(false).setShowTickMarks(false), cht.stackedBarChart().setCategory(column1) .series(cht.groupedSerie(column2).setSeries(column1).setGroup(column1)) .setCategoryAxisFormat(cht.axisFormat().setLabel("category") .setLabelColor(Color.BLUE).setLabelFont(stl.fontArialBold()) .setTickLabelFont(stl.fontArial().setItalic(true)) .setTickLabelColor(Color.CYAN).setTickLabelRotation(45d) .setLineColor(Color.LIGHT_GRAY)), cht.stackedBarChart().setCategory(column1) .series(cht.groupedSerie(column2).setSeries(column1).setGroup(column1)) .setValueAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE) .setLabelFont(stl.fontArialBold()) .setTickLabelFont(stl.fontArial().setItalic(true)) .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00") .setLineColor(Color.LIGHT_GRAY).setRangeMinValueExpression(1) .setRangeMaxValueExpression(15))); }
From source file:com.yanbang.portal.controller.PortalController.java
/** * ???/*from w w w . j ava2 s .c o m*/ * * @param request * @param response * @return * @throws Exception */ @RequestMapping(params = "action=handleRnd") public void handleRnd(HttpServletRequest request, HttpServletResponse response) throws Exception { response.setHeader("Cache-Control", "no-store"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", 0L); response.setContentType("image/jpeg"); BufferedImage image = new BufferedImage(65, 25, BufferedImage.TYPE_INT_RGB); Graphics g = image.getGraphics(); g.setColor(Color.GRAY); g.fillRect(0, 0, 65, 25); g.setColor(Color.yellow); Font font = new Font("", Font.BOLD, 20); g.setFont(font); Random r = new Random(); String rnd = ""; int ir = r.nextInt(10); rnd = rnd + "" + ir; g.drawString("" + ir, 5, 18); g.setColor(Color.red); ir = r.nextInt(10); rnd = rnd + "" + ir; g.drawString("" + ir, 20, 18); g.setColor(Color.blue); ir = r.nextInt(10); rnd = rnd + "" + ir; g.drawString("" + ir, 35, 18); g.setColor(Color.green); ir = r.nextInt(10); rnd = rnd + "" + ir; g.drawString("" + ir, 50, 18); request.getSession().setAttribute("RND", rnd); ServletOutputStream out = response.getOutputStream(); out.write(ImageUtil.imageToBytes(image, "gif")); out.flush(); out.close(); }
From source file:support.TradingVolumeGui.java
private CategoryPlot createChartFrame(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart("Trading Volume", "Stock", "Volume, USD", dataset, PlotOrientation.HORIZONTAL, true, true, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.DARK_GRAY); plot.setRangeGridlinePaint(Color.DARK_GRAY); plot.getRenderer().setSeriesPaint(0, Color.BLUE); JFrame frame = new JFrame(); frame.setBackground(Color.WHITE); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setTitle("Hazelcast Jet Source Builder Sample"); frame.setBounds(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT); frame.setLayout(new BorderLayout()); frame.add(new ChartPanel(chart)); frame.setVisible(true);/* w w w . j a v a 2s . c o m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent) { hzMap.removeEntryListener(entryListenerId); } }); return plot; }
From source file:org.jfree.chart.demo.MarkerDemo2.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createXYLineChart("Marker Demo 2", "X", "Temperature", xydataset, PlotOrientation.VERTICAL, false, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setDomainGridlinePaint(Color.lightGray); xyplot.setDomainGridlineStroke(new BasicStroke(1.0F)); xyplot.setRangeGridlinePaint(Color.lightGray); xyplot.setRangeGridlineStroke(new BasicStroke(1.0F)); xyplot.setRangeTickBandPaint(new Color(240, 240, 240)); PeriodAxis periodaxis = new PeriodAxis(null, new Hour(0, 30, 6, 2005), new Hour(23, 30, 6, 2005)); PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[2]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Hour.class, new SimpleDateFormat("HH")); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("dd-MMM")); periodaxis.setLabelInfo(aperiodaxislabelinfo); xyplot.setDomainAxis(periodaxis);//from w ww .j a v a 2s . c om ValueAxis valueaxis = xyplot.getRangeAxis(); valueaxis.setRange(0.0D, 100D); XYItemRenderer xyitemrenderer = xyplot.getRenderer(); xyitemrenderer.setSeriesPaint(0, Color.green); xyitemrenderer.setSeriesStroke(0, new BasicStroke(2.0F)); ValueMarker valuemarker = new ValueMarker(80D); valuemarker.setLabelOffsetType(LengthAdjustmentType.EXPAND); valuemarker.setPaint(Color.red); valuemarker.setStroke(new BasicStroke(2.0F)); valuemarker.setLabel("Temperature Threshold"); valuemarker.setLabelFont(new Font("SansSerif", 0, 11)); valuemarker.setLabelPaint(Color.red); valuemarker.setLabelAnchor(RectangleAnchor.TOP_LEFT); valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT); xyplot.addRangeMarker(valuemarker); Hour hour = new Hour(18, 30, 6, 2005); Hour hour1 = new Hour(20, 30, 6, 2005); double d = hour.getFirstMillisecond(); double d1 = hour1.getFirstMillisecond(); IntervalMarker intervalmarker = new IntervalMarker(d, d1); intervalmarker.setLabelOffsetType(LengthAdjustmentType.EXPAND); intervalmarker.setPaint(new Color(150, 150, 255)); intervalmarker.setLabel("Automatic Cooling"); intervalmarker.setLabelFont(new Font("SansSerif", 0, 11)); intervalmarker.setLabelPaint(Color.blue); intervalmarker.setLabelAnchor(RectangleAnchor.TOP_LEFT); intervalmarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT); xyplot.addDomainMarker(intervalmarker, Layer.BACKGROUND); ValueMarker valuemarker1 = new ValueMarker(d, Color.blue, new BasicStroke(2.0F)); ValueMarker valuemarker2 = new ValueMarker(d1, Color.blue, new BasicStroke(2.0F)); xyplot.addDomainMarker(valuemarker1, Layer.BACKGROUND); xyplot.addDomainMarker(valuemarker2, Layer.BACKGROUND); return jfreechart; }
From source file:com.liveperson.infra.akka.actorx.ui.DisplayGraph.java
public static JPanel getGraphPanel() { final VisualizationViewer<String, String> vv = new VisualizationViewer<String, String>(new FRLayout(graph)); vv.setBackground(Color.white); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<String>(vv.getPickedVertexState(), Color.blue, Color.yellow)); vv.getRenderContext().setVertexLabelTransformer(new Transformer<String, String>() { @Override//from w w w .j ava2s . c om public String transform(String s) { return getClassName(s); } }); vv.setVertexToolTipTransformer(new Transformer<String, String>() { @Override public String transform(String s) { return getClassName(s); } }); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<String>(vv.getPickedEdgeState(), Color.black, Color.green)); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<String, String>()); vv.setEdgeToolTipTransformer(new Transformer<String, String>() { @Override public String transform(String edge) { StringBuffer buffer = new StringBuffer(); buffer.append("<html>"); int index = edge.indexOf(Main.DELIMITER); String fromActor = edge.substring(0, index); String toActor = edge.substring(index + Main.DELIMITER.length()); Map<String, Set<String>> connections = castConnectionList.get(fromActor); Set<String> messages = connections.get(toActor); for (String msg : messages) { buffer.append("<p>").append(getClassName(msg)); } buffer.append("</html>"); return buffer.toString(); } }); ToolTipManager.sharedInstance().setDismissDelay(60000); final DefaultModalGraphMouse<String, String> graphMouse = new DefaultModalGraphMouse<String, String>(); graphMouse.setMode(ModalGraphMouse.Mode.PICKING); vv.setGraphMouse(graphMouse); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JButton reset = new JButton("reset"); reset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Layout<String, String> layout = vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = vv.getModel().getRelaxer(); if (relaxer != null) { // if(layout instanceof IterativeContext) { relaxer.stop(); relaxer.prerelax(); relaxer.relax(); } } }); JPanel jp = new JPanel(); jp.setBackground(Color.WHITE); jp.setLayout(new BorderLayout()); jp.add(vv, BorderLayout.CENTER); Class[] combos = getCombos(); final JComboBox jcb = new JComboBox(combos); // use a renderer to shorten the layout name presentation jcb.setRenderer(new DefaultListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String valueString = value.toString(); valueString = valueString.substring(valueString.lastIndexOf('.') + 1); return super.getListCellRendererComponent(list, valueString, index, isSelected, cellHasFocus); } }); jcb.addActionListener(new LayoutChooser(jcb, vv)); jcb.setSelectedItem(FRLayout.class); JPanel control_panel = new JPanel(new GridLayout(2, 1)); JPanel topControls = new JPanel(); JPanel bottomControls = new JPanel(); control_panel.add(topControls); control_panel.add(bottomControls); jp.add(control_panel, BorderLayout.NORTH); topControls.add(jcb); bottomControls.add(plus); bottomControls.add(minus); bottomControls.add(reset); return jp; }
From source file:org.codehaus.mojo.chronos.chart.SummaryThroughputChartSource.java
private XYPlot createThroughputPlot(ResourceBundle bundle, ReportConfig config) { TimeSeriesCollection dataset1 = createThroughputDataset(bundle, config); XYPlot throughputPlot = ChartUtil.newPlot(dataset1, bundle.getString("chronos.label.throughput.requests"), true);// w w w . j ava 2s .co m throughputPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); throughputPlot.getRenderer().setSeriesPaint(0, Color.GREEN); throughputPlot.getRenderer().setSeriesPaint(1, Color.BLUE); throughputPlot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); double maxAvgThroughput = samples.getMaxAverageThroughput(config.getAverageduration(), config.getResponsetimedivider()); String maxThroughputLabel = bundle.getString("chronos.label.maxaveragethroughput"); ChartUtil.addRangeMarker(throughputPlot, maxThroughputLabel, maxAvgThroughput); return throughputPlot; }
From source file:org.jfree.chart.demo.XYBarChartDemo.java
/** * Constructs the demo application./* w ww . j a v a2 s .c o m*/ * * @param title the frame title. */ public XYBarChartDemo(final String title) { super(title); final TimeSeriesCollection data = DemoDatasetFactory.createTimeSeriesCollection1(); data.setDomainIsPointsInTime(false); final JFreeChart chart = ChartFactory.createXYBarChart(title, "X", true, "Y", data, PlotOrientation.VERTICAL, true, false, false); // then customise it a little... chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 1000, 0, Color.blue)); final XYItemRenderer renderer = chart.getXYPlot().getRenderer(); final StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator("{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0.00")); renderer.setToolTipGenerator(generator); final XYPlot plot = chart.getXYPlot(); final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 300)); setContentPane(chartPanel); }
From source file:gov.nih.nci.cma.web.graphing.CMAPrincipalComponentAnalysisPlot.java
public CMAPrincipalComponentAnalysisPlot(Collection<CMAPCADataPoint> dataPoints, PCAcomponent component1, PCAcomponent component2, Map<String, String> sampleGroupNames) { //, ColorByType colorBy) { //this.colorBy = colorBy; this.component1 = component1; this.component2 = component2; this.dataPoints = dataPoints; this.nf.setMaximumFractionDigits(1); this.sampleGroupNames = sampleGroupNames; colorMap.put("1", Color.GREEN); colorMap.put("2", Color.BLUE); colorMap.put("3", Color.YELLOW); colorMap.put("4", Color.CYAN); colorMap.put("5", Color.MAGENTA); colorMap.put("6", Color.ORANGE); colorMap.put("7", Color.PINK); colorMap.put("8", Color.RED); colorMap.put("9", Color.GRAY); createChart();/* ww w . ja v a2 s . co m*/ }