List of usage examples for java.awt Color DARK_GRAY
Color DARK_GRAY
To view the source code for java.awt Color DARK_GRAY.
Click Source Link
From source file:net.sf.maltcms.chromaui.charts.events.TICChartHandler.java
/** * * @param v// www .j a va2s . c o m */ @Override public void listen(final IEvent<XYItemEntity> v) { if (!(v.get().getDataset() instanceof XYZDataset)) { Logger.getLogger(getClass().getName()).warning("Can not handle instances other than XYZDataset!"); return; } final ValueAxis domainAxis = xypl.getDomainAxis(); //System.out.println("Received event"); // Runnable r = new Runnable() { // // @Override // public void run() { // xypl.setNoDataMessage("Loading..."); // xypl.setDataset(null); // } // }; // // SwingUtilities.invokeLater(r); // Runnable s = new Runnable() { @Override public void run() { long start = System.currentTimeMillis(); //System.out.println("Running update of TICChartHandler"); XYItemEntity e = v.get(); if (e.getDataset() instanceof XYZDataset) { final XYZDataset xyz = (XYZDataset) e.getDataset(); final int seriesIndex = e.getSeriesIndex(); final int y = (int) xyz.getYValue(seriesIndex, e.getItem()); final int x = (int) xyz.getXValue(seriesIndex, e.getItem()); XYDataset xydss; if (ticCache.containsKey(y)) { xydss = ticCache.get(y); } else { final DefaultXYDataset xyds = new DefaultXYDataset(); double[][] d = new double[2][scanlines]; Index idx = data.getIndex(); //columns, y for (int j = 0; j < scanlines; j++) { idx.set(scansPerMod * j + y); d[0][j] = j; d[1][j] = data.getDouble(idx); } xyds.addSeries("TIC@[" + y + "]", d); xydss = xyds; ticCache.put(y, xyds); } final XYDataset fds = xydss; Runnable runnable = new Runnable() { @Override public void run() { xypl.setDataset(fds); xypl.getRenderer().setBaseItemLabelsVisible(true); xypl.getRenderer().setBasePaint(Color.GRAY); xypl.getRenderer().setBaseOutlinePaint(Color.DARK_GRAY); xypl.setDomainCrosshairLockedOnData(true); xypl.setDomainCrosshairValue(x, true); if (valueAxisFixed) { xypl.getRangeAxis().setAutoRange(false); xypl.getRangeAxis().setLowerBound(valueAxisMin); xypl.getRangeAxis().setUpperBound(valueAxisMax); } else { xypl.getRangeAxis().setAutoRange(true); } } }; SwingUtilities.invokeLater(runnable); // }else{ // System.err.println("Can only handle XYZDatasets!"); // } //System.out.println("Set TIC data in "+(System.currentTimeMillis()-start)); } } }; es.submit(s); }
From source file:UserInterface.DoctorRole.DoctorReportChartJPanel.java
private void level1jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_level1jButton1ActionPerformed // TODO add your handling code here: ReportToReporter report = enterprise.getReport(); if (report.getStatus() != null) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(report.getIncidentnumber(), "Incident", "Incident"); dataset.addValue(report.getNearmissnumber(), "Near miss", "Near miss"); dataset.addValue(report.getUnsafenumber(), "Unsafe condition", "Unsafe condition"); JFreeChart chart = ChartFactory.createBarChart("Level1 Error", "Error Name", "Times", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeGridlinePaint(Color.DARK_GRAY); ChartFrame frame = new ChartFrame("Chart for ERROR", chart); frame.setVisible(true);//from w w w. j a va 2 s . c om frame.setSize(350, 450); } else { JOptionPane.showMessageDialog(null, "Sorry, the final report has not been generated"); } // report.getMaxlevel1() = maxlevel1number; }
From source file:org.cyberoam.iview.charts.XYLine.java
/** * This method generates JFreeChart instance for XYLine chart with iView customization. * @param reportID specifies that for which report Chart is being prepared. * @param rsw specifies data set which would be used for the Chart * @param requeest used for Hyperlink generation from URL. * @return jfreechart instance with iView Customization. *///from w w w . ja v a2s . c o m public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null; try { ReportColumnBean reportColumnBean = null; GraphBean graphBean = null; DataLinkBean dataLinkBean = null; XYDataset dataset = null; XYSeriesCollection seriesCollection = new XYSeriesCollection(); XYSeries series = new XYSeries(reportBean.getTitle()); graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId());//Getting GraphBean reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getXColumnId());//getting ReportColumnBean For X Axis String xColumnDBname = reportColumnBean.getDbColumnName(); String xColumnName = reportColumnBean.getColumnName(); //Wheather DataLink is Given For X Axis column if (reportColumnBean.getDataLinkId() != -1) { dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBean.getDataLinkId()); } reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnDBname = reportColumnBean.getDbColumnName(); String yColumnName = reportColumnBean.getColumnName(); //if DataLink is not Given For X Axis column then Check of Y Axis Column if (dataLinkBean == null && reportColumnBean.getDataLinkId() != -1) { dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBean.getDataLinkId()); } reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getZColumnId()); String zColumnDbname = reportColumnBean.getDbColumnName(); //Preparing DataSet String data = ""; rsw.beforeFirst(); while (rsw.next()) { data = rsw.getString(xColumnDBname); series.add(Long.parseLong((data).substring(data.length() - 2)), new Long(rsw.getLong(yColumnDBname)).longValue()); } seriesCollection.addSeries(series); dataset = seriesCollection; // create the chart... chart = ChartFactory.createXYLineChart("", // chart title "", // domain axis label "", seriesCollection, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); /* * Additional iView Customization. */ //Set the background color for the chart... chart.setBackgroundPaint(Color.white); //Get a reference to the plot for further customisation... XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(new Color(245, 245, 245)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setForegroundAlpha(0.7f); //Set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); if (reportColumnBean.getColumnFormat() == TabularReportConstants.BYTE_FORMATTING) { rangeAxis.setTickUnit(new ByteTickUnit(rangeAxis.getUpperBound() / 4)); } rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); rangeAxis.setTickLabelFont(new Font("Vandara", Font.CENTER_BASELINE, 10)); rangeAxis.setTickLabelsVisible(true); rangeAxis.setTickMarksVisible(false); rangeAxis.setAxisLineVisible(false); Axis domainAxis = plot.getDomainAxis(); domainAxis.setTickLabelFont(new Font("Vandara", Font.CENTER_BASELINE, 10)); domainAxis.setTickMarksVisible(false); domainAxis.setAxisLineVisible(false); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.DARK_GRAY); renderer.setSeriesStroke(0, new BasicStroke(1)); } catch (Exception e) { e.printStackTrace(); } return chart; }
From source file:com.github.fabioticconi.roguelite.systems.BootstrapSystem.java
@Override protected void processSystem() { // this must be only run once setEnabled(false);/*from ww w . j a va 2 s.c o m*/ int x; int y; // add player int id = world.create(); EntityEdit edit = world.edit(id); // load the player's data try { loadBody("data/creatures/player.yaml", edit); } catch (final IOException e) { e.printStackTrace(); System.exit(1); } edit.create(Player.class); x = Options.MAP_SIZE_X / 2; y = Options.MAP_SIZE_Y / 2; edit.create(Position.class).set(x, y); edit.create(Sprite.class).set('@', Color.WHITE); grid.set(x, y, id); pManager.setPlayer(world.getEntity(id), "player"); System.out.println("setPlayer"); edit.create(Speed.class).value = 0f; // FIXME to remove later, only for debug // add a herd of buffalos int groupId = sGroup.createGroup(); IntSet group = sGroup.getGroup(groupId); for (int i = 0; i < 5; i++) { id = world.create(); edit = world.edit(id); try { loadBody("data/creatures/buffalo.yaml", edit); } catch (final IOException e) { e.printStackTrace(); System.exit(1); } final AI ai = new AI(r.nextFloat() * AISystem.BASE_TICKTIME + 1.0f); ai.behaviours.add(world.getSystem(FleeBehaviour.class)); ai.behaviours.add(world.getSystem(GrazeBehaviour.class)); ai.behaviours.add(world.getSystem(FlockBehaviour.class)); ai.behaviours.add(world.getSystem(WanderBehaviour.class)); edit.add(ai); x = (Options.MAP_SIZE_X / 2) + r.nextInt(10) - 5; y = (Options.MAP_SIZE_Y / 2) + r.nextInt(10) - 5; edit.create(Position.class).set(x, y); edit.create(Group.class).groupId = groupId; group.add(id); edit.create(Alertness.class).value = 0.0f; edit.create(Sprite.class).set('b', Util.BROWN); grid.set(x, y, id); } // add small, independent rabbits/hares for (int i = 0; i < 3; i++) { id = world.create(); edit = world.edit(id); try { loadBody("data/creatures/rabbit.yaml", edit); } catch (final IOException e) { e.printStackTrace(); System.exit(1); } final AI ai = new AI(r.nextFloat() * AISystem.BASE_TICKTIME + 1.0f); ai.behaviours.add(world.getSystem(FleeBehaviour.class)); ai.behaviours.add(world.getSystem(GrazeBehaviour.class)); ai.behaviours.add(world.getSystem(WanderBehaviour.class)); edit.add(ai); x = (Options.MAP_SIZE_X / 2) + r.nextInt(10) - 5; y = (Options.MAP_SIZE_Y / 2) + r.nextInt(10) - 5; edit.create(Position.class).set(x, y); edit.create(Alertness.class).value = 0.0f; edit.create(Sprite.class).set('r', Color.LIGHT_GRAY); grid.set(x, y, id); } // add a pack of wolves groupId = sGroup.createGroup(); group = sGroup.getGroup(groupId); for (int i = 0; i < 5; i++) { id = world.create(); edit = world.edit(id); try { loadBody("data/creatures/wolf.yaml", edit); } catch (final IOException e) { e.printStackTrace(); System.exit(1); } final AI ai = new AI(r.nextFloat() * AISystem.BASE_TICKTIME + 1.0f); ai.behaviours.add(world.getSystem(ChaseBehaviour.class)); ai.behaviours.add(world.getSystem(FlockBehaviour.class)); ai.behaviours.add(world.getSystem(WanderBehaviour.class)); edit.add(ai); x = (Options.MAP_SIZE_X / 2) + r.nextInt(10) - 5; y = (Options.MAP_SIZE_Y / 2) + r.nextInt(10) - 5; edit.create(Position.class).set(x, y); edit.create(Group.class).groupId = groupId; group.add(id); edit.create(Alertness.class).value = 0.0f; edit.create(Sprite.class).set('w', Color.DARK_GRAY); grid.set(x, y, id); } // add solitary pumas for (int i = 0; i < 3; i++) { id = world.create(); edit = world.edit(id); try { loadBody("data/creatures/puma.yaml", edit); } catch (final IOException e) { e.printStackTrace(); System.exit(1); } final AI ai = new AI(r.nextFloat() * AISystem.BASE_TICKTIME + 1.0f); ai.behaviours.add(world.getSystem(ChaseBehaviour.class)); ai.behaviours.add(world.getSystem(WanderBehaviour.class)); edit.add(ai); x = (Options.MAP_SIZE_X / 2) + r.nextInt(10) - 5; y = (Options.MAP_SIZE_Y / 2) + r.nextInt(10) - 5; edit.create(Position.class).set(x, y); edit.create(Alertness.class).value = 0.0f; edit.create(Sprite.class).set('p', Util.BROWN.darker()); grid.set(x, y, id); } // add random trees? for (x = 0; x < Options.MAP_SIZE_X; x++) { for (y = 0; y < Options.MAP_SIZE_Y; y++) { final Cell cell = map.get(x, y); if ((cell.equals(Cell.GRASS) && r.nextGaussian() > 3f) || (cell.equals(Cell.HILL_GRASS) && r.nextGaussian() > 2f) || (cell.equals(Cell.HILL) && r.nextGaussian() > 3f)) { id = world.create(); edit = world.edit(id); edit.create(Position.class).set(x, y); edit.create(Sprite.class).set('T', Color.GREEN.brighter()); edit.create(Obstacle.class); // FIXME: we should only need one or the other to determine if obstacle. // ie, the map should be able to get the Obstacle component from the SingleGrid // to determine if the cell is obstructed or not. grid.set(x, y, id); map.setObstacle(x, y); } } } System.out.println("Bootstrap done"); }
From source file:edu.ku.brc.specify.plugins.ipadexporter.ChartHelper.java
/** * @param list/* w w w. j av a2 s.com*/ * @param title * @param xAxisTitle * @param yAxisTitle * @param isVertical * @param width * @param height */ public JFreeChart createBarChart(final List<Object> list, final String title, final String xAxisTitle, final String yAxisTitle, final boolean isVertical, final int width, final int height) { DefaultCategoryDataset dataset = createDataSet(list); JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title xAxisTitle, // domain axis label yAxisTitle, // range axis label dataset, // data isVertical ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL, true, // include legend true, // tooltips? false // URLs? ); CategoryPlot categoryplot = (CategoryPlot) chart.getPlot(); categoryplot.setRangeGridlinePaint(Color.DARK_GRAY); categoryplot.setBackgroundPaint(null); return chart; }
From source file:oct.analysis.application.OCTSelection.java
protected void drawSelectButton(Graphics g, int imageOffsetX, int imageOffsetY) { Polygon buttonOutline = getSelectionButtonShape(); buttonOutline.translate(imageOffsetX, imageOffsetY); g.setColor(Color.lightGray);/*from www . j ava 2s.c o m*/ g.drawPolygon(buttonOutline); g.fillPolygon(buttonOutline); Polygon button = new Polygon(); button.addPoint(imageOffsetX + xPositionOnOct - 5, imageOffsetY); button.addPoint(imageOffsetX + xPositionOnOct - 5, imageOffsetY + 15); button.addPoint(imageOffsetX + xPositionOnOct, imageOffsetY + 20); button.addPoint(imageOffsetX + xPositionOnOct + 5, imageOffsetY + 15); button.addPoint(imageOffsetX + xPositionOnOct + 5, imageOffsetY); g.setColor(Color.DARK_GRAY); g.drawPolygon(button); }
From source file:financepro.XYLineChartExample.java
License:asdf
private JPanel createChartPanel() { // creates a line chart object // returns the chart panel String chartTitle = "Various Financial Ratios"; String xAxisLabel = "Years"; String yAxisLabel = "Ratio Values"; XYDataset dataset = createDataset(); JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xAxisLabel, yAxisLabel, dataset); XYPlot plot = chart.getXYPlot();//from w w w .j a v a2 s. com XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); plot.setRenderer(renderer); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GREEN); renderer.setSeriesPaint(2, Color.YELLOW); renderer.setSeriesPaint(3, Color.CYAN); renderer.setSeriesPaint(4, Color.BLACK); renderer.setSeriesStroke(0, new BasicStroke(4.0f)); renderer.setSeriesStroke(1, new BasicStroke(4.0f)); renderer.setSeriesStroke(2, new BasicStroke(4.0f)); renderer.setSeriesStroke(3, new BasicStroke(4.0f)); renderer.setSeriesStroke(4, new BasicStroke(4.0f)); plot.setRenderer(renderer); plot.setOutlinePaint(Color.BLUE); plot.setOutlineStroke(new BasicStroke(4.0f)); plot.setBackgroundPaint(Color.DARK_GRAY); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.BLACK); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.BLACK); return new ChartPanel(chart); }
From source file:com.jolbox.benchmark.BenchmarkMain.java
/** * @param results//from w w w.j a v a 2 s . c om * @param delay * @param statementBenchmark * @param noC3P0 */ private static void doPlotLineGraph(long[][] results, int delay, boolean statementBenchmark, boolean noC3P0) { XYSeriesCollection dataset = new XYSeriesCollection(); for (int i = 0; i < ConnectionPoolType.values().length; i++) { // if (!ConnectionPoolType.values()[i].isEnabled() || (noC3P0 && ConnectionPoolType.values()[i].equals(ConnectionPoolType.C3P0))) { continue; } XYSeries series = new XYSeries(ConnectionPoolType.values()[i].toString()); for (int j = 1 + BenchmarkTests.stepping; j < results[i].length; j += BenchmarkTests.stepping) { series.add(j, results[i][j]); } dataset.addSeries(series); } // Generate the graph String title = "Multi-Thread test (" + delay + "ms delay)"; if (statementBenchmark) { title += "\n(with PreparedStatements tests)"; } JFreeChart chart = ChartFactory.createXYLineChart(title, // Title "threads", // x-axis Label "time (ns)", // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); XYPlot plot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); plot.setRenderer(renderer); renderer.setSeriesPaint(0, Color.BLUE); renderer.setSeriesPaint(1, Color.YELLOW); renderer.setSeriesPaint(2, Color.BLACK); renderer.setSeriesPaint(3, Color.DARK_GRAY); renderer.setSeriesPaint(4, Color.MAGENTA); renderer.setSeriesPaint(5, Color.RED); renderer.setSeriesPaint(6, Color.LIGHT_GRAY); // renderer.setSeriesShapesVisible(1, true); // renderer.setSeriesShapesVisible(2, true); try { String fname = System.getProperty("java.io.tmpdir") + File.separator + "bonecp-multithread-" + delay + "ms-delay"; if (statementBenchmark) { fname += "-with-preparedstatements"; } fname += "-poolsize-" + BenchmarkTests.pool_size + "-threads-" + BenchmarkTests.threads; if (noC3P0) { fname += "-noC3P0"; } fname += ".png"; ChartUtilities.saveChartAsPNG(new File(fname), chart, 1024, 768); System.out.println("******* Saved chart to: " + fname); } catch (IOException e) { System.err.println("Problem occurred creating chart."); } }
From source file:uk.ac.ncl.aries.entanglement.cli.export.MongoGraphToGDF.java
private static Map<String, Color> loadColorMappings(File propFile) throws IOException { FileInputStream is = new FileInputStream(propFile); Properties props = new Properties(); props.load(is);// ww w . jav a 2 s. c o m is.close(); Map<String, Color> nodeTypeToColour = new HashMap<>(); for (String nodeType : props.stringPropertyNames()) { String colorString = props.getProperty(nodeType); Color color; switch (colorString) { case "BLACK": color = Color.BLACK; break; case "BLUE": color = Color.BLUE; break; case "CYAN": color = Color.CYAN; break; case "DARK_GRAY": color = Color.DARK_GRAY; break; case "GRAY": color = Color.GRAY; break; case "GREEN": color = Color.GREEN; break; case "LIGHT_GRAY": color = Color.LIGHT_GRAY; break; case "MAGENTA": color = Color.MAGENTA; break; case "ORANGE": color = Color.ORANGE; break; case "PINK": color = Color.PINK; break; case "RED": color = Color.RED; break; case "WHITE": color = Color.WHITE; break; case "YELLOW": color = Color.YELLOW; break; default: color = DEFAULT_COLOR; } nodeTypeToColour.put(nodeType, color); } return nodeTypeToColour; }
From source file:com.jolbox.benchmark.BenchmarkLaunch.java
/** * @param results// w w w . ja v a 2 s. com * @param delay * @param statementBenchmark * @param noC3P0 * @throws IOException */ private static void doPlotLineGraph(long[][] results, int delay, boolean statementBenchmark, boolean noC3P0) throws IOException { String title = "Multi-Thread test (" + delay + "ms delay)"; if (statementBenchmark) { title += "\n(with PreparedStatements tests)"; } String fname = System.getProperty("java.io.tmpdir") + File.separator + "bonecp-multithread-" + delay + "ms-delay"; if (statementBenchmark) { fname += "-with-preparedstatements"; } fname += "-poolsize-" + BenchmarkTests.pool_size + "-threads-" + BenchmarkTests.threads; if (noC3P0) { fname += "-noC3P0"; } PrintWriter out = new PrintWriter(new FileWriter(fname + ".txt")); fname += ".png"; XYSeriesCollection dataset = new XYSeriesCollection(); for (int i = 0; i < ConnectionPoolType.values().length; i++) { // if (!ConnectionPoolType.values()[i].isEnabled() || (noC3P0 && ConnectionPoolType.values()[i].equals(ConnectionPoolType.C3P0))) { continue; } XYSeries series = new XYSeries(ConnectionPoolType.values()[i].toString()); out.println(ConnectionPoolType.values()[i].toString()); for (int j = 1 + BenchmarkTests.stepping; j < results[i].length; j += BenchmarkTests.stepping) { series.add(j, results[i][j]); out.println(j + "," + results[i][j]); } dataset.addSeries(series); } out.close(); // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart(title, // Title "threads", // x-axis Label "time (ns)", // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); XYPlot plot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); plot.setRenderer(renderer); renderer.setSeriesPaint(0, Color.BLUE); renderer.setSeriesPaint(1, Color.YELLOW); renderer.setSeriesPaint(2, Color.BLACK); renderer.setSeriesPaint(3, Color.DARK_GRAY); renderer.setSeriesPaint(4, Color.MAGENTA); renderer.setSeriesPaint(5, Color.RED); renderer.setSeriesPaint(6, Color.LIGHT_GRAY); // renderer.setSeriesShapesVisible(1, true); // renderer.setSeriesShapesVisible(2, true); try { ChartUtilities.saveChartAsPNG(new File(fname), chart, 1024, 768); System.out.println("******* Saved chart to: " + fname); } catch (IOException e) { System.err.println("Problem occurred creating chart."); } }