List of usage examples for java.awt Color gray
Color gray
To view the source code for java.awt Color gray.
Click Source Link
From source file:edu.ucla.stat.SOCR.chart.SuperXYChart.java
/** * reset dataTable to default (demo data), and refesh chart */// w w w . j av a 2 s . c o m public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; // convertor.dataset2Table((TimeSeriesCollection)dataset); convertor.dataset2Table(dataset); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount()); resetTableColumns(tempDataTable.getColumnCount()); for (int i = 0; i < tempDataTable.getColumnCount(); i++) { columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i)); // System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i)); } columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataTable.doLayout(); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // do the mapping setMapping(); updateStatus(url); }
From source file:oscar.oscarEncounter.oscarMeasurements.pageUtil.MeasurementGraphAction2.java
JFreeChart referenceRangeChart(String demographicNo, String typeIdName, String typeIdName2, String patientName, String chartTitle) {// w w w.j a v a 2 s. co m org.jfree.data.time.TimeSeriesCollection dataset = new org.jfree.data.time.TimeSeriesCollection(); ArrayList<EctMeasurementsDataBean> list = getList(demographicNo, typeIdName); ArrayList<OHLCDataItem> dataItems = new ArrayList<OHLCDataItem>(); String typeYAxisName = ""; if (typeIdName.equals("BP")) { log.debug("Using BP LOGIC FOR type 1 "); EctMeasurementsDataBean sampleLine = list.get(0); typeYAxisName = sampleLine.getTypeDescription(); TimeSeries systolic = new TimeSeries("Systolic", Day.class); TimeSeries diastolic = new TimeSeries("Diastolic", Day.class); for (EctMeasurementsDataBean mdb : list) { // dataVector) { String[] str = mdb.getDataField().split("/"); systolic.addOrUpdate(new Day(mdb.getDateObservedAsDate()), Double.parseDouble(str[0])); diastolic.addOrUpdate(new Day(mdb.getDateObservedAsDate()), Double.parseDouble(str[1])); } dataset.addSeries(diastolic); dataset.addSeries(systolic); } else { log.debug("Not Using BP LOGIC FOR type 1 "); // get the name from the TimeSeries EctMeasurementsDataBean sampleLine = list.get(0); String typeLegendName = sampleLine.getTypeDisplayName(); typeYAxisName = sampleLine.getTypeDescription(); // this should be the type of measurement TimeSeries newSeries = new TimeSeries(typeLegendName, Day.class); for (EctMeasurementsDataBean mdb : list) { //dataVector) { newSeries.addOrUpdate(new Day(mdb.getDateObservedAsDate()), Double.parseDouble(mdb.getDataField())); try { Hashtable h = getMeasurementsExt(mdb.getId()); if (h != null && h.containsKey("minimum")) { String min = (String) h.get("minimum"); String max = (String) h.get("maximum"); double open = Double.parseDouble(min.trim()); double high = Double.parseDouble(max.trim()); double low = Double.parseDouble(min.trim()); double close = Double.parseDouble(max.trim()); double volume = 1045; dataItems .add(new OHLCDataItem(mdb.getDateObservedAsDate(), open, high, low, close, volume)); } } catch (Exception et) { MiscUtils.getLogger().error("Error", et); } } dataset.addSeries(newSeries); } OHLCDataItem[] ohlc = dataItems.toArray(new OHLCDataItem[dataItems.size()]); JFreeChart chart = ChartFactory.createHighLowChart("HighLowChartDemo2", "Time", "Value", new DefaultOHLCDataset("DREFERENCE RANGE", ohlc), true); XYPlot plot = (XYPlot) chart.getPlot(); // HighLowRenderer renderer = (HighLowRenderer) plot.getRenderer(); // renderer. // renderer.setOpenTickPaint(Color.green); // renderer.setCloseTickPaint(Color.black); plot.setDataset(1, dataset); plot.getDomainAxis().setAutoRange(true); log.debug("LEN " + plot.getDomainAxis().getLowerBound() + " ddd " + plot.getDomainAxis().getUpperMargin() + " eee " + plot.getDomainAxis().getLowerMargin()); //plot.getDomainAxis().setUpperMargin(plot.getDomainAxis().getUpperMargin()*6); //plot.getDomainAxis().setLowerMargin(plot.getDomainAxis().getLowerMargin()*6); // plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin()*1.7); plot.getDomainAxis().setUpperMargin(0.9); plot.getDomainAxis().setLowerMargin(0.9); plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin() * 4); ValueAxis va = plot.getRangeAxis(); va.setAutoRange(true); XYItemRenderer renderer = plot.getRenderer(); //DateFormat.getInstance() XYItemLabelGenerator generator = new StandardXYItemLabelGenerator("{1} \n {2}", new SimpleDateFormat("yyyy.MM.dd"), new DecimalFormat("0.00")); renderer.setSeriesItemLabelGenerator(0, generator);//setLabelGenerator(generator); renderer.setBaseItemLabelsVisible(true); plot.setBackgroundPaint(Color.WHITE); plot.setDomainCrosshairPaint(Color.GRAY); if (renderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer rend = (XYLineAndShapeRenderer) renderer; rend.setBaseShapesVisible(true); rend.setBaseShapesFilled(true); } plot.setRenderer(renderer); chart.setBackgroundPaint(Color.white); return chart; }
From source file:ec.ui.view.StabilityView.java
private void configureAxis(XYPlot plot) { int nb = graphs_.size(); List<String> names = new ArrayList<>(); for (Map.Entry<Bornes, Graphs> entry : graphs_.entrySet()) { names.add(entry.getValue().label_); }/*from ww w. j a va 2 s . c o m*/ NumberAxis xAxis = new NumberAxis(); xAxis.setTickLabelPaint(Color.GRAY); xAxis.setTickUnit(new StabilityTickUnit(names)); xAxis.setRange(-0.5, nb - 0.5); plot.setDomainAxis(xAxis); plot.setDomainGridlinesVisible(false); NumberAxis yaxis = new NumberAxis(); rescaleAxis(yaxis); plot.setRangeAxis(yaxis); for (int i = 0; i < nb; i++) { ValueMarker marker = new ValueMarker(i + 0.5); marker.setStroke(MARKER_STROKE); marker.setPaint(MARKER_PAINT); marker.setAlpha(MARKER_ALPHA); plot.addDomainMarker(marker); } }
From source file:edu.ucla.stat.SOCR.chart.SuperCategoryChart_vertical.java
/** * reset dataTable to default (demo data), and refesh chart *//*from w ww .j a va2 s. c om*/ public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.dataset2Table_vertical(dataset); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount()); resetTableColumns(tempDataTable.getColumnCount()); for (int i = 0; i < tempDataTable.getColumnCount(); i++) { columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i)); // System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i)); } columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataTable.doLayout(); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // do the mapping setMapping(); updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.SuperYIntervalChartA.java
/** * reset dataTable to default (demo data), and refesh chart *//*from ww w.j a v a2 s . c o m*/ public void resetExample() { isDemo = true; dataset = createDataset(isDemo); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.YIntervalDataset2TableA(dataset); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount()); resetTableColumns(tempDataTable.getColumnCount()); for (int i = 0; i < tempDataTable.getColumnCount(); i++) { columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i)); // System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i)); } columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // do the mapping setMapping(); updateStatus(url); }
From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java
private void _drawSelectedPoint(XYPlot xyplot, int position) { TrackPoint point = this.getTrack().getPointAt(position); // Strelicu crtamo samo ako je samo jedna tocka oznacena: if (this.startSelectedPoints < 0 || this.endSelectedPoints < 0 || this.startSelectedPoints == this.endSelectedPoints) { double angle = point.getAngle(); XYPointerAnnotation xypointerannotation = new XYPointerAnnotation("", point.getPosition(), //$NON-NLS-1$ point.getElevation(), Math.PI - angle); xypointerannotation.setTipRadius(3.0D); xypointerannotation.setBaseRadius(30); xypointerannotation.setTextAnchor(TextAnchor.BASELINE_RIGHT); xypointerannotation.setFont(GUIConstants.SANS_SERIF_11); if (angle > 0) { xypointerannotation.setPaint(Color.red); } else if (angle < 0) { xypointerannotation.setPaint(Color.green); } else {/*from w w w. ja va 2 s .c o m*/ xypointerannotation.setPaint(Color.gray); } xypointerannotation.setText((TrackProfilerMath.round(100 * angle, 1)) + " %"); //$NON-NLS-1$ xyplot.addAnnotation(xypointerannotation); } ValueMarker valuemarker = new ValueMarker(point.getPosition()); valuemarker.setLabelOffsetType(LengthAdjustmentType.NO_CHANGE); valuemarker.setStroke(new BasicStroke(1.0F)); if (this.startSelectedPoints != this.endSelectedPoints && position == this.startSelectedPoints) { valuemarker.setLabelPaint(Color.blue); valuemarker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT); // Ispisuje udaljenost i kut: TrackPoint t1 = this.getTrack().getPointAt(this.startSelectedPoints); TrackPoint t2 = this.getTrack().getPointAt(this.endSelectedPoints); double distance3D = TrackProfilerMath.round(t1.getPosition() - t2.getPosition(), 1); String angle = Math.abs(TrackProfilerMath.round(t1.getAngle(t2) * 100, 1)) + "%"; //$NON-NLS-1$ String label = Message.get(Messages.SELECTED_DISTANCE_LABEL) + distance3D + ", " //$NON-NLS-1$ + Message.get(Messages.SELECTED_ANGLE_LABEL) + angle; valuemarker.setLabel(" " + label); //$NON-NLS-1$ valuemarker.setLabelFont(GUIConstants.SANS_SERIF_11); } xyplot.addDomainMarker(valuemarker); }
From source file:org.xapagy.ui.tempdyn.GraphEvolution.java
/** * Initializes//www. j av a 2 s. co m */ public static void initializeLineStyles() { /** * Conservative line styles: gray and black various thicknesses */ GraphEvolution.lineStylesConservative = new ArrayList<>(); List<Color> colors = new ArrayList<>(); colors.add(Color.black); colors.add(Color.gray); List<Stroke> strokes = new ArrayList<>(); strokes.add(new BasicStroke(3.0f)); strokes.add(new BasicStroke(1.0f)); for (Color color : colors) { for (Stroke stroke : strokes) { GraphEvolution.lineStylesConservative.add(new SimpleEntry<>(color, stroke)); } } /** * Colorful line styles: striking colors */ GraphEvolution.lineStylesColorful = new ArrayList<>(); colors = new ArrayList<>(); colors.add(Color.black); colors.add(Color.blue); colors.add(Color.red); colors.add(Color.green); colors.add(Color.magenta); colors.add(Color.orange); for (Stroke stroke : strokes) { for (Color color : colors) { GraphEvolution.lineStylesColorful.add(new SimpleEntry<>(color, stroke)); } } }
From source file:juicebox.mapcolorui.HeatmapRenderer.java
/** * Render a dense matrix. Used for Pearsons correlation. The bitmap is drawn at 1 data point * per pixel, scaling happens elsewhere. * * @param rm Matrix to render/*from w w w .j ava2 s. c o m*/ * @param originX origin in pixels * @param originY origin in pixels * @param colorScale color scale to apply * @param g graphics to render matrix into */ private void renderMatrix(BasicMatrix rm, int originX, int originY, int width, int height, ColorScale colorScale, Graphics2D g) { int endX = Math.min(originX + width, rm.getColumnDimension()); int endY = Math.min(originY + height, rm.getRowDimension()); for (int row = originY; row < endY; row++) { for (int col = originX; col < endX; col++) { float score = rm.getEntry(row, col); Color color; if (Float.isNaN(score)) { color = Color.gray; } else { color = score == 0 ? Color.black : colorScale.getColor(score); } int px = col - originX; int py = row - originY; g.setColor(color); //noinspection SuspiciousNameCombination g.fillRect(px, py, HiCGlobals.BIN_PIXEL_WIDTH, HiCGlobals.BIN_PIXEL_WIDTH); // Assuming same chromosome if (col != row) { px = row - originX; py = col - originY; g.fillRect(px, py, HiCGlobals.BIN_PIXEL_WIDTH, HiCGlobals.BIN_PIXEL_WIDTH); } } } }
From source file:edu.ucla.stat.SOCR.chart.SuperCategoryChart_Stat_Raw.java
/** * reset dataTable to default (demo data), and refesh chart *///from ww w .j a v a 2s . c om public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.valueList2Table(values_storage, SERIES_COUNT, CATEGORY_COUNT); JTable tempDataTable = convertor.getTable(); // resetTable(); resetTableRows(tempDataTable.getRowCount() + 1); resetTableColumns(tempDataTable.getColumnCount() + 1); for (int i = 0; i < tempDataTable.getColumnCount(); i++) { columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i)); // System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i)); } columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataTable.doLayout(); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // do the mapping addButtonDependent(); int columnCount = dataset.getColumnCount(); for (int i = 0; i < columnCount; i++) addButtonIndependent(); updateStatus(url); }
From source file:com.bdb.weather.display.freeplot.HistoricalFreePlot.java
/** * Create the series for humidity values. * //from ww w.ja v a 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>> createHumiditySeries(Stroke stroke, Function<HistoricalRecord, TemporalAccessor> timeMethod) { List<FreePlotSeries<HistoricalRecord>> list = new ArrayList<>(); int n = 0; list.add(new FreePlotSeries<>(OUTDOOR_HUMIDITY_SERIES_NAME, n++, Color.GRAY, stroke, HistoricalRecord::getOutdoorHumidity, timeMethod, INTERVAL_CLASS)); list.add(new FreePlotSeries<>(INDOOR_HUMIDITY_SERIES_NAME, n++, Color.BLACK, stroke, HistoricalRecord::getIndoorHumidity, timeMethod, INTERVAL_CLASS)); return list; }