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:cit.workflow.engine.manager.test.SWTTimeSeriesDemo.java
/** * Creates a chart./*ww w . ja va2s.co m*/ * * @param dataset a dataset. * * @return A chart. */ private static JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", // title "Date", // x-axis label "Price Per Unit", // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); 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); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); } DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); return chart; }
From source file:com.kiyoshi.gui.AreaChart.java
private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createAreaChart("Area Chart", // 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 .jav a2s .c o m*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setAnchor(StandardLegend.SOUTH); chart.setBackgroundPaint(Color.white); final CategoryPlot plot = chart.getCategoryPlot(); plot.setForegroundAlpha(0.5f); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); domainAxis.addCategoryLabelToolTip("Type 1", "The first type."); domainAxis.addCategoryLabelToolTip("Type 2", "The second type."); domainAxis.addCategoryLabelToolTip("Type 3", "The third type."); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLabelAngle(0 * Math.PI / 2.0); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:gui.Plotter1D.java
private ChartPanel createChartPanel1(String grapheName) { XYSplineRenderer xysplinerenderer = new XYSplineRenderer(); ValueAxis valueAxis = new NumberAxis("X"); valueAxis.setRange(0.0, 1.0);// w w w. ja v a 2s.c o m ValueAxis valueAxisy = new NumberAxis("Y"); valueAxis.setRange(0.0, 1.0); XYPlot xyplot; xyplot = new XYPlot(xyseriescollection, valueAxis, valueAxisy, xysplinerenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); JFreeChart jfreechart = new JFreeChart(grapheName, JFreeChart.DEFAULT_TITLE_FONT, xyplot, true); jfreechart.setBackgroundPaint(Color.white); ChartPanel chartpanel = new ChartPanel(jfreechart, false); return chartpanel; }
From source file:Utils.GeneradorDeGraficas.java
public JFreeChart graficarCostos(DeterministaGeneral general, String unidad) { XYDataset dataset;/*from w ww . j a v a 2 s . c o m*/ dataset = createDatasetCosto(general, unidad); JFreeChart chart = ChartFactory.createXYLineChart("Anlisis de Costo de Inventario por " + unidad, "Cantidad de pedido", "Costo", dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(4, black, true); renderer.setSeriesPaint(3, black, true); /* renderer.setShapesFilled(true); renderer.setShapesVisible(true);*/ XYPlot plot2 = chart.getXYPlot(); NumberAxis rangeAxis = (NumberAxis) plot2.getRangeAxis(); rangeAxis.setAutoRange(false); rangeAxis.setUpperBound(general.calcularCostoGrafica(general.calcularCantidadOptimaOrdenar()) * 2); return chart; }
From source file:ws.moor.bt.gui.charts.DownloadRatePerPeer.java
private JFreeChart createChart() { JFreeChart chart = ChartFactory.createBarChart("Top 20 Download Rates", "Remote IP", "KB/s", createDataset(), PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0)); return chart; }
From source file:amicity.graph.pc.gui.AutoMatchViewer.java
public AutoMatchViewer(JungGraph aGraph) { super(aGraph); vv.setBackground(Color.lightGray); layoutMap = new HashMap<JungGraph, Layout<Node, Edge>>(); }
From source file:it.eng.spagobi.engines.kpi.bo.charttypes.dialcharts.Meter.java
/** * Creates the MeterChart .//from w w w . ja v a 2 s . c om * * @return A MeterChart . */ public JFreeChart createChart() { logger.debug("IN"); if (dataset == null) { logger.debug("The dataset to be represented is null"); return null; } MeterPlot plot = new MeterPlot((ValueDataset) dataset); logger.debug("Created new plot"); plot.setRange(new Range(lower, upper)); logger.debug("Setted plot range"); for (Iterator iterator = intervals.iterator(); iterator.hasNext();) { KpiInterval interval = (KpiInterval) iterator.next(); plot.addInterval(new MeterInterval(interval.getLabel(), new Range(interval.getMin(), interval.getMax()), Color.lightGray, new BasicStroke(2.0f), interval.getColor())); logger.debug("Added new interval to the plot"); } plot.setNeedlePaint(Color.darkGray); plot.setDialBackgroundPaint(Color.white); plot.setDialOutlinePaint(Color.gray); plot.setDialShape(DialShape.CHORD); plot.setMeterAngle(260); plot.setTickLabelsVisible(true); Font f = new Font("Arial", Font.PLAIN, 11); plot.setTickLabelFont(f); plot.setTickLabelPaint(Color.darkGray); plot.setTickSize(5.0); plot.setTickPaint(Color.lightGray); plot.setValuePaint(Color.black); plot.setValueFont(new Font("Arial", Font.PLAIN, 14)); logger.debug("Setted all properties of the plot"); JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); logger.debug("Created the chart"); chart.setBackgroundPaint(color); logger.debug("Setted background color of the chart"); TextTitle title = setStyleTitle(name, styleTitle); chart.setTitle(title); logger.debug("Setted the title of the chart"); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); chart.addSubtitle(subTitle); logger.debug("Setted the subtitle of the chart"); } logger.debug("OUT"); return chart; }
From source file:it.alus.GPSreceiver.instruments.Compass.java
public Compass(boolean trueTrack) { super(null);// w ww . j av a 2s . c o m isTrueTrack = trueTrack; dataset = new DefaultValueDataset(0.0); DialPlot plot = new DialPlot(); //Image background=Toolkit.getDefaultToolkit().getImage(getClass().getResource("heading.png")); //plot.setBackgroundImage(background); plot.setView(0.0, 0.0, 1.0, 1.0); plot.setDataset(0, dataset); StandardDialFrame dialFrame = new StandardDialFrame(); dialFrame.setBackgroundPaint(Color.lightGray); dialFrame.setForegroundPaint(Color.gray); N = new DialTextAnnotation("N"); N.setFont(new Font("Arial", 1, 32)); N.setPaint(Color.white); N.setAnchor(TextAnchor.CENTER); plot.addLayer(N); S = new DialTextAnnotation("S"); S.setFont(new Font("Arial", 1, 32)); S.setPaint(Color.white); S.setAnchor(TextAnchor.CENTER); plot.addLayer(S); W = new DialTextAnnotation("W"); W.setFont(new Font("Arial", 1, 32)); W.setPaint(Color.white); W.setAnchor(TextAnchor.CENTER); plot.addLayer(W); E = new DialTextAnnotation("E"); E.setFont(new Font("Arial", 1, 32)); E.setPaint(Color.white); E.setAnchor(TextAnchor.CENTER); plot.addLayer(E); repositionDirectionsLabels(90); DialValueIndicator valueindicator = new DialValueIndicator(0); plot.addLayer(valueindicator); plot.setDialFrame(dialFrame); realScale = new StandardDialScale(0, 360, 90, -360, 30, 6); realScale.setVisible(false); realScale.setFirstTickLabelVisible(false); plot.addScale(0, realScale); dispScale = new StandardDialScale(0, 36, 90, -360, 3, 15); dispScale.setFirstTickLabelVisible(false); dispScale.setMajorTickPaint(Color.white); dispScale.setMinorTickPaint(Color.lightGray); dispScale.setFirstTickLabelVisible(true); dispScale.setTickRadius(0.88); dispScale.setTickLabelOffset(0.15); NumberFormat formatter = new DecimalFormat("#"); dispScale.setTickLabelFormatter(formatter); dispScale.setTickLabelFont(new Font("Arial", Font.BOLD, 22)); dispScale.setTickLabelPaint(Color.white); plot.addScale(1, dispScale); plot.setBackground(new DialBackground(Color.black)); Pointer needle = new Pointer(0); needle.setFillPaint(Color.red); needle.setRadius(0.8); plot.addLayer(needle); plot.mapDatasetToScale(1, 1); DialCap cap = new DialCap(); cap.setRadius(0.05); cap.setFillPaint(Color.gray); plot.setCap(cap); jChart = new JFreeChart(plot); //jChart.setBackgroundImage(background); super.setChart(jChart); super.setPreferredSize(new Dimension(400, 400)); }
From source file:org.codehaus.mojo.dashboard.report.plugin.chart.BarChartRenderer.java
public void createChart() { CategoryDataset categorydataset = (CategoryDataset) this.datasetStrategy.getDataset(); report = ChartFactory.createBarChart(this.datasetStrategy.getTitle(), this.datasetStrategy.getYAxisLabel(), this.datasetStrategy.getXAxisLabel(), categorydataset, PlotOrientation.HORIZONTAL, true, true, false);/* www . j a v a2s.c om*/ // report.setBackgroundPaint( Color.lightGray ); report.setPadding(new RectangleInsets(5.0d, 5.0d, 5.0d, 5.0d)); CategoryPlot categoryplot = (CategoryPlot) report.getPlot(); categoryplot.setBackgroundPaint(Color.white); categoryplot.setRangeGridlinePaint(Color.lightGray); categoryplot.setDomainGridlinePaint(Color.lightGray); categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); if (datasetStrategy instanceof CoberturaBarChartStrategy || datasetStrategy instanceof CloverBarChartStrategy || datasetStrategy instanceof MultiCloverBarChartStrategy) { numberaxis.setRange(0.0D, BarChartRenderer.NUMBER_AXIS_RANGE); numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance()); } else { numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } numberaxis.setLowerMargin(0.0D); CategoryAxis axis = categoryplot.getDomainAxis(); axis.setLowerMargin(0.02); // two percent axis.setCategoryMargin(0.10); // ten percent axis.setUpperMargin(0.02); // two percent BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setItemMargin(0.10); barrenderer.setDrawBarOutline(false); barrenderer.setBaseItemLabelsVisible(true); if (datasetStrategy instanceof CoberturaBarChartStrategy || datasetStrategy instanceof CloverBarChartStrategy || datasetStrategy instanceof MultiCloverBarChartStrategy) { barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getPercentInstance(Locale.getDefault()))); } else { barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); } int height = (categorydataset.getColumnCount() * ChartUtils.STANDARD_BARCHART_ENTRY_HEIGHT * categorydataset.getRowCount()); if (height > ChartUtils.MINIMUM_HEIGHT) { super.setHeight(height); } else { super.setHeight(ChartUtils.MINIMUM_HEIGHT); } Paint[] paints = this.datasetStrategy.getPaintColor(); for (int i = 0; i < categorydataset.getRowCount() && i < paints.length; i++) { barrenderer.setSeriesPaint(i, paints[i]); } }
From source file:com.MainChart.java
public MainChart(String applicationTitle, String chartTitle) throws IOException { super(applicationTitle); this.multiHashtable = new Hashtable<>(); // This will create the dataset // PieDataset dataset = createDataset(); // based on the dataset we create the chart final JFreeChart chart = ChartFactory.createBarChart("GPA Analysis By Country", // chart title "Country", // domain axis label "GPA", // range axis label createDataset(), // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? );/*from w w w. j a v a2 s . com*/ chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setBackgroundPaint(SystemColor.inactiveCaption);//change background color //set bar chart color //CategoryItemRenderer renderer = new CustomRenderer(); //plot.setRenderer(renderer); // we put the chart into a panel ChartPanel chartPanel = new ChartPanel(chart); // default size chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); // add it to our application setContentPane(chartPanel); }