List of usage examples for java.awt Color cyan
Color cyan
To view the source code for java.awt Color cyan.
Click Source Link
From source file:edu.ucla.stat.SOCR.chart.demo.BarChartDemo3.java
/** * Creates a sample chart./* w ww . j a v a 2 s .co m*/ * * @param dataset the dataset. * * @return a sample chart. */ protected JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart(chartTitle, // chart title domainLabel, // domain axis label rangeLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation !legendPanelOn, // include legend true, false); chart.setBackgroundPaint(Color.lightGray); // get a reference to the plot for further customisation... CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA!"); CategoryItemRenderer renderer = new CustomBarRenderer(new Paint[] { Color.red, Color.blue, Color.green, Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue }); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0); renderer.setBasePositiveItemLabelPosition(p); plot.setRenderer(renderer); CategoryMarker marker = new CategoryMarker("Category 3"); marker.setLabel("Special"); marker.setPaint(new Color(0xDD, 0xFF, 0xDD, 0x80)); marker.setAlpha(0.5f); marker.setLabelAnchor(RectangleAnchor.TOP_LEFT); marker.setLabelTextAnchor(TextAnchor.TOP_LEFT); marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT); plot.addDomainMarker(marker, Layer.BACKGROUND); // change the margin at the top of the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); BarRenderer seriesRenderer = (BarRenderer) plot.getRenderer(); seriesRenderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); setCategorySummary(dataset); return chart; }
From source file:jmbench.plots.OperationsVersusSizePlot.java
public static Color getColor(int num) { switch (num) { case 0:/*ww w . j a v a2 s. c om*/ return new Color(0f, 0f, 1f, 0.6f); case 1: return new Color(0.5f, 0.7f, 0f, 0.6f); case 2: return Color.BLACK; case 3: return Color.RED; case 4: return Color.CYAN; case 5: return Color.ORANGE; case 6: return Color.GREEN; case 7: return Color.lightGray; case 8: return Color.blue; case 9: return new Color(255, 0, 255, 190); //magenta with translucent case 10: return new Color(230, 150, 0); // darker orange case 11: return new Color(255, 0, 255, 190); case 12: return new Color(120, 255, 0); default: throw new RuntimeException("add some more"); } }
From source file:net.sf.dynamicreports.test.jasper.chart.StackedBar3DChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//from ww w. j a v a 2 s .c o m JFreeChart chart = getChart("summary.chart1", 0); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", StackedBarRenderer3D.class, categoryPlot.getRenderer().getClass()); BarRenderer3D renderer = (BarRenderer3D) categoryPlot.getRenderer(); Assert.assertTrue("show labels", renderer.getBaseItemLabelsVisible()); Assert.assertEquals("x offset", 2d, renderer.getXOffset()); Assert.assertEquals("y offset", 3d, renderer.getYOffset()); chart = getChart("summary.chart2", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
From source file:au.edu.uwa.csse.plot.Clustering.java
private void setUpView(Graph graph) throws IOException { //Create a simple layout frame //specify the Fruchterman-Rheingold layout algorithm final AggregateLayout<Integer, Number> layout = new AggregateLayout<Integer, Number>( new FRLayout<Integer, Number>(graph)); vv = new VisualizationViewer<Integer, Number>(layout); vv.setBackground(Color.white); vv.setVertexToolTipTransformer(Plot.vertexLabelTransformer); //Tell the renderer to use our own customized color rendering vv.getRenderContext()/*from w w w .j a v a2 s .c o m*/ .setVertexFillPaintTransformer(MapTransformer.<Integer, Paint>getInstance(vertexPaints)); vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Integer, Paint>() { public Paint transform(Integer v) { if (vv.getPickedVertexState().isPicked(v)) { return Color.cyan; } else { return Color.BLACK; } } }); vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints)); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() { protected final Stroke THIN = new BasicStroke(1); protected final Stroke THICK = new BasicStroke(2); public Stroke transform(Number e) { Paint c = edgePaints.get(e); if (c == Color.LIGHT_GRAY) return THIN; else return THICK; } }); //add restart button JButton scramble = new JButton("Restart"); scramble.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Layout layout = vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = vv.getModel().getRelaxer(); if (relaxer != null) { relaxer.stop(); relaxer.prerelax(); relaxer.relax(); } } }); DefaultModalGraphMouse gm = new DefaultModalGraphMouse(); vv.setGraphMouse(gm); final JToggleButton groupVertices = new JToggleButton("Group Clusters"); //Create slider to adjust the number of edges to remove when clustering final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL); edgeBetweennessSlider.setBackground(Color.WHITE); edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50)); edgeBetweennessSlider.setPaintTicks(true); edgeBetweennessSlider.setMaximum(graph.getEdgeCount()); edgeBetweennessSlider.setMinimum(0); edgeBetweennessSlider.setValue(0); edgeBetweennessSlider.setMajorTickSpacing(10); edgeBetweennessSlider.setPaintLabels(true); edgeBetweennessSlider.setPaintTicks(true); // edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black)); //TO DO: edgeBetweennessSlider.add(new JLabel("Node Size (PageRank With Priors):")); //I also want the slider value to appear final JPanel eastControls = new JPanel(); eastControls.setOpaque(true); eastControls.setLayout(new BoxLayout(eastControls, BoxLayout.Y_AXIS)); eastControls.add(Box.createVerticalGlue()); eastControls.add(edgeBetweennessSlider); final String COMMANDSTRING = "Edges removed for clusters: "; final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue(); final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize); eastControls.setBorder(sliderBorder); //eastControls.add(eastSize); eastControls.add(Box.createVerticalGlue()); groupVertices.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors, e.getStateChange() == ItemEvent.SELECTED); vv.repaint(); } }); clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected()); edgeBetweennessSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int numEdgesToRemove = source.getValue(); clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected()); sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue()); eastControls.repaint(); vv.validate(); vv.repaint(); } } }); Container content = getContentPane(); content.add(new GraphZoomScrollPane(vv)); JPanel south = new JPanel(); JPanel grid = new JPanel(new GridLayout(2, 1)); grid.add(scramble); grid.add(groupVertices); south.add(grid); south.add(eastControls); JPanel p = new JPanel(); p.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); p.add(gm.getModeComboBox()); south.add(p); content.add(south, BorderLayout.SOUTH); }
From source file:net.sf.dynamicreports.test.jasper.chart.TimeSeriesChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//from ww w . j a v a 2 s. co m JFreeChart chart = getChart("summary.chart1", 0); XYItemRenderer renderer = chart.getXYPlot().getRenderer(); Assert.assertEquals("renderer", XYLineAndShapeRenderer.class, renderer.getClass()); Assert.assertFalse("show shapes", ((XYLineAndShapeRenderer) renderer).getBaseShapesVisible()); Assert.assertFalse("show lines", ((XYLineAndShapeRenderer) renderer).getBaseLinesVisible()); chart = getChart("summary.chart2", 0); Axis axis = chart.getXYPlot().getDomainAxis(); Assert.assertEquals("category label", "time", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); chart = getChart("summary.chart3", 0); axis = chart.getXYPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); //Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); }
From source file:com.github.dougkelly88.FLIMPlateReaderGUI.FLIMClasses.Classes.FindMaxpoint.java
/** * Creates a chart.//from ww w . j av a 2 s.c o m * * @param dataset the data for the chart. * * @return a chart. */ public JFreeChart createChart() { //http://www.java2s.com/Code/Java/Chart/JFreeChartDualAxisDemo2.htm String xlabel = "Delay (ps)"; String ylabel = "Signal (DN)"; // create the chart with findmaxpoint results final JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title xlabel, // x axis label ylabel, // y axis label findMaxpointData_, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); final XYPlot plot = chart.getXYPlot(); // deal with axes and add second dataset final NumberAxis yaxis1 = (NumberAxis) plot.getRangeAxis(); yaxis1.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10)); yaxis1.setLabelFont(new Font("Dialog", Font.PLAIN, 10)); final NumberAxis yaxis2 = new NumberAxis(null); final NumberAxis xaxis = (NumberAxis) plot.getDomainAxis(); xaxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10)); xaxis.setLabelFont(new Font("Dialog", Font.PLAIN, 10)); plot.setRangeAxis(1, yaxis2); plot.setDataset(1, gatePositionData_); plot.mapDatasetToRangeAxis(1, 1); yaxis1.setRange(0, 5000); yaxis2.setRange(-1, 1); yaxis2.setTickLabelsVisible(false); xaxis.setRange(0, 16666); // deal with visuals final XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer(true, true); renderer1.setSeriesPaint(0, Color.RED); renderer1.setSeriesStroke(0, new BasicStroke(3)); // renderer1.setBaseShapesVisible(true); // renderer1.setSeriesShape(0, ShapeUtilities.createDiagonalCross(4,1)); plot.setRenderer(0, renderer1); // final StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); final XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(false, true); renderer2.setSeriesPaint(0, Color.CYAN); renderer2.setSeriesShapesFilled(0, Boolean.TRUE); renderer2.setBaseShapesVisible(true); renderer2.setShape(new Rectangle(-2, -100, 4, 200)); renderer2.setOutlineStroke(new BasicStroke(1)); renderer2.setOutlinePaint(Color.GRAY); renderer2.setUseOutlinePaint(true); plot.setRenderer(1, renderer2); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); // return chart; }
From source file:de.fub.maps.project.plugins.tasks.eval.OverviewChart.java
private void initRenderer(CategoryItemRenderer renderer) { Color[] colors = new Color[] { Color.red, Color.blue, Color.orange, Color.cyan, Color.yellow, Color.magenta, Color.green, Color.pink, Color.black, Color.gray }; if (!this.roadNetworkStatisticsList.isEmpty()) { for (int i = 0; i < this.roadNetworkStatisticsList.size(); i++) { renderer.setSeriesPaint(i, colors[i % colors.length]); }/*from w w w . j a v a 2s. c o m*/ } }
From source file:net.sf.dynamicreports.test.jasper.chart.BubbleChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/* w w w .j a v a 2 s . co m*/ JFreeChart chart = getChart("summary.chart1", 0); XYItemRenderer renderer = chart.getXYPlot().getRenderer(); Assert.assertEquals("renderer", XYBubbleRenderer.class, renderer.getClass()); Assert.assertEquals("scale type", XYBubbleRenderer.SCALE_ON_BOTH_AXES, ((XYBubbleRenderer) renderer).getScaleType()); xyzChartDataTest(chart, 0, "a", new Number[][] { { 1d, 2d, 0.25 }, { 2d, 3d, 0.5 }, { 3d, 4d, 0.75 }, { 4d, 5d, 1d } }); xyzChartDataTest(chart, 1, "serie1", new Number[][] { { 2d, 1d, 0.25 }, { 3d, 2d, 0.5 }, { 4d, 3d, 0.75 }, { 5d, 4d, 1d } }); chart = getChart("summary.chart2", 0); Axis axis = chart.getXYPlot().getDomainAxis(); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getXYPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); }
From source file:net.sf.dynamicreports.test.jasper.chart.GroupedStackedBarChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//from w ww . j a v a 2 s . c o m JFreeChart chart = getChart("summary.chart1", 0); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", GroupedStackedBarRenderer.class, categoryPlot.getRenderer().getClass()); Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible()); Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickLabelsVisible()); Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickMarksVisible()); chart = getChart("summary.chart2", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
From source file:net.sf.dynamicreports.test.jasper.chart.LayeredBarChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);// ww w.j a v a 2 s .c o m JFreeChart chart = getChart("summary.chart1", 0); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", LayeredBarRenderer.class, categoryPlot.getRenderer().getClass()); Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible()); Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible()); Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible()); chart = getChart("summary.chart2", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }