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:eu.ggnet.dwoss.misc.op.listings.SalesListingProducerOperation.java
@Override public FileJacket generateAllSalesListing() { SubMonitor m = monitorFactory.newSubMonitor("All List", 5); m.message("loading Units"); m.start();/*from w ww . ja va 2 s . com*/ List<StockUnit> stockUnits = new StockUnitEao(stockEm).findByNoLogicTransaction(); List<UniqueUnit> uniqueUnits = new UniqueUnitEao(uuEm).findByIds(toUniqueUnitIds(stockUnits)); m.worked(3, "preparing Units"); List<Object[]> retailers = new ArrayList<>(stockUnits.size()); List<Object[]> customers = new ArrayList<>(stockUnits.size()); for (Map.Entry<UniqueUnit, StockUnit> entry : toSortedMap(uniqueUnits, stockUnits, new UniqueUnitComparator()).entrySet()) { UniqueUnit uu = entry.getKey(); StockUnit su = entry.getValue(); Product p = uu.getProduct(); Date firstPriced = null; for (PriceHistory priceHistory : uu.getPriceHistory()) { if (firstPriced == null || firstPriced.after(priceHistory.getDate())) firstPriced = priceHistory.getDate(); } String source = "Automatisch"; if (p != null && p.getFlags().contains(Product.Flag.PRICE_FIXED)) source = "Manuell (Artikel)"; else if (uu.getFlags().contains(UniqueUnit.Flag.PRICE_FIXED)) source = "Manuell (Gert)"; Object[] row = { uu.getRefurbishId(), (p == null ? null : p.getPartNo()), (p == null ? null : p.getGroup().getNote()), (p == null ? null : p.getTradeName().getName()), (p == null ? null : p.getName()), (p == null ? null : p.getDescription()), uu.getWarranty().getName(), uu.getWarrentyValid(), UniqueUnitFormater.toSingleLineAccessories(uu), uu.getCondition().getNote(), UniqueUnitFormater.toSingleLineComment(uu), uu.getPrice(PriceType.RETAILER), uu.getPrice(PriceType.CUSTOMER), (!uu.hasPrice(PriceType.CUSTOMER) ? null : MathUtil.roundedApply(uu.getPrice(PriceType.CUSTOMER), GlobalConfig.TAX, 0)), (su.getStock() == null ? su.getTransaction() : su.getStock().getName()), uu.getMfgDate(), uu.getInputDate(), firstPriced, source }; if (uu.getSalesChannel() == SalesChannel.CUSTOMER && uu.hasPrice(PriceType.CUSTOMER)) customers.add(row); else if (uu.getSalesChannel() == SalesChannel.RETAILER && (uu.hasPrice(PriceType.CUSTOMER) || uu.hasPrice(PriceType.RETAILER))) retailers.add(row); } m.worked(1, "creating File, Endkundengerte: " + customers.size() + ", Hndlergerte: " + retailers.size()); STable consumerTable = new STable(); consumerTable .setTableFormat(new CFormat(CENTER, TOP, new CBorder(Color.GRAY, CBorder.LineStyle.THIN), true)); consumerTable.setHeadlineFormat( new CFormat(CFormat.FontStyle.BOLD, Color.BLACK, Color.LIGHT_GRAY, CENTER, MIDDLE)); consumerTable.setRowHeight(1000); consumerTable.add(new STableColumn("SopoNr", 12)); consumerTable.add(new STableColumn("ArtikelNr", 15)); consumerTable.add(new STableColumn("Warengruppe", 18)); consumerTable.add(new STableColumn("Hersteller", 15)); consumerTable.add(new STableColumn("Bezeichnung", 30)); consumerTable.add(new STableColumn("Beschreibung", 60, LFT)); consumerTable.add(new STableColumn("Garantie", 18, LFT)); consumerTable.add(new STableColumn("Garantie bis", 18, new CFormat(Representation.SHORT_DATE))); consumerTable.add(new STableColumn("Zubehr", 30, LFT)); consumerTable.add(new STableColumn("optische Bewertung", 25)); consumerTable.add(new STableColumn("Bemerkung", 50, LFT)); consumerTable.add(new STableColumn("Hndler", 15, EURO)); consumerTable.add(new STableColumn("Endkunde", 15, EURO)); consumerTable.add(new STableColumn("E.inc.Mwst", 15, EURO)); consumerTable.add(new STableColumn("Lager", 18)); consumerTable.add(new STableColumn("Mfg Datum", 18, new CFormat(Representation.SHORT_DATE))); consumerTable.add(new STableColumn("Aufnahme Datum", 18, new CFormat(Representation.SHORT_DATE))); consumerTable.add(new STableColumn("Erstmalig Bepreist", 18, new CFormat(Representation.SHORT_DATE))); consumerTable.add(new STableColumn("Preis Quelle", 18)); consumerTable.setModel(new STableModelList(customers)); STable retailerTable = new STable(consumerTable); retailerTable.setModel(new STableModelList(retailers)); CCalcDocument cdoc = new TempCalcDocument(); cdoc.add(new CSheet("Endkunde", consumerTable)); cdoc.add(new CSheet("Hndler", retailerTable)); FileJacket fj = new FileJacket("All", ".xls", LucidCalc.createWriter(LucidCalc.Backend.XLS).write(cdoc)); m.finish(); return fj; }
From source file:edu.ucla.stat.SOCR.chart.demo.HistogramChartDemo5.java
/** * reset dataTable to default (demo data), and refesh chart *///from w w w .ja v a2s . co m public void resetExample() { isDemo = true; IntervalXYDataset dataset = createDataset(isDemo); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; //convertor.dataset2Table(dataset); convertor.Y2Table(raw_y, data_count); JTable tempDataTable = convertor.getTable(); //int seriesCount = tempDataTable.getColumnCount()/2; resetTableRows(tempDataTable.getRowCount() + 1); //resetTableColumns(seriesCount*2); resetTableColumns(1); //correct the column name // columnModel.getColumn(0).setHeaderValue("Data"); columnModel.getColumn(0).setHeaderValue("Frequency"); /* for(int i=0;i<seriesCount*2;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(); setMapping(); updateStatus(url); }
From source file:edu.ku.brc.af.ui.forms.SubViewBtn.java
/** * @param subviewDef/*from w ww . j a v a2 s . c o m*/ * @param isCollection * @param props */ public SubViewBtn(final MultiView mvParent, final FormCellSubViewIFace subviewDef, final ViewIFace view, final DATA_TYPE dataType, final int options, final Properties props, final Class<?> classToCreate, final AltViewIFace.CreationMode mode) { this.mvParent = mvParent; this.subviewDef = subviewDef; this.dataType = dataType; this.view = view; this.options = options; this.classToCreate = classToCreate; isEditing = mode == AltViewIFace.CreationMode.EDIT; // 02/12/08 - rods - Removing the "IS_NEW_OBJECT" of the parent object because it doesn't // matter to the popup form it creates. The form takes care of everything. this.options &= ~MultiView.IS_NEW_OBJECT; //log.debug("Editing "+MultiView.isOptionOn(options, MultiView.IS_EDITTING)); //log.debug("IsNew "+MultiView.isOptionOn(options, MultiView.IS_NEW_OBJECT)); cellName = subviewDef.getName(); frameTitle = props.getProperty("title"); String align = props.getProperty("align", "left"); String iconName = props.getProperty("icon", null); icon = null; baseLabel = props.getProperty("label"); if (baseLabel == null) { DBTableInfo tableInfo = DBTableIdMgr.getInstance() .getByClassName(classToCreate != null ? classToCreate.getName() : view.getClassName()); if (tableInfo != null) { baseLabel = tableInfo.getTitle(); String icNam = StringUtils.isNotEmpty(iconName) ? iconName : tableInfo.getName(); IconEntry entry = IconManager.getIconEntryByName(icNam); if (entry != null) { icon = IconManager.getIcon(icNam, entry.getSize() == IconSize.NonStd ? IconSize.NonStd : IconSize.Std24); } if (frameTitle == null) { frameTitle = baseLabel; } } } if (frameTitle == null) { DBTableInfo tableInfo = DBTableIdMgr.getInstance() .getByClassName(classToCreate != null ? classToCreate.getName() : view.getClassName()); if (tableInfo != null) { frameTitle = tableInfo.getTitle(); } } int x = 2; String colDef; if (align.equals("center")) { colDef = "f:p:g,p,2px,p,f:p:g"; } else if (align.equals("right")) { colDef = "f:p:g, p,2px,p"; } else // defaults to left { colDef = "p,2px,p,f:p:g"; x = 1; } subViewBtn = icon != null ? createButton(icon) : createButton(baseLabel); subViewBtn.addActionListener(new ActionListener() { //@Override public void actionPerformed(ActionEvent e) { showForm(); } }); //subViewBtn.setEnabled(false); label = createLabel(" "); label.setHorizontalAlignment(SwingConstants.CENTER); label.setOpaque(true); label.setBackground(Color.WHITE); label.setBorder(BorderFactory.createLineBorder(Color.GRAY)); PanelBuilder pb = new PanelBuilder(new FormLayout(colDef, "p"), this); CellConstraints cc = new CellConstraints(); pb.add(subViewBtn, cc.xy(x, 1)); pb.add(label, cc.xy(x + 2, 1)); try { classObj = Class.forName(view.getClassName()); } catch (ClassNotFoundException ex) { log.error(ex); FormDevHelper.showFormDevError(ex); } setOpaque(false); }
From source file:MyJava3D.java
public RenderingSurface(RenderingEngine engine, GeometryUpdater updater) { this.engine = engine; this.updater = updater; setBackground(Color.gray); }
From source file:edu.ucla.stat.SOCR.chart.demo.HistogramChartDemo7.java
public void resetExample() { isDemo = true;/* w ww .j ava 2 s . c o m*/ dataset = createDataset(isDemo); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; //convertor.dataset2Table(dataset); convertor.data2Table(raw_x, raw_y, domainLabel, rangeLabel, xyLength); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount() + 1); columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); 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)); } for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); dataPanel.removeAll(); JScrollPane tablePanel = new JScrollPane(dataTable); tablePanel.setRowHeaderView(headerTable); dataPanel.add(tablePanel); dataPanel.add(new JScrollPane(summaryPanel)); 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(); setMapping(); updateStatus(url); }
From source file:ucar.unidata.idv.control.chart.WayPoint.java
/** * Draws the annotation.//www .j ava 2 s. co m * * @param g2 the graphics device. * @param plot the plot. * @param dataArea the data area. * @param domainAxis the domain axis. * @param rangeAxis the range axis. * @param rendererIndex the renderer index. * @param info an optional info object that will be populated with * entity information. */ public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, int rendererIndex, PlotRenderingInfo info) { super.setGraphicsState(g2); if (!getPlotWrapper().okToDraw(this)) { return; } g2.setStroke(new BasicStroke()); if (false && getSelected()) { g2.setColor(COLOR_SELECTED); } else { g2.setColor(getColor()); } x = getXFromValue(dataArea, domainAxis); int width2 = (int) (ANNOTATION_WIDTH / 2); int bottom = (int) (dataArea.getY() + dataArea.getHeight()); y = bottom; int[] xs = { x - width2, x + width2, x, x - width2 }; int[] ys = { bottom - ANNOTATION_WIDTH, bottom - ANNOTATION_WIDTH, bottom, bottom - ANNOTATION_WIDTH }; g2.fillPolygon(xs, ys, xs.length); if ((getName() != null) && !isForAnimation) { FontMetrics fm = g2.getFontMetrics(); int width = fm.stringWidth(getName()); int textLeft = x - width / 2; g2.drawString(getName(), textLeft, bottom - ANNOTATION_WIDTH - 2); } if (getSelected()) { g2.setColor(COLOR_SELECTED); g2.drawPolygon(xs, ys, xs.length); } if (getPropertyListeners().hasListeners(PROP_WAYPOINTVALUE) || isForAnimation) { g2.setColor(Color.gray); g2.drawLine(x, y - ANNOTATION_WIDTH, x, (int) dataArea.getY()); } boolean playSound = canPlaySound(); if (isForAnimation) { if (clockImage == null) { clockImage = GuiUtils.getImage("/auxdata/ui/icons/clock.gif"); } if (playSound) { g2.drawImage(clockImage, x - 8, (int) dataArea.getY() + 1, null); } else { g2.drawImage(clockImage, x - 8, (int) dataArea.getY() + 1, null); } } if (canPlaySound()) { if (noteImage == null) { noteImage = GuiUtils.getImage("/auxdata/ui/icons/note.gif"); } if (isForAnimation) { g2.drawImage(noteImage, x + 8, (int) dataArea.getY() + 1, null); } else { g2.drawImage(noteImage, x, (int) dataArea.getY() + 1, null); } } if (minutesSpan > 0.0) { int left = (int) domainAxis.valueToJava2D(domainValue - (minutesSpan * 60000) / 2, dataArea, RectangleEdge.BOTTOM); int right = (int) domainAxis.valueToJava2D(domainValue + (minutesSpan * 60000) / 2, dataArea, RectangleEdge.BOTTOM); g2.setPaint(Color.black); g2.setStroke(new BasicStroke(2.0f)); g2.drawLine(left, y, right, y); } }
From source file:ca.sqlpower.swingui.object.VariablesPanel.java
/** * Default constructor for the variables panel. * @param variableHelper A helper that will be used in order to * resolve discover and resolve variables. * @param action An implementation of {@link VariableInserter} that * gets called once the variable has been created. This action will be executed * on the Swing Event Dispatch Thread.// w ww .j a v a 2 s . c o m * @param varDefinition The default variable definition string. */ public VariablesPanel(SPVariableHelper variableHelper, VariableInserter action, String varDefinition) { this.variableHelper = variableHelper; this.action = action; this.generalLabel = new JLabel("General"); this.generalLabel.setFont(this.generalLabel.getFont().deriveFont(Font.BOLD)); this.pickerLabel = new JLabel("Pick a variable"); this.varNameText = new JTextField(); this.varNameText.setEditable(false); this.varNameText.addMouseListener(new MouseListener() { public void mouseReleased(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseClicked(MouseEvent e) { ShowPickerAction act = new ShowPickerAction(); act.actionPerformed(null); } }); this.varPicker = new JButton(new ShowPickerAction()); this.optionsLabel = new JLabel("Options"); this.optionsLabel.setFont(this.optionsLabel.getFont().deriveFont(Font.BOLD)); this.varDefaultLabel = new JLabel("Default value"); this.varDefaultText = new JTextField(); this.varDefaultText.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { currentDefValue = varDefaultText.getText(); updateGUI(); } }); } public void keyReleased(KeyEvent e) { } public void keyPressed(KeyEvent e) { } }); this.varEditLabel = new JLabel("Customization"); this.varEditText = new JTextField(); this.varEditText.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { int carPos = varEditText.getCaretPosition(); String text = varEditText.getText().replace("$", "").replace("{", "").replace("}", ""); currentPickedVariable = SPVariableHelper.stripDefaultValue(text); if (currentPickedVariable == null) { currentPickedVariable = ""; } currentDefValue = SPVariableHelper.getDefaultValue(text); if (currentDefValue == null) { currentDefValue = ""; } if (SPVariableHelper.getNamespace(text) == null) { namespaceBox.setSelected(false); } else { namespaceBox.setSelected(true); } updateGUI(); try { varEditText.setCaretPosition(carPos); } catch (IllegalArgumentException e) { varEditText.setCaretPosition(carPos - 1); } } }); } public void keyReleased(KeyEvent e) { } public void keyPressed(KeyEvent e) { } }); this.namespaceLabel = new JLabel("Constrain to namespace"); this.namespaceBox = new JCheckBox(""); if (SPVariableHelper.getNamespace(varDefinition) != null || "".equals(varDefinition)) { this.namespaceBox.setSelected(true); } else { this.namespaceBox.setSelected(false); } this.namespaceBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateGUI(); } }); this.previewLabel = new JLabel("Preview"); this.previewLabel.setFont(this.previewLabel.getFont().deriveFont(Font.BOLD)); this.varPreviewLabel1 = new JLabel("Current value is"); this.varPreviewLabel1.setForeground(Color.GRAY); this.varPreviewLabel2 = new JLabel(); this.varPreviewLabel2.setForeground(Color.GRAY); this.panel = new JPanel(new MigLayout()); this.panel.add(this.generalLabel, "growx, span, wrap"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(this.pickerLabel); this.panel.add(this.varNameText, "growx, wmin 275, wmax 275, gapright 0"); this.panel.add(this.varPicker, "wmax 20, hmax 20, wrap, gapleft 0"); this.panel.add(this.optionsLabel, "growx, span, wrap"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(this.varDefaultLabel); this.panel.add(this.varDefaultText, "span, wrap, wmin 300, wmax 300"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(namespaceLabel); this.panel.add(namespaceBox, "span, wrap"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(this.varEditLabel); this.panel.add(this.varEditText, "span, wmin 300, wmax 300, wrap"); this.panel.add(this.previewLabel, "growx, span, wrap"); this.panel.add(new JLabel(" "), "wmin 20, wmax 20"); this.panel.add(this.varPreviewLabel1); this.panel.add(this.varPreviewLabel2, "span, growx"); this.currentPickedVariable = varDefinition; updateGUI(); }
From source file:i2p.bote.web.PeerInfoTag.java
private String createRelayChart(RelayPeer[] relayPeers) throws IOException { RingPlot plot;/* w w w . j a v a2s . co m*/ if (relayPeers.length == 0) { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("", 100); plot = new RingPlot(dataset); plot.setSectionPaint("", Color.gray); } else { int good = 0; int untested = 0; for (RelayPeer relayPeer : relayPeers) { int reachability = relayPeer.getReachability(); if (reachability == 0) untested += 1; else if (reachability > 80) good += 1; } int bad = relayPeers.length - good - untested; DefaultPieDataset dataset = new DefaultPieDataset(); if (good > 0) dataset.setValue(_t("Good"), good); if (bad > 0) dataset.setValue(_t("Unreliable"), bad); if (untested > 0) dataset.setValue(_t("Untested"), untested); plot = new RingPlot(dataset); plot.setSectionPaint(_t("Good"), Color.green); plot.setSectionPaint(_t("Unreliable"), Color.red); plot.setSectionPaint(_t("Untested"), Color.orange); } plot.setLabelGenerator(null); plot.setShadowGenerator(null); JFreeChart chart = new JFreeChart(_t("Relay Peers:"), JFreeChart.DEFAULT_TITLE_FONT, plot, relayPeers.length == 0 ? false : true); return ServletUtilities.saveChartAsPNG(chart, 400, 300, null); }
From source file:org.knime.knip.core.ui.imgviewer.panels.HistogramBC.java
private final void setBackgroundDefault(final JFreeChart chart) { final BasicStroke gridStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 1.0f }, 0.0f); final XYPlot plot = (XYPlot) chart.getPlot(); plot.setRangeGridlineStroke(gridStroke); plot.setDomainGridlineStroke(gridStroke); // Background of Histogram inside border //plot.setBackgroundPaint(new Color(235,235,235)); plot.setBackgroundPaint(Color.white); // change from white to gray plot.setRangeGridlinePaint(Color.gray); plot.setDomainGridlinePaint(Color.gray); // set lines invisible plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); plot.setOutlineVisible(true);// w ww.j a v a 2 s. com plot.getDomainAxis().setAxisLineVisible(false); plot.getRangeAxis().setAxisLineVisible(false); plot.getDomainAxis().setLabelPaint(Color.gray); plot.getRangeAxis().setLabelPaint(Color.gray); plot.getDomainAxis().setTickLabelPaint(Color.gray); plot.getRangeAxis().setTickLabelPaint(Color.gray); final TextTitle title = chart.getTitle(); if (title != null) { title.setPaint(Color.black); } }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.targetcharts.SparkLine.java
@Override public JFreeChart createChart(DatasetMap datasets) { logger.debug("IN"); XYDataset dataset = (XYDataset) datasets.getDatasets().get("1"); final JFreeChart sparkLineGraph = ChartFactory.createTimeSeriesChart(null, null, null, dataset, legend, false, false);/* w w w . ja va2 s. c om*/ sparkLineGraph.setBackgroundPaint(color); TextTitle title = setStyleTitle(name, styleTitle); sparkLineGraph.setTitle(title); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); sparkLineGraph.addSubtitle(subTitle); } sparkLineGraph.setBorderVisible(false); sparkLineGraph.setBorderPaint(Color.BLACK); XYPlot plot = sparkLineGraph.getXYPlot(); plot.setOutlineVisible(false); plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); plot.setBackgroundPaint(null); plot.setDomainGridlinesVisible(false); plot.setDomainCrosshairVisible(false); plot.setRangeGridlinesVisible(false); plot.setRangeCrosshairVisible(false); plot.setBackgroundPaint(color); // calculate the last marker color Paint colorLast = getLastPointColor(); // Calculate average, minimum and maximum to draw plot borders. boolean isFirst = true; double avg = 0, min = Double.POSITIVE_INFINITY, max = Double.NEGATIVE_INFINITY; int count = 0; for (int i = 0; i < timeSeries.getItemCount(); i++) { if (timeSeries.getValue(i) != null) { count++; if (isFirst) { min = timeSeries.getValue(i).doubleValue(); max = timeSeries.getValue(i).doubleValue(); isFirst = false; } double n = timeSeries.getValue(i).doubleValue(); //calculate avg, min, max avg += n; if (n < min) min = n; if (n > max) max = n; } } // average avg = avg / (double) count; // calculate min and max between thresholds! boolean isFirst2 = true; double lb = 0, ub = 0; for (Iterator iterator = thresholds.keySet().iterator(); iterator.hasNext();) { Double thres = (Double) iterator.next(); if (isFirst2 == true) { ub = thres.doubleValue(); lb = thres.doubleValue(); isFirst2 = false; } if (thres.doubleValue() > ub) ub = thres.doubleValue(); if (thres.doubleValue() < lb) lb = thres.doubleValue(); } plot.getRangeAxis().setRange(new Range(Math.min(lb, min - 2), Math.max(ub, max + 2) + 2)); addMarker(1, avg, Color.GRAY, 0.8f, plot); //addAvaregeSeries(series, plot); addPointSeries(timeSeries, plot); int num = 3; for (Iterator iterator = thresholds.keySet().iterator(); iterator.hasNext();) { Double thres = (Double) iterator.next(); TargetThreshold targThres = thresholds.get(thres); Color color = Color.WHITE; if (targThres != null && targThres.getColor() != null) { color = targThres.getColor(); } if (targThres.isVisible()) { addMarker(num++, thres.doubleValue(), color, 0.5f, plot); } } ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setVisible(false); domainAxis.setUpperMargin(0.2); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setVisible(false); plot.getRenderer().setSeriesPaint(0, Color.BLACK); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false) { public boolean getItemShapeVisible(int _series, int item) { TimeSeriesDataItem tsdi = timeSeries.getDataItem(item); if (tsdi == null) return false; Month period = (Month) tsdi.getPeriod(); int currMonth = period.getMonth(); int currYear = period.getYearValue(); int lastMonthFilled = lastMonth.getMonth(); int lastYearFilled = lastMonth.getYearValue(); boolean isLast = false; if (currYear == lastYearFilled && currMonth == lastMonthFilled) { isLast = true; } return isLast; } }; renderer.setSeriesPaint(0, Color.decode("0x000000")); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setBaseFillPaint(colorLast); renderer.setBaseOutlinePaint(Color.BLACK); renderer.setUseOutlinePaint(true); renderer.setSeriesShape(0, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0)); if (wlt_mode.doubleValue() == 0) { renderer.setBaseItemLabelsVisible(Boolean.FALSE, true); } else { renderer.setBaseItemLabelsVisible(Boolean.TRUE, true); renderer.setBaseItemLabelFont( new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize())); renderer.setBaseItemLabelPaint(styleValueLabels.getColor()); renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator("{2}", new DecimalFormat("0.###"), new DecimalFormat("0.###")) { public String generateLabel(CategoryDataset dataset, int row, int column) { if (dataset.getValue(row, column) == null || dataset.getValue(row, column).doubleValue() == 0) return ""; String columnKey = (String) dataset.getColumnKey(column); int separator = columnKey.indexOf('-'); String month = columnKey.substring(0, separator); String year = columnKey.substring(separator + 1); int monthNum = Integer.parseInt(month); if (wlt_mode.doubleValue() >= 1 && wlt_mode.doubleValue() <= 4) { if (wlt_mode.doubleValue() == 2 && column % 2 == 0) return ""; Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, monthNum - 1); SimpleDateFormat dataFormat = new SimpleDateFormat("MMM"); return dataFormat.format(calendar.getTime()); } else return "" + monthNum; } }); } if (wlt_mode.doubleValue() == 3) { renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, org.jfree.ui.TextAnchor.BOTTOM_CENTER, org.jfree.ui.TextAnchor.BOTTOM_RIGHT, Math.PI / 2)); renderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, org.jfree.ui.TextAnchor.TOP_CENTER, org.jfree.ui.TextAnchor.HALF_ASCENT_LEFT, Math.PI / 2)); } else if (wlt_mode.doubleValue() == 4) { renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, org.jfree.ui.TextAnchor.BOTTOM_CENTER, org.jfree.ui.TextAnchor.BOTTOM_RIGHT, Math.PI / 4)); renderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, org.jfree.ui.TextAnchor.TOP_CENTER, org.jfree.ui.TextAnchor.HALF_ASCENT_LEFT, Math.PI / 4)); } if (legend == true) { LegendItemCollection collection = createThresholdLegend(plot); LegendItem item = new LegendItem("Avg", "Avg", "Avg", "Avg", new Rectangle(10, 10), colorAverage); collection.add(item); plot.setFixedLegendItems(collection); } plot.setRenderer(0, renderer); logger.debug("OUT"); return sparkLineGraph; }