List of usage examples for java.awt Color lightGray
Color lightGray
To view the source code for java.awt Color lightGray.
Click Source Link
From source file:com.liferay.server.admin.web.internal.portlet.action.ViewChartMVCResourceCommand.java
protected MeterPlot getMeterPlot(ThemeDisplay themeDisplay, ValueDataset valueDataset) { MeterPlot meterPlot = new MeterPlot(valueDataset); meterPlot.addInterval(new MeterInterval(themeDisplay.translate("normal"), new Range(0.0D, 75D), Color.lightGray, new BasicStroke(2.0F), new Color(0, 255, 0, 64))); meterPlot.addInterval(new MeterInterval(themeDisplay.translate("warning"), new Range(75D, 90D), Color.lightGray, new BasicStroke(2.0F), new Color(255, 255, 0, 64))); meterPlot.addInterval(new MeterInterval(themeDisplay.translate("critical"), new Range(90D, 100D), Color.lightGray, new BasicStroke(2.0F), new Color(255, 0, 0, 128))); meterPlot.setDialBackgroundPaint(Color.white); meterPlot.setDialShape(DialShape.PIE); meterPlot.setDialOutlinePaint(Color.gray); meterPlot.setTickLabelFont(new Font(null, Font.PLAIN, 10)); meterPlot.setTickLabelPaint(Color.darkGray); meterPlot.setTickLabelsVisible(true); meterPlot.setTickPaint(Color.lightGray); meterPlot.setTickSize(5D);/*from w w w . j a v a2 s . c om*/ meterPlot.setMeterAngle(180); meterPlot.setNeedlePaint(Color.darkGray); meterPlot.setRange(new Range(0.0D, 100D)); meterPlot.setValueFont(new Font(null, Font.PLAIN, 10)); meterPlot.setValuePaint(Color.black); meterPlot.setUnits("%"); return meterPlot; }
From source file:edu.ucla.stat.SOCR.chart.demo.StatisticalBarChartDemo1.java
/** * Creates a sample chart.// ww w.j a v a 2s . co m * * @param dataset a dataset. * * @return The chart. */ protected JFreeChart createChart(CategoryDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createLineChart(chartTitle, // chart title domainLabel, // domain axis label rangeLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation !legendPanelOn, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(true); // customise the renderer... StatisticalBarRenderer renderer = new StatisticalBarRenderer(); renderer.setErrorIndicatorPaint(Color.black); // renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); plot.setRenderer(renderer); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.BoxAndWhiskerChartDemo1.java
/** * Creates a sample chart./*from ww w .jav a2s . c om*/ * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(BoxAndWhiskerCategoryDataset dataset) { CategoryAxis domainAxis = new CategoryAxis(null); NumberAxis rangeAxis = new NumberAxis(rangeLabel); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer); JFreeChart chart = new JFreeChart(chartTitle, plot); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); renderer.setLegendItemLabelGenerator( new SOCRCategoryCellLabelGenerator(dataset, values_storage, SERIES_COUNT, CATEGORY_COUNT)); //RowCount -- serie count if (dataset.getColumnCount() * dataset.getRowCount() < 5) { domainAxis.setLowerMargin(0.2); domainAxis.setUpperMargin(0.2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(0.5); // domainAxis.setCategoryMargin(domainAxis.getCategoryMargin()*2); /* System.out.println("1lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin());*/ } else if (dataset.getColumnCount() * dataset.getRowCount() < 10) { domainAxis.setLowerMargin(domainAxis.getLowerMargin() * 2); domainAxis.setUpperMargin(domainAxis.getUpperMargin() * 2); if (dataset.getColumnCount() == 1) renderer.setItemMargin(renderer.getItemMargin() * 2); else domainAxis.setCategoryMargin(domainAxis.getCategoryMargin() * 2); /*System.out.println("2lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin());*/ } if (legendPanelOn) chart.removeLegend(); return chart; }
From source file:gui.BarChart.java
/** * Zusammenbauen des Diagrammes./*from w ww . jav a2s. co m*/ * * @return diagramm */ private JFreeChart createChart() { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("", // berschrift label_x_axis, // x label label_y_axis, // y label dataset, // datenstze PlotOrientation.VERTICAL, // vertikale balken true, // mit legende true, // mit tooltips false // URLs??? ); // Layoutanpassungen im Folgende: // allg. Hintergrundfarbe chart.setBackgroundPaint(Color.white); // Referenz auf Zeichnung: final CategoryPlot plot = chart.getCategoryPlot(); plot.setNoDataMessage("NO DATA!"); // aussehen des eigentlichen diagrammes: plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); // skaleneinteilung: final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setUpperMargin(0.1); // kategorien renderer einstellungen verndern: final CategoryItemRenderer categories = plot.getRenderer(); // casten in bar renderer: final BarRenderer bars = (BarRenderer) categories; // werte im diagramm anzeigen: categories.setLabelGenerator(new StandardCategoryLabelGenerator()); categories.setItemLabelsVisible(true); final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER, TextAnchor.CENTER, -Math.PI / 6); categories.setPositiveItemLabelPosition(p); categories.setNegativeItemLabelPosition(p); plot.setRenderer(categories); // farbverlauf der serien 1 und 2 final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, new Color(127, 127, 255), 0.0f, 0.0f, new Color(127, 127, 127)); final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, new Color(255, 127, 127), 0.0f, 0.0f, new Color(127, 127, 127)); bars.setSeriesPaint(0, gp0); bars.setSeriesPaint(1, gp1); // keine umrandung der balken bars.setDrawBarOutline(false); // abstand der zahlen vom balken bars.setItemLabelAnchorOffset(13); // x achsenbeschriftung final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); return chart; }
From source file:lab10part2.Chart.java
private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? );/*from w w w.j a v a 2s. c om*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); // set up gradient paints for series... final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:com.wattzap.view.Profile.java
@Override public void callback(Messages message, Object o) { double distance = 0.0; switch (message) { case SPEED:// w ww . j av a2 s .c o m Telemetry t = (Telemetry) o; distance = t.getDistanceKM(); break; case STARTPOS: distance = (Double) o; break; case CLOSE: if (this.isVisible()) { remove(chartPanel); setVisible(false); revalidate(); } return; case GPXLOAD: // Note if we are loading a Power Profile there is no GPX data so we don't show the chart panel RouteReader routeData = (RouteReader) o; if (chartPanel != null) { remove(chartPanel); if (routeData.routeType() == RouteReader.POWER) { setVisible(false); chartPanel.revalidate(); return; } } else if (routeData.routeType() == RouteReader.POWER) { return; } logger.debug("Load " + routeData.getFilename()); XYDataset xyDataset = new XYSeriesCollection(routeData.getSeries()); // create the chart... final JFreeChart chart = ChartFactory.createXYAreaChart(routeData.getName(), // chart // title userPrefs.messages.getString("distancekm"), // domain axis label userPrefs.messages.getString("heightMeters"), // range axis label xyDataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend false, // tooltips false // urls ); chart.setBackgroundPaint(Color.darkGray); plot = chart.getXYPlot(); // plot.setForegroundAlpha(0.85f); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickLabelPaint(Color.white); rangeAxis.setLabelPaint(Color.white); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickLabelPaint(Color.white); domainAxis.setLabelPaint(Color.white); double minY = routeData.getSeries().getMinY(); double maxY = routeData.getSeries().getMaxY(); rangeAxis.setRange(minY - 100.0, maxY + 100.0); chartPanel = new ChartPanel(chart); chartPanel.setSize(100, 800); setLayout(new BorderLayout()); add(chartPanel, BorderLayout.CENTER); setBackground(Color.black); chartPanel.revalidate(); setVisible(true); break; }// switch if (plot == null) { return; } if (marker != null) { plot.removeDomainMarker(marker); } marker = new ValueMarker(distance); marker.setPaint(Color.blue); BasicStroke stroke = new BasicStroke(2); marker.setStroke(stroke); plot.addDomainMarker(marker); }
From source file:com.polivoto.vistas.acciones.Datos.java
private JFreeChart crearChartPie(PieDataset dataset, String titulo) { JFreeChart chart = ChartFactory.createPieChart(titulo, dataset, false, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setStartAngle(290);//w ww. j a va2 s . c om plot.setDirection(Rotation.ANTICLOCKWISE); plot.setNoDataMessage("No hay votos"); try { if (ac.getConteoOpcionesPregunta().getJSONObject(pox).getInt("participantes") != 0) { int j = 0; for (int i = 0; i < ac.getConteoOpcionesPregunta().getJSONObject(pox).getJSONArray("conteo") .length(); i++) { try { if (ac.getConteoOpcionesPregunta().getJSONObject(pox).getJSONArray("conteo") .getJSONObject(i).getString("reactivo").equals("Anular mi voto")) { plot.setSectionPaint("Nulo", Color.lightGray); } else { plot.setSectionPaint(ac.getConteoOpcionesPregunta().getJSONObject(pox) .getJSONArray("conteo").getJSONObject(i).getString("reactivo"), colores.get(j)); j++; } } catch (JSONException ex) { ex.printStackTrace(); } } } } catch (JSONException ex) { ex.printStackTrace(); } plot.setSimpleLabels(true); plot.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.white)); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {2} de votos", new DecimalFormat("0"), new DecimalFormat("0.000%")); plot.setLabelGenerator(gen); if (rotating) { final Rotator rotate = new Rotator(plot); rotate.start(); } return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.BarChartDemo3.java
/** * Creates a sample chart./*w w w . ja v a 2 s. c o 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:ch.opentrainingcenter.charts.bar.OTCCategoryChartViewer.java
JFreeChart createChart() { chart = ChartFactory.createBarChart("", "", "", dataset, PlotOrientation.VERTICAL, false, true, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ chart.setAntiAlias(true);//from w w w . j a v a 2 s. com chart.setBorderVisible(false); chart.setAntiAlias(true); chart.setBorderVisible(true); chart.setTextAntiAlias(true); chart.setBackgroundPaint(Color.white); chart.setBorderPaint(Color.white); // final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); return chart; }
From source file:osh.comdriver.simulation.cruisecontrol.ScheduleDrawer.java
/** * Creates a chart.//w ww . j a v a 2 s . com * * @param dataset1 a dataset. * @return A chart. */ private static JFreeChart createChart(XYDataset dataset1, //power XYDataset dataset2, //costs XYDataset dataset3, long time) { JFreeChart chart = ChartFactory.createTimeSeriesChart("schedule", // title "time", // x-axis label "power", // y-axis label dataset1, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis axis1 = new NumberAxis("power"); NumberAxis axis2 = new NumberAxis("costs"); axis1.setAutoRangeIncludesZero(true); axis1.setUpperBound(5000); axis1.setLowerBound(-5000); axis2.setAutoRangeIncludesZero(true); axis2.setUpperBound(50); axis2.setLowerBound(0); plot.setRangeAxis(0, axis1); plot.setRangeAxis(1, axis2); plot.setDataset(1, dataset2); plot.mapDatasetToRangeAxis(1, 1); plot.setDataset(2, dataset3); plot.mapDatasetToRangeAxis(2, 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(); final StandardXYItemRenderer r2 = new StandardXYItemRenderer(); final StandardXYItemRenderer r3 = new StandardXYItemRenderer(); final StandardXYItemRenderer r4 = new StandardXYItemRenderer(); plot.setRenderer(0, r1); plot.setRenderer(1, r2); plot.setRenderer(2, r3); plot.setRenderer(3, r4); int numberOfSeries = 0; numberOfSeries += dataset1.getSeriesCount(); numberOfSeries += dataset2.getSeriesCount(); numberOfSeries += dataset3.getSeriesCount(); Color[] color = new Color[numberOfSeries]; for (int i = 0; i < numberOfSeries / 2; i++) { color[i] = Color.getHSBColor(i * 1.0f / (numberOfSeries / 2), 1.0f, 1.0f); } int i = 0; for (int j = 0; j < dataset1.getSeriesCount() / 2; j++) { float[] rgbcolor = Color.RGBtoHSB(color[i].getRed(), color[i].getGreen(), color[i].getBlue(), null); plot.getRendererForDataset(dataset1).setSeriesPaint(2 * j, Color.getHSBColor(rgbcolor[0], 1.0f, 1.0f)); plot.getRendererForDataset(dataset1).setSeriesPaint(2 * j + 1, Color.getHSBColor(rgbcolor[0], 1.0f, 0.6f)); i++; } for (int j = 0; j < dataset2.getSeriesCount() / 2; j++) { float[] rgbcolor = Color.RGBtoHSB(color[i].getRed(), color[i].getGreen(), color[i].getBlue(), null); plot.getRendererForDataset(dataset2).setSeriesPaint(2 * j, Color.getHSBColor(rgbcolor[0], 1.0f, 1.0f)); plot.getRendererForDataset(dataset2).setSeriesPaint(2 * j + 1, Color.getHSBColor(rgbcolor[0], 1.0f, 0.6f)); i++; } for (int j = 0; j < dataset3.getSeriesCount() / 2; j++) { float[] rgbcolor = Color.RGBtoHSB(color[i].getRed(), color[i].getGreen(), color[i].getBlue(), null); plot.getRendererForDataset(dataset3).setSeriesPaint(2 * j, Color.getHSBColor(rgbcolor[0], 1.0f, 1.0f)); plot.getRendererForDataset(dataset3).setSeriesPaint(2 * j + 1, Color.getHSBColor(rgbcolor[0], 1.0f, 0.6f)); i++; } // NOW line double upperBound = plot.getRangeAxis(1).getUpperBound(); double lowerBound = plot.getRangeAxis(1).getLowerBound(); XYSeries nowLine = new XYSeries("now"); nowLine.add(time * 1000, lowerBound); nowLine.add(time * 1000, upperBound); XYSeriesCollection nowColl = new XYSeriesCollection(); //power axis nowColl.addSeries(nowLine); XYDataset nowSet = nowColl; plot.setDataset(3, nowSet); plot.mapDatasetToRangeAxis(3, 1); plot.getRendererForDataset(nowSet).setSeriesPaint(0, Color.DARK_GRAY); plot.getRendererForDataset(nowSet).setSeriesStroke(0, (Stroke) new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 6.0f }, 0.0f)); plot.setDomainAxis(new DateAxis()); plot.getDomainAxis().setAutoRange(false); long begin = (time / 86400) * 86400 * 1000; //beginning of day long end = begin + 86400 * 2 * 1000; plot.getDomainAxis().setRange(begin, end); return chart; }