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:ejemplo.Ejemplo.java
private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("Line Chart Demo 6", // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );//from w w w. j a v a 2 s .c om // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:TimeSeriesChartDemo1.java
/** * Creates a chart./*from w ww. ja v a 2s . c o 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); renderer.setDrawSeriesLineAsPath(true); } DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); return chart; }
From source file:ChartUsingJava.CombinedXYPlotDemo1.java
/** * Creates an overlaid chart./*from www .j a va2s . c om*/ * * @return The chart. */ private static JFreeChart createCombinedChart() { // create plot ... IntervalXYDataset data1 = createDataset1(); XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false); renderer1.setBaseToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00"))); renderer1.setSeriesStroke(0, new BasicStroke(4.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer1.setSeriesPaint(0, Color.blue); DateAxis domainAxis = new DateAxis("Year"); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.02); ValueAxis rangeAxis = new NumberAxis("$billion"); XYPlot plot1 = new XYPlot(data1, null, rangeAxis, renderer1); plot1.setBackgroundPaint(Color.lightGray); plot1.setDomainGridlinePaint(Color.white); plot1.setRangeGridlinePaint(Color.white); // add a second dataset and renderer... IntervalXYDataset data2 = createDataset2(); XYBarRenderer renderer2 = new XYBarRenderer() { public Paint getItemPaint(int series, int item) { XYDataset dataset = getPlot().getDataset(); if (dataset.getYValue(series, item) >= 0.0) { return Color.red; } else { return Color.green; } } }; renderer2.setSeriesPaint(0, Color.red); renderer2.setDrawBarOutline(false); renderer2.setBaseToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00"))); XYPlot plot2 = new XYPlot(data2, null, new NumberAxis("$billion"), renderer2); plot2.setBackgroundPaint(Color.lightGray); plot2.setDomainGridlinePaint(Color.white); plot2.setRangeGridlinePaint(Color.white); CombinedXYPlot cplot = new CombinedXYPlot(domainAxis, rangeAxis); cplot.add(plot1, 3); cplot.add(plot2, 2); cplot.setGap(8.0); cplot.setDomainGridlinePaint(Color.white); cplot.setDomainGridlinesVisible(true); // return a new chart containing the overlaid plot... JFreeChart chart = new JFreeChart("CombinedXYPlotDemo1", JFreeChart.DEFAULT_TITLE_FONT, cplot, false); chart.setBackgroundPaint(Color.white); LegendTitle legend = new LegendTitle(cplot); chart.addSubtitle(legend); return chart; }
From source file:org.azrul.langmera.LineChart.java
/** * Creates a chart./*from ww w .j a v a 2s . c o m*/ * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart(this.getTitle(), // chart title "Number of messages", // x axis label "Value of actions", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); for (int i = 0; i < dataset.getSeriesCount(); i++) { renderer.setSeriesStroke(i, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 10.0f, 6.0f }, 0.0f)); } return chart; }
From source file:loldmg.GUI.MainFrame.java
private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart newchart = ChartFactory.createXYLineChart("Auto Attack DPS", // chart title "Level", // x axis label "Damage", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );//w w w . j a v a 2 s.c o m // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... newchart.setBackgroundPaint(Color.GRAY); // get a reference to the plot for further customisation... final XYPlot plot = newchart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return newchart; }
From source file:subterranean.crimson.server.graphics.graphs.LineChart.java
private JFreeChart createChart(final XYDataset dataset) { final JFreeChart result = ChartFactory.createTimeSeriesChart("", "", "", dataset, false, false, false); XYPlot plot = result.getXYPlot();/*from w ww . j av a2 s .c om*/ plot.setDataset(1, new TimeSeriesCollection(s2)); plot.setBackgroundPaint(new Color(0x000000)); plot.setDomainGridlinesVisible(false); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinesVisible(false); plot.setRangeGridlinePaint(Color.lightGray); ValueAxis xaxis = plot.getDomainAxis(); xaxis.setAutoRange(true); xaxis.setFixedAutoRange(160000.0); // 160 seconds xaxis.setVerticalTickLabels(false); ValueAxis yaxis = plot.getRangeAxis(); yaxis.setAutoRange(true); yaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return result; }
From source file:it.alus.GPSreceiver.instruments.Speedometer.java
public Speedometer(int Vs0, int Vfe, int Vs, int Vno, int Vne, int endScaleKmh) { super(null);/*from ww w.j a v a2s .c om*/ currentGroundSpeedKmh = 0; if (!setArcs(Vs0, Vfe, Vs, Vno, Vne, endScaleKmh)) { this.Vx = 90; this.Vy = 100; this.Vs0 = 45; this.Vs = 55; this.Vfe = 86; this.Va = 135; this.Vno = 160; this.Vne = 180; this.endScale = 185; } groundSpeedDataset = new DefaultValueDataset(0); totalSpeedDataset = new DefaultValueDataset(0); DialPlot dialplot = new DialPlot(); dialplot.setDataset(0, groundSpeedDataset); dialplot.setDataset(1, totalSpeedDataset); StandardDialFrame dialFrame = new StandardDialFrame(); dialFrame.setBackgroundPaint(Color.lightGray); dialFrame.setForegroundPaint(Color.gray); DialBackground db = new DialBackground(Color.black); dialplot.setBackground(db); dialplot.setDialFrame(dialFrame); DialTextAnnotation dialtextannotation = new DialTextAnnotation("Km/h"); dialtextannotation.setFont(new Font("Arial", 1, 14)); dialtextannotation.setRadius(0.4D); dialtextannotation.setPaint(Color.lightGray); dialplot.addLayer(dialtextannotation); //DialValueIndicator dialvalueindicator = new DialValueIndicator(0); //dialplot.addLayer(dialvalueindicator); DialValueIndicator groundIndicator = new DialValueIndicator(0); groundIndicator.setFont(new Font("Dialog", 0, 10)); groundIndicator.setOutlinePaint(Color.green); groundIndicator.setRadius(0.3); groundIndicator.setAngle(-110D); dialplot.addLayer(groundIndicator); DialValueIndicator realIndicator = new DialValueIndicator(1); realIndicator.setFont(new Font("Dialog", 0, 10)); realIndicator.setOutlinePaint(Color.cyan); realIndicator.setRadius(0.3); realIndicator.setAngle(-70); dialplot.addLayer(realIndicator); StandardDialScale scale = new StandardDialScale(0, endScale, 90, -350, 10, 5); scale.setFirstTickLabelVisible(true); scale.setTickRadius(0.9D); scale.setTickLabelOffset(0.14999999999999999D); NumberFormat formatter = new DecimalFormat("#"); scale.setTickLabelFormatter(formatter); scale.setTickLabelFont(new Font("Arial", Font.BOLD, 16)); scale.setMajorTickPaint(Color.white); scale.setMinorTickPaint(Color.lightGray); scale.setTickLabelPaint(Color.white); dialplot.addScale(0, scale); dialplot.addPointer(new org.jfree.chart.plot.dial.DialPointer.Pin()); DialCap dialcap = new DialCap(); dialcap.setRadius(0.10); dialcap.setFillPaint(Color.lightGray); dialplot.setCap(dialcap); jChart = new JFreeChart(dialplot); StandardDialRange standarddialrange = new StandardDialRange(this.Vne, endScale, Color.red); standarddialrange.setInnerRadius(0.54D); standarddialrange.setOuterRadius(0.56D); dialplot.addLayer(standarddialrange); StandardDialRange standarddialrange1 = new StandardDialRange(this.Vno, this.Vne, Color.yellow); standarddialrange1.setInnerRadius(0.54D); standarddialrange1.setOuterRadius(0.56D); dialplot.addLayer(standarddialrange1); StandardDialRange standarddialrange2 = new StandardDialRange(this.Vs, this.Vno, Color.green); standarddialrange2.setInnerRadius(0.54D); standarddialrange2.setOuterRadius(0.56D); dialplot.addLayer(standarddialrange2); StandardDialRange standarddialrange3 = new StandardDialRange(this.Vs0, this.Vfe, Color.white); standarddialrange3.setInnerRadius(0.50D); standarddialrange3.setOuterRadius(0.52D); dialplot.addLayer(standarddialrange3); //dialplot.removePointer(0); Pointer realPointer = new Pointer(1); realPointer.setFillPaint(Color.cyan); dialplot.addPointer(realPointer); Pointer groundPointer = new Pointer(0); groundPointer.setFillPaint(Color.green); dialplot.addPointer(groundPointer); /* PER NASCONDERE GLI INDICATORI groundIndicator.setVisible(false); realIndicator.setVisible(false); groundPointer.setVisible(false); realPointer.setVisible(false); */ super.setChart(jChart); super.setPreferredSize(new Dimension(400, 400)); }
From source file:org.csml.tommo.sugar.heatmap.MeanQualityMatrixChart.java
private static MeanQualityMatrixChart createChart(MeanQualityMatrixDataset dataset, NumberAxis xAxis, NumberAxis yAxis, PaintScale paintScale) { XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setPaintScale(paintScale);/*ww w .ja v a2 s. co m*/ XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinePaint(Color.white); MeanQualityMatrixChart chart = new MeanQualityMatrixChart(plot); chart.setBackgroundPaint(Color.white); chart.removeLegend(); return chart; }
From source file:ws.moor.bt.gui.charts.RemotePeerCompletion.java
private JFreeChart createChart(HistogramDataset dataset) { JFreeChart chart = ChartFactory.createHistogram("Remote Peer Completion", "Completion %", "Peers", dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot();//from www . j ava 2 s .c o m 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.setRangeCrosshairVisible(true); plot.getDomainAxis().setAutoRange(false); plot.getDomainAxis().setRange(0.0, 100.0); return chart; }
From source file:org.jfree.chart.demo.SecondaryDatasetDemo2.java
/** * Constructs a new demonstration application. * * @param title the frame title./*from w ww .j a v a 2 s. c o m*/ */ public SecondaryDatasetDemo2(final String title) { super(title); final CategoryDataset dataset1 = createRandomDataset("Series 1"); final JFreeChart chart = ChartFactory.createLineChart("Secondary Dataset Demo 2", "Category", "Value", dataset1, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.white); this.plot = chart.getCategoryPlot(); this.plot.setBackgroundPaint(Color.lightGray); this.plot.setDomainGridlinePaint(Color.white); this.plot.setRangeGridlinePaint(Color.white); // this.plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 4, 4, 4, 4)); final NumberAxis rangeAxis = (NumberAxis) this.plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); final JPanel content = new JPanel(new BorderLayout()); final ChartPanel chartPanel = new ChartPanel(chart); content.add(chartPanel); final JButton button1 = new JButton("Add Dataset"); button1.setActionCommand("ADD_DATASET"); button1.addActionListener(this); final JButton button2 = new JButton("Remove Dataset"); button2.setActionCommand("REMOVE_DATASET"); button2.addActionListener(this); final JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(button1); buttonPanel.add(button2); content.add(buttonPanel, BorderLayout.SOUTH); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(content); }