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:org.esa.smos.gui.gridpoint.GridPointBtDataFlagmatrixTopComponent.java
@Override protected JComponent createGridPointComponent() { dataset = new DefaultXYZDataset(); final NumberAxis xAxis = new NumberAxis("Record #"); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); xAxis.setAutoRangeIncludesZero(false); xAxis.setLowerMargin(0.0);/*from w ww .ja v a 2 s .c o m*/ xAxis.setUpperMargin(0.0); final List<FlagDescriptor> flagDescriptorList = Dddb.getInstance() .getFlagDescriptors(DEFAULT_FLAG_DESCRIPTOR_IDENTIFIER).asList(); flagDescriptors = flagDescriptorList.toArray(new FlagDescriptor[flagDescriptorList.size()]); final String[] flagNames = createFlagNames(flagDescriptors); final NumberAxis yAxis = createRangeAxis(flagNames); final LookupPaintScale paintScale = new LookupPaintScale(0.0, 4.0, Color.WHITE); paintScale.add(0.0, Color.BLACK); paintScale.add(1.0, Color.RED); paintScale.add(2.0, Color.GREEN); paintScale.add(3.0, Color.BLUE); paintScale.add(4.0, Color.YELLOW); renderer = new XYBlockRenderer(); renderer.setPaintScale(paintScale); renderer.setBaseToolTipGenerator(new FlagToolTipGenerator(flagNames)); plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.WHITE); plot.setRangeGridlinePaint(Color.WHITE); plot.setForegroundAlpha(0.5f); plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); plot.setNoDataMessage("No data"); chart = new JFreeChart(null, plot); chart.removeLegend(); chartPanel = new ChartPanel(chart); return chartPanel; }
From source file:edu.ucsd.hep.slhaviewer.view.MassGraphPanel.java
public void setParticles(SLHAdata slhaData) { MassBlock massBlock = slhaData.getMassBlock(); dataset.removeAllSeries();/*from w w w . j a v a2s . com*/ // five Higgs bosons addParticle(massBlock, 25, 0.9, Color.BLUE); // h addParticle(massBlock, 35, 0.9, Color.BLUE); // H addParticle(massBlock, 36, 0.9, Color.BLUE); // A addParticle(massBlock, 37, 1.1, Color.RED); // H+ // sleptons and sneutrinos addParticle(massBlock, 2000011, 1.9, Color.BLUE); // ~e_R addParticle(massBlock, 1000012, 1.9, Color.BLUE); // ~nu_eL addParticle(massBlock, 1000013, 1.9, Color.BLUE); // ~mu_L addParticle(massBlock, 2000013, 1.9, Color.BLUE); // ~mu_R addParticle(massBlock, 1000014, 1.9, Color.BLUE); // ~nu_muL addParticle(massBlock, 1000015, 2.1, Color.RED); // ~tau_1 addParticle(massBlock, 2000015, 2.1, Color.RED); // ~tau_2 addParticle(massBlock, 1000016, 2.1, Color.RED); // ~nu_tauL // neutralinos and charginos addParticle(massBlock, 1000022, 2.9, Color.BLUE); // ~chi_10 addParticle(massBlock, 1000023, 2.9, Color.BLUE); // ~chi_20 addParticle(massBlock, 1000025, 2.9, Color.BLUE); // ~chi_30 addParticle(massBlock, 1000035, 2.9, Color.BLUE); // ~chi_40 addParticle(massBlock, 1000024, 3.1, Color.RED); // ~chi_1+ addParticle(massBlock, 1000037, 3.1, Color.RED); // ~chi_2+ // gluino and squarks addParticle(massBlock, 1000021, 3.8, Color.GREEN); // ~g addParticle(massBlock, 1000001, 3.9, Color.BLUE); // ~d_L addParticle(massBlock, 2000001, 3.9, Color.BLUE); // ~d_R addParticle(massBlock, 1000002, 3.9, Color.BLUE); // ~u_L addParticle(massBlock, 2000002, 3.9, Color.BLUE); // ~u_R addParticle(massBlock, 1000003, 3.9, Color.BLUE); // ~s_L addParticle(massBlock, 2000003, 3.9, Color.BLUE); // ~s_R addParticle(massBlock, 1000004, 3.9, Color.BLUE); // ~c_L addParticle(massBlock, 2000004, 3.9, Color.BLUE); // ~c_R addParticle(massBlock, 1000005, 4.1, Color.GREEN); // ~b_1 addParticle(massBlock, 2000005, 4.1, Color.GREEN); // ~b_2 addParticle(massBlock, 1000006, 4.1, Color.RED); // ~t_1 addParticle(massBlock, 2000006, 4.1, Color.RED); // ~t_2 }
From source file:wsattacker.plugin.dos.dosExtension.chart.ChartObject.java
public JFreeChart createOverlaidChart() { // ---------------------------- // Data and X-Y-Axis - Response Time Testprobes // - Y-Achse 0 final DateAxis yAxis = new DateAxis("Time"); yAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); // - X-Achse 0 final NumberAxis xAxis0 = new NumberAxis("Response Time in ms"); xAxis0.setStandardTickUnits(NumberAxis.createStandardTickUnits()); // xAxis0.setTickUnit( new NumberTickUnit(1) ); // - dataset//from w w w . j av a2 s .c om // - renderer final XYDataset dataResponseTimeProbes = createDatasetResponseTime("testprobe"); final XYLineAndShapeRenderer rendererResponseTimeProbes = new XYLineAndShapeRenderer(); // StandardXYItemRenderer(); // -> // should // not // be // used rendererResponseTimeProbes.setSeriesPaint(0, Color.blue); rendererResponseTimeProbes.setSeriesShape(0, new Ellipse2D.Double(-1.5, -1.5, 3.0, 3.0)); rendererResponseTimeProbes.setSeriesLinesVisible(0, true); rendererResponseTimeProbes.setSeriesShapesVisible(0, true); rendererResponseTimeProbes.setUseOutlinePaint(false); rendererResponseTimeProbes.setSeriesOutlinePaint(0, Color.black); rendererResponseTimeProbes.setUseFillPaint(true); rendererResponseTimeProbes.setSeriesFillPaint(0, Color.blue); // ---------------------------- // NEW XYPlot (new "Data and X-Y-Axis" from above added as default) final XYPlot plot = new XYPlot(dataResponseTimeProbes, yAxis, xAxis0, rendererResponseTimeProbes); // ---------------------------- // Data and Axis 1 - Response time UNtampered // - Dataset // - Renderer. // - Dataset zu X-Axis 0 mappen final XYDataset dataResponseTimeUntampered = createDatasetResponseTime("untampered"); final XYLineAndShapeRenderer rendererResponseTimeUntampered = new XYLineAndShapeRenderer(); // StandardXYItemRenderer(); // -> // should // not // be // used rendererResponseTimeUntampered.setSeriesPaint(0, new Color(0, 161, 4)); rendererResponseTimeUntampered.setSeriesShape(0, new Ellipse2D.Double(-4, -4, 8.0, 8.0)); rendererResponseTimeUntampered.setUseFillPaint(true); rendererResponseTimeUntampered.setSeriesFillPaint(0, Color.white); rendererResponseTimeUntampered.setUseOutlinePaint(false); rendererResponseTimeUntampered.setSeriesOutlinePaint(0, Color.black); rendererResponseTimeUntampered.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00"))); plot.setDataset(2, dataResponseTimeUntampered); plot.setRenderer(2, rendererResponseTimeUntampered); // plot.mapDatasetToRangeAxis(0, 1); // ---------------------------- // Data and Axis - Response time tampered // - Dataset // - Renderer // - Dataset zu X-Axis 2 mappen final XYDataset dataResponseTimeTampered = createDatasetResponseTime("tampered"); XYLineAndShapeRenderer rendererResponseTimeTampered = new XYLineAndShapeRenderer(); // XYSplineRenderer(); rendererResponseTimeTampered.setSeriesPaint(0, new Color(189, 0, 0)); rendererResponseTimeTampered.setSeriesShape(0, new Ellipse2D.Double(-4, -4, 8.0, 8.0));// (-2.5, -2.5, 6.0, // 6.0) ); rendererResponseTimeTampered.setUseFillPaint(true); rendererResponseTimeTampered.setSeriesFillPaint(0, Color.white); rendererResponseTimeTampered.setUseOutlinePaint(false); rendererResponseTimeTampered.setSeriesOutlinePaint(0, Color.black); plot.setDataset(3, dataResponseTimeTampered); plot.setRenderer(3, rendererResponseTimeTampered); // plot.mapDatasetToRangeAxis(0, 2); // ---------------------------- // Data and X-Axis - Number Requests UNtampered // - X-Axis Number Requests final NumberAxis xAxis1 = new NumberAxis( "Number Requests Per Interval (" + (model.getIntervalLengthReport() / 1000) + " sec)"); xAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // xAxis1.setTickUnit( new NumberTickUnit(2) ); plot.setRangeAxis(1, xAxis1); // - Dataset // - Renderer final IntervalXYDataset dataNumberRequestsUntampered = createDatasetNumberRequestsUntampered(); final XYBarRenderer rendererNumberRequestsUntampered = new XYBarRenderer(0.2); rendererNumberRequestsUntampered.setShadowVisible(false); rendererNumberRequestsUntampered.setBarPainter(new StandardXYBarPainter()); rendererNumberRequestsUntampered.setSeriesPaint(0, new Color(128, 255, 128)); plot.setDataset(4, dataNumberRequestsUntampered); plot.setRenderer(4, rendererNumberRequestsUntampered); plot.mapDatasetToRangeAxis(4, 1); // ------------------------------- // Data - Number Requests tampered // - Dataset // - Renderer final IntervalXYDataset dataNumberRequestsTampered = createDatasetNumberRequestsTampered(); final XYBarRenderer rendererBarNumberRequestsTampered = new XYBarRenderer(0.2); rendererBarNumberRequestsTampered.setShadowVisible(false); rendererBarNumberRequestsTampered.setBarPainter(new StandardXYBarPainter()); rendererBarNumberRequestsTampered.setSeriesPaint(0, new Color(255, 148, 148)); plot.setDataset(5, dataNumberRequestsTampered); plot.setRenderer(5, rendererBarNumberRequestsTampered); plot.mapDatasetToRangeAxis(5, 1); // ------------------------- // Other formating stuff // - add annotations // final double x = new Day(9, SerialDate.MARCH, // 2002).getMiddleMillisecond(); // final XYTextAnnotation annotation = new // XYTextAnnotation("Anmerkung zu Datenpunkt", x, 1000.0); // annotation.setFont(new Font("SansSerif", Font.PLAIN, 9)); // plot.addAnnotation(annotation); // ------------------------- // Create custom LegendTitles // Legend Row 1 LegendTitle legendL1 = new LegendTitle(plot.getRenderer(0)); legendL1.setMargin(new RectangleInsets(2D, 2D, 2D, 2D)); legendL1.setBorder(0, 0, 0, 0); LegendTitle legendR1 = new LegendTitle(plot.getRenderer(4)); legendR1.setMargin(new RectangleInsets(2D, 2D, 2D, 2D)); legendR1.setBorder(0, 0, 0, 0); BlockContainer blockcontainer = new BlockContainer(new BorderArrangement()); blockcontainer.setBorder(0, 0, 0, 0); blockcontainer.add(legendL1, RectangleEdge.LEFT); blockcontainer.add(legendR1, RectangleEdge.RIGHT); blockcontainer.add(new EmptyBlock(2000D, 0.0D)); CompositeTitle compositetitle1 = new CompositeTitle(blockcontainer); compositetitle1.setPosition(RectangleEdge.BOTTOM); // Legend Row 2 LegendTitle legendL2 = new LegendTitle(plot.getRenderer(2)); legendL2.setMargin(new RectangleInsets(2D, 2D, 2D, 2D)); legendL2.setBorder(0, 0, 0, 0); LegendTitle legendR2 = new LegendTitle(plot.getRenderer(5)); legendR2.setMargin(new RectangleInsets(2D, 2D, 2D, 2D)); legendR2.setBorder(0, 0, 0, 0); BlockContainer blockcontainer2 = new BlockContainer(new BorderArrangement()); blockcontainer2.setBorder(0, 0, 0, 0); blockcontainer2.add(legendL2, RectangleEdge.LEFT); blockcontainer2.add(legendR2, RectangleEdge.RIGHT); blockcontainer2.add(new EmptyBlock(2000D, 0.0D)); CompositeTitle compositetitle2 = new CompositeTitle(blockcontainer2); compositetitle2.setPosition(RectangleEdge.BOTTOM); // Legend Row 3 LegendTitle legendL3 = new LegendTitle(plot.getRenderer(3)); legendL3.setMargin(new RectangleInsets(2D, 2D, 2D, 2D)); legendL3.setBorder(0, 0, 0, 0); BlockContainer blockcontainer3 = new BlockContainer(new BorderArrangement()); blockcontainer3.setBorder(0, 0, 0, 0); blockcontainer3.add(legendL3, RectangleEdge.LEFT); blockcontainer3.add(new EmptyBlock(2000D, 0.0D)); CompositeTitle compositetitle3 = new CompositeTitle(blockcontainer3); compositetitle3.setPosition(RectangleEdge.BOTTOM); // ------------------------- // create Chart // - return a new chart containing the overlaid plot... plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart jFreeChart = new JFreeChart(model.getAttackName() + " - Response Time Plot", // Roundtrip Time Plot JFreeChart.DEFAULT_TITLE_FONT, plot, true); // Add new legend boxes + format jFreeChart.addSubtitle(compositetitle1); jFreeChart.addSubtitle(compositetitle2); jFreeChart.addSubtitle(compositetitle3); // Surpress old Legends LegendTitle legendee2 = jFreeChart.getLegend(0); legendee2.setVisible(false); return jFreeChart; }
From source file:org.fhaes.jsea.JSEABarChart.java
/** * Creates a demo chart.//from w ww. jav a 2 s. com * * @return A chart. */ @SuppressWarnings("deprecation") public static JFreeChart createChart(String title, double[] meanByWindow, int lengthOfWindow, int yearsPriorOfEvent, int yearsAfterEvent, double[][] leftEndPointSim, double[][] rightEndPointSim, String outputFilePrefix, int alphaLevel, int segmentIndex) { JSEABarChart.meanByWindow = meanByWindow; JSEABarChart.lengthOfWindow = lengthOfWindow; JSEABarChart.yearsPriorOfEvent = yearsPriorOfEvent; JSEABarChart.leftEndPointSim = leftEndPointSim; JSEABarChart.rightEndPointSim = rightEndPointSim; JSEABarChart.alphaLevel = alphaLevel; CategoryPlot plot = new CategoryPlot(); plot.setDataset(0, createDataset()); plot.setOrientation(PlotOrientation.VERTICAL); CustomBarRenderer renderer = new CustomBarRenderer(createPaint(lengthOfWindow, Color.gray)); renderer.setBarPainter(new StandardBarPainter()); renderer.setDrawBarOutline(false); renderer.setOutlinePaint(Color.yellow); renderer.setOutlineStroke(new BasicStroke(1.1f, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL)); renderer.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL)); plot.setRenderer(0, renderer); Color allcolors[] = { Color.red, Color.green, Color.blue }; System.out.println("here is the alphlevel " + alphaLevel); // for (int k = 0; k <= 5; k++) { // if (k <= 2) { // / plot.setDataset(k + 1, createEndDataset(k, true)); // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k], k)); // } else { // plot.setDataset(k + 1, createEndDataset(k - 3, false)); // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k - 3], k - 3)); // } // } // for (int k = 0; k <1; k++) { // if (k <= 2) { plot.setDataset(1, createEndDataset(alphaLevel, true)); plot.setRenderer(1, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel)); // } else { plot.setDataset(4, createEndDataset(alphaLevel, false)); plot.setRenderer(4, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel)); // } // } plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // plot.setBackgroundPaint(Color.WHITE); plot.setDomainAxis(new CategoryAxis("LAG")); plot.addRangeMarker(new ValueMarker(0)); plot.setRangeAxis(new NumberAxis(outputFilePrefix)); plot.setRangeGridlinesVisible(true); JFreeChart chart = new JFreeChart(plot); chart.setTitle(title); chart.removeLegend(); chart.setBackgroundPaint(Color.WHITE); return chart; }
From source file:net.sf.dynamicreports.test.jasper.chart.XyBarChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//from ww w . ja v a 2 s . co m JFreeChart chart = getChart("summary.chart1", 0); XYPlot plot = chart.getXYPlot(); Assert.assertEquals("renderer", XYBarRenderer.class, plot.getRenderer().getClass()); Assert.assertTrue("show labels", plot.getRenderer().getBaseItemLabelsVisible()); //Assert.assertFalse("show tick labels", plot.getDomainAxis().isTickMarksVisible()); //Assert.assertFalse("show tick marks", plot.getDomainAxis().isTickLabelsVisible()); 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()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
From source file:com.charts.ThreeMonthChart.java
public ThreeMonthChart(YStockQuote currentStock) throws ParseException { DateAxis domainAxis = new DateAxis("Date"); NumberAxis rangeAxis = new NumberAxis("Price"); CandlestickRenderer renderer = new CandlestickRenderer(); XYDataset dataset = getDataSet(currentStock); XYPlot mainPlot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); //Do some setting up, see the API Doc renderer.setSeriesPaint(0, Color.BLACK); renderer.setDrawVolume(false);/*from w ww .j av a 2 s . c om*/ rangeAxis.setAutoRangeIncludesZero(false); domainAxis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yy")); domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); //Now create the chart and chart panel JFreeChart chart = new JFreeChart(currentStock.get_name(), null, mainPlot, false); chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(600, 300)); XYPlot plot = (XYPlot) chart.getPlot(); LegendTitle legend = new LegendTitle(plot); chart.addLegend(legend); chart.getLegend().setVisible(true); chart.getLegend().setPosition(RectangleEdge.BOTTOM); ValueAxis yAxis = (ValueAxis) plot.getRangeAxis(); DateAxis xAxis = (DateAxis) plot.getDomainAxis(); Date now = new Date(); SegmentedTimeline segmentedTimeline = SegmentedTimeline.newMondayThroughFridayTimeline(); Calendar[][] holidays = DayRange.getHolidayDates(); int len = holidays.length; for (int i = 0; i < holidays[0].length; i++) { Calendar day = Calendar.getInstance(TimeZone.getTimeZone("EST")); day.set(Calendar.YEAR, holidays[0][i].get(Calendar.YEAR)); day.set(Calendar.MONTH, holidays[0][i].get(Calendar.MONTH)); day.set(Calendar.DAY_OF_MONTH, holidays[0][i].get(Calendar.DAY_OF_MONTH)); day.set(Calendar.HOUR_OF_DAY, 9); segmentedTimeline.addException(day.getTime()); } xAxis.setTimeline(segmentedTimeline); //xAxis.setVerticalTickLabels(true); xAxis.setDateFormatOverride(new SimpleDateFormat("MMM y")); xAxis.setAutoTickUnitSelection(true); xAxis.setAutoRange(true); renderer.setAutoWidthFactor(0.5); renderer.setUpPaint(Color.green); renderer.setDownPaint(new Color(0xc0, 0x00, 0x00)); renderer.setSeriesPaint(0, Color.black); StandardXYItemRenderer renderer1 = new StandardXYItemRenderer(); renderer1.setSeriesPaint(0, Color.BLUE); TimeSeries movingAverage30 = MovingAverage.createMovingAverage(close, "MA(30)", 30, 0); Double currMA30 = (Double) movingAverage30.getDataItem(movingAverage30.getItemCount() - 1).getValue(); currMA30 = Math.round(currMA30 * 100.0) / 100.0; movingAverage30.setKey("MA(30): " + currMA30); TimeSeriesCollection collection = new TimeSeriesCollection(); collection.addSeries(movingAverage30); plot.setDataset(1, collection); plot.setRenderer(1, renderer1); chartPanel.revalidate(); chartPanel.repaint(); chartPanel.revalidate(); chartPanel.repaint(); }
From source file:edu.ku.brc.ui.skin.SkinsMgr.java
/** * Loads the skins from XML./* w ww . j a va2s . c om*/ */ @SuppressWarnings("unchecked") protected static Hashtable<String, Skin> load() { XStream xstream = new XStream(); config(xstream); if (false) { Hashtable<String, Skin> skinsHash = new Hashtable<String, Skin>(); /* giraffe_tile.png giraffe_tile1.png metal.jpg reptile_tiled.jpg reptile_tiled.png */ String p = "/Users/rods/workspace/Specify6/"; Skin skin1 = new Skin("metal", "metal desc"); skin1.getItems().put("item1", new SkinItem("n1", "fn", 10, "plain", Color.BLACK, Color.MAGENTA, p + "giraffe_tile.png", "desc")); skin1.getItems().put("item2", new SkinItem("n2", "fn", 10, "bold", Color.BLACK, Color.ORANGE, p + "giraffe_tile.png", "desc")); Skin skin2 = new Skin("giraffe", "metal desc"); skin2.getItems().put("item1", new SkinItem("n1", "fn", 10, "bolditalic", Color.GREEN, Color.YELLOW, p + "metal.jpg", "desc")); skin2.getItems().put("item2", new SkinItem("n2", "fn", 10, "italic", Color.BLUE, Color.RED, p + "metal.jpg", "desc")); skinsHash.put(skin1.getName(), skin1); skinsHash.put(skin2.getName(), skin2); File skinsFile = new File(XMLHelper.getConfigDirPath("skins.xml")); try { FileUtils.writeStringToFile(skinsFile, xstream.toXML(skinsHash)); } catch (IOException ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SkinsMgr.class, ex); ex.printStackTrace(); } } File skinsFile = new File(XMLHelper.getConfigDirPath("skins.xml")); if (skinsFile.exists()) { return (Hashtable<String, Skin>) xstream.fromXML(XMLHelper.getContents(skinsFile)); } return null; }
From source file:st.jigasoft.dbutil.util.ReportTheme.java
private static Color colorItems(int i) { ReportTheme.MAX_COLUNS_COLOR = 5;//www . j ava 2 s. co m switch (i) { case 1: return Color.BLUE; case 2: return Color.RED; case 3: return Color.GREEN; default: return Color.YELLOW; } }
From source file:osh.comdriver.simulation.cruisecontrol.AbstractDrawer.java
/** * Creates a chart.//from ww w . java2s . c o m * * @param dataset1 a dataset. * * @return A chart. */ private JFreeChart createChart(XYDataset dataset, long lastentry) { JFreeChart chart = ChartFactory.createTimeSeriesChart(name, // title "time", // x-axis label "temperature", // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis axis1 = new NumberAxis(getAxisName()); axis1.setAutoRangeIncludesZero(isIncludeZero()); plot.setRangeAxis(0, axis1); plot.setDataset(0, dataset); plot.mapDatasetToRangeAxis(1, 0); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); //TODO: SHADOWS OFF final StandardXYItemRenderer r1 = new StandardXYItemRenderer(); plot.setRenderer(0, r1); r1.setSeriesPaint(0, Color.BLUE); r1.setSeriesPaint(1, Color.RED); r1.setSeriesPaint(2, Color.GREEN); //plot.setDomainAxis(new NumberAxis("time")); plot.setDomainAxis(new DateAxis()); plot.getDomainAxis().setAutoRange(false); long begin = getRangeBegin(lastentry); long end = getRangeEnd(lastentry); plot.getDomainAxis().setRange(begin, end); return chart; }
From source file:com.charts.SixMonthChart.java
public SixMonthChart(YStockQuote currentStock) throws ParseException { DateAxis domainAxis = new DateAxis("Date"); NumberAxis rangeAxis = new NumberAxis("Price"); CandlestickRenderer renderer = new CandlestickRenderer(); XYDataset dataset = getDataSet(currentStock); XYPlot mainPlot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); //Do some setting up, see the API Doc renderer.setSeriesPaint(0, Color.BLACK); renderer.setDrawVolume(false);/*from w ww .j a va2 s .c om*/ rangeAxis.setAutoRangeIncludesZero(false); domainAxis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yy")); domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); //Now create the chart and chart panel JFreeChart chart = new JFreeChart(currentStock.get_name(), null, mainPlot, false); chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(600, 300)); XYPlot plot = (XYPlot) chart.getPlot(); LegendTitle legend = new LegendTitle(plot); chart.addLegend(legend); chart.getLegend().setVisible(true); chart.getLegend().setPosition(RectangleEdge.BOTTOM); ValueAxis yAxis = (ValueAxis) plot.getRangeAxis(); DateAxis xAxis = (DateAxis) plot.getDomainAxis(); Date now = new Date(); SegmentedTimeline segmentedTimeline = SegmentedTimeline.newMondayThroughFridayTimeline(); Calendar[][] holidays = DayRange.getHolidayDates(); int len = holidays.length; for (int i = 0; i < holidays[0].length; i++) { Calendar day = Calendar.getInstance(TimeZone.getTimeZone("EST")); day.set(Calendar.YEAR, holidays[0][i].get(Calendar.YEAR)); day.set(Calendar.MONTH, holidays[0][i].get(Calendar.MONTH)); day.set(Calendar.DAY_OF_MONTH, holidays[0][i].get(Calendar.DAY_OF_MONTH)); day.set(Calendar.HOUR_OF_DAY, 9); segmentedTimeline.addException(day.getTime()); } xAxis.setTimeline(segmentedTimeline); //xAxis.setVerticalTickLabels(true); xAxis.setDateFormatOverride(new SimpleDateFormat("MMM y")); xAxis.setAutoTickUnitSelection(true); xAxis.setAutoRange(true); renderer.setAutoWidthFactor(0.5); renderer.setUpPaint(Color.green); renderer.setDownPaint(new Color(0xc0, 0x00, 0x00)); renderer.setSeriesPaint(0, Color.black); StandardXYItemRenderer renderer1 = new StandardXYItemRenderer(); renderer1.setSeriesPaint(0, Color.BLUE); TimeSeries movingAverage30 = MovingAverage.createMovingAverage(close, "MA(30)", 30, 0); Double currMA30 = (Double) movingAverage30.getDataItem(movingAverage30.getItemCount() - 1).getValue(); currMA30 = Math.round(currMA30 * 100.0) / 100.0; movingAverage30.setKey("MA(30): " + currMA30); TimeSeriesCollection collection = new TimeSeriesCollection(); collection.addSeries(movingAverage30); plot.setDataset(1, collection); plot.setRenderer(1, renderer1); chartPanel.revalidate(); chartPanel.repaint(); chartPanel.revalidate(); chartPanel.repaint(); }