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.charts.IntradayChart.java
public IntradayChart(YStockQuote currentStock) { TimeSeries series = new TimeSeries(currentStock.get_name()); ArrayList<String> fiveDayData = currentStock.get_one_day_data(); int length = fiveDayData.size(); for (int i = 17; i < length; i++) { String[] data = fiveDayData.get(i).split(","); Date time = new Date((long) Integer.parseInt(data[0]) * 1000); DateFormat df = new SimpleDateFormat("MM-dd-yyyy-h-m"); series.addOrUpdate(new Minute(time), Double.parseDouble(data[1])); }/*from w w w .j a v a 2 s . c o m*/ TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createTimeSeriesChart( currentStock.get_name() + "(" + currentStock.get_symbol() + ")" + " Intraday", "Date", "Price", dataset, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); ValueAxis yAxis = (ValueAxis) plot.getRangeAxis(); DateAxis xAxis = (DateAxis) plot.getDomainAxis(); xAxis.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline()); xAxis.setDateFormatOverride(new SimpleDateFormat("h:m a")); xAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); //xAxis.setVerticalTickLabels(true); chartPanel = new ChartPanel(chart); chart.setBackgroundPaint(chartPanel.getBackground()); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); chartPanel.setVisible(true); chartPanel.revalidate(); chartPanel.repaint(); }
From source file:it.alus.GPSreceiver.instruments.Altimeter.java
public Altimeter(float groundAltitudeFt) { super(null);/*from w w w. j a va2s . c om*/ altitude = 0; if (groundAltitudeFt < 0) groundAltitude = 0; else groundAltitude = groundAltitudeFt; hoursDataset = new DefaultValueDataset(0.0); minutesDataset = new DefaultValueDataset(0.0); DialPlot plot = new DialPlot(); plot.setView(0.0, 0.0, 1.0, 1.0); Image background = Toolkit.getDefaultToolkit().getImage(getClass().getResource("altimeter.png")); plot.setDataset(0, hoursDataset); plot.setDataset(1, minutesDataset); StandardDialFrame dialFrame = new StandardDialFrame(); dialFrame.setBackgroundPaint(Color.lightGray); dialFrame.setForegroundPaint(Color.gray); DialTextAnnotation annotation = new DialTextAnnotation("Feet"); annotation.setFont(new Font("Arial", 1, 14)); annotation.setRadius(0.4D); annotation.setPaint(Color.lightGray); plot.addLayer(annotation); DialValueIndicator valueindicator = new DialValueIndicator(0); NumberFormat formatter = new DecimalFormat("#"); plot.addLayer(valueindicator); plot.setDialFrame(dialFrame); StandardDialScale scale = new StandardDialScale(0, 10, 90, -360, 1, 10); scale.setMajorTickPaint(Color.white); scale.setMinorTickPaint(Color.lightGray); scale.setFirstTickLabelVisible(false); scale.setTickRadius(0.88); scale.setTickLabelOffset(0.15); scale.setTickLabelFormatter(formatter); scale.setTickLabelFont(new Font("Arial", Font.BOLD, 24)); scale.setTickLabelPaint(Color.white); plot.addScale(3, scale); plot.setBackground(new DialBackground(Color.black)); StandardDialScale hourScale = new StandardDialScale(0, 10000, 90, -360, 1000, 10); hourScale.setVisible(false); hourScale.setTickRadius(0.88); hourScale.setTickLabelOffset(0.15); plot.addScale(0, hourScale); StandardDialScale minScale = new StandardDialScale(0, 1000, 90, -360, 0, 0); minScale.setVisible(false); minScale.setMajorTickIncrement(5.0); minScale.setTickRadius(0.68); plot.addScale(1, minScale); Pointer hourNeedle = new Pointer(0); hourNeedle.setRadius(0.55); hourNeedle.setFillPaint(Color.lightGray); plot.addLayer(hourNeedle); plot.mapDatasetToScale(1, 1); Pointer minNeedle = new Pointer(1); minNeedle.setFillPaint(Color.white); plot.addLayer(minNeedle); DialCap cap = new DialCap(); cap.setRadius(0.10); cap.setFillPaint(Color.lightGray); plot.setCap(cap); jChart = new JFreeChart(plot); jChart.setBackgroundImage(background); super.setChart(jChart); super.setPreferredSize(new Dimension(400, 400)); }
From source file:ch.unibe.iam.scg.archie.ui.charts.ConsultationMoneyChart.java
/** * @see ch.unibe.iam.scg.archie.ui.charts.AbstractChartComposite# * initializeChart()//from w w w . jav a2 s . c om */ @Override protected JFreeChart initializeChart() { JFreeChart chart = ChartFactory.createTimeSeriesChart(ConsultationMoneyChart.CHART_TITLE, // title "", // x-axis label "Amount", // y-axis label (XYDataset) this.creator.getDataset(), // data true, // create legend? true, // generate tooltips? false // generate URLs? ); // Set chart background color to it's parents background chart.setBackgroundPaint(new Color(this.parent.getBackground().getRed(), this.parent.getBackground().getGreen(), this.parent.getBackground().getBlue())); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); 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:scheduler.benchmarker.manager.CreateCombinedSplineChart.java
public ChartPanel createChartPanel() { XYDataset dataset = createDataset(); NumberAxis numberaxis = new NumberAxis("EMAILS"); numberaxis.setAutoRangeIncludesZero(true); numberaxis.setRange(0, dataset.getItemCount(1)); numberaxis.setVisible(false);//from w w w . j a v a 2s. co m NumberAxis numberaxis1 = new NumberAxis("TIME CONSUMED"); numberaxis.setAutoRangeIncludesZero(false); XYSplineRenderer xysplinerenderer = new XYSplineRenderer(); XYPlot xyplot = new XYPlot(dataset, numberaxis, numberaxis1, xysplinerenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setFixedLegendItems(null); JFreeChart jfreechart = new JFreeChart( "PLAN VALUES FOR '" + sName[0] + "' AND '" + sName[1] + "' SCHEDULERS", new Font(Font.SANS_SERIF, Font.PLAIN, 11), xyplot, true); chartPanel = new ChartPanel(jfreechart, true); //Creating listener chartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent e) { ChartEntity entity = e.getEntity(); if (entity != null && (entity instanceof XYItemEntity)) { XYItemEntity item = (XYItemEntity) entity; String chartTitle = "COMPARISON OF '" + sName[0] + "' AND '" + sName[1] + "' BEHAVIOUR FOR EMAIL '" + dataSource.get(0).getPlanningResult().get(item.getItem()).getEmailName() + "'"; createSubChart(new CreateCombinedCategoryPlot( new PlanningResult[] { dataSource.get(0).getPlanningResult().get(item.getItem()), dataSource.get(1).getPlanningResult().get(item.getItem()) }, pluginColor, chartTitle, new String[] { dataSource.get(0).getSchedulerUsed(), dataSource.get(1).getSchedulerUsed() }).createChartPanel()); } } @Override public void chartMouseMoved(ChartMouseEvent e) { //DO NOTHING } }); return chartPanel; }
From source file:com.wsntools.iris.tools.Graph.java
private void setupChartType(JFreeChart chart) { chart.setBackgroundPaint(Color.white); // plot = chart.getCategoryPlot(); plot = chart.getXYPlot();// ww w . j ava 2 s . c o m plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 4, 4, 4, 4)); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setAutoRange(true); domainAxis.setAutoRangeIncludesZero(false); rangeAxis.setAutoRange(true); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); chartPanel.setChart(chart); }
From source file:org.codehaus.mojo.dashboard.report.plugin.chart.StackedBarChartRenderer.java
/** * //from ww w .j a v a2 s .co m */ public void createChart() { CategoryDataset categorydataset = (CategoryDataset) this.datasetStrategy.getDataset(); report = ChartFactory.createStackedBarChart(this.datasetStrategy.getTitle(), this.datasetStrategy.getYAxisLabel(), this.datasetStrategy.getXAxisLabel(), categorydataset, PlotOrientation.HORIZONTAL, true, true, false); // report.setBackgroundPaint( Color.lightGray ); report.setAntiAlias(false); 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); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); if (datasetStrategy instanceof CloverBarChartStrategy || datasetStrategy instanceof MultiCloverBarChartStrategy) { numberaxis.setRange(0.0D, StackedBarChartRenderer.NUMBER_AXIS_RANGE); numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance()); } else { numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } numberaxis.setLowerMargin(0.0D); StackedBarRenderer stackedbarrenderer = (StackedBarRenderer) categoryplot.getRenderer(); stackedbarrenderer.setDrawBarOutline(false); stackedbarrenderer.setBaseItemLabelsVisible(true); stackedbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); stackedbarrenderer.setBaseItemLabelFont(StackedBarRenderer.DEFAULT_VALUE_LABEL_FONT.deriveFont(Font.BOLD)); int height = (categorydataset.getColumnCount() * ChartUtils.STANDARD_BARCHART_ENTRY_HEIGHT * 2) + ChartUtils.STANDARD_BARCHART_ADDITIONAL_HEIGHT + 10; 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++) { stackedbarrenderer.setSeriesPaint(i, paints[i]); } }
From source file:pfg.graphic.Chart.java
/** * L'initialisation se fait part afin de ne pas ouvrir une fentre ds qu'on cre un objet *///from w ww . j ava2 s . c om private void init() { init = true; JFreeChart chart = ChartFactory.createTimeSeriesChart(title, // title xAxisLabel, // x-axis label yAxisLabel, // 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); } ChartPanel panel = new ChartPanel(chart); panel.setFillZoomRectangle(true); panel.setMouseWheelEnabled(true); panel.setPreferredSize(new java.awt.Dimension(1024, 600)); setContentPane(panel); pack(); RefineryUtilities.centerFrameOnScreen(this); setVisible(true); }
From source file:org.openmrs.module.laboratorymanagement.web.chart.EvolutionOfClientRegisteredPerDay.java
/** * @see org.openmrs.module.vcttrac.web.view.chart.AbstractChartView#createChart(java.util.Map, * javax.servlet.http.HttpServletRequest) *//*from w ww .ja v a 2 s .c o m*/ @Override protected JFreeChart createChart(Map<String, Object> model, HttpServletRequest request, String patientIdstr, String locationIdstr, int conceptId, Date startDate, Date endDate) { String categoryAxisLabel = " Year"; String valueAxisLabel = "Number of Lab tests"; String title = "EVolution of labotory test:" + Context.getConceptService().getConcept(conceptId).getDisplayString(); JFreeChart chart = ChartFactory.createLineChart(title, categoryAxisLabel, valueAxisLabel, createDataset(patientIdstr, locationIdstr, conceptId, startDate, endDate), // data PlotOrientation.VERTICAL, true, false, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setUpperMargin(0.15); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // customise the renderer... LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setItemLabelsVisible(true); return chart; }
From source file:org.codehaus.mojo.dashboard.report.plugin.chart.time.TimeChartRenderer.java
public void createChart() { XYDataset dataset = (XYDataset) this.datasetStrategy.getDataset(); report = ChartFactory.createTimeSeriesChart(this.datasetStrategy.getTitle(), // title this.datasetStrategy.getXAxisLabel(), // x-axis label this.datasetStrategy.getYAxisLabel(), // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? );/*from w w w .ja v a2 s . c o m*/ // report.setBackgroundPaint( Color.lightGray ); XYPlot plot = report.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); XYItemRenderer xyitemrenderer = plot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyitemrenderer; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setBaseShapesVisible(true); renderer.setDrawOutlines(true); renderer.setBaseItemLabelGenerator( ((AbstractTimeChartStrategy) this.datasetStrategy).getLabelGenerator()); renderer.setBaseItemLabelFont(new Font("SansSerif", Font.BOLD, 10)); renderer.setBaseItemLabelsVisible(true); renderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE10, TextAnchor.BASELINE_RIGHT)); } Paint[] paints = this.datasetStrategy.getPaintColor(); for (int i = 0; i < dataset.getSeriesCount() && i < paints.length; i++) { xyitemrenderer.setSeriesPaint(i, paints[i]); xyitemrenderer.setSeriesStroke(i, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); } plot.setRangeAxis(((AbstractTimeChartStrategy) this.datasetStrategy).getRangeAxis()); DashDateAxis axisDate = new DashDateAxis(); axisDate.setDateFormatOverride( ((AbstractTimeChartStrategy) this.datasetStrategy).getTimePeriod().getDateFormat()); axisDate.setLabel(this.datasetStrategy.getXAxisLabel()); axisDate.setTickUnit(getTickUnit(((AbstractTimeChartStrategy) this.datasetStrategy).getTimePeriod())); axisDate.setUpperMargin(0.0D); axisDate.setDateTickLabelAngle(-0.6); if (((AbstractTimeChartStrategy) this.datasetStrategy).getStartDate() != null && ((AbstractTimeChartStrategy) this.datasetStrategy).getEndDate() != null) { axisDate.setRangeWithMargins( new DateRange(((AbstractTimeChartStrategy) this.datasetStrategy).getStartDate(), ((AbstractTimeChartStrategy) this.datasetStrategy).getEndDate())); } plot.setDomainAxis(axisDate); Date[] dates = DateUtils.getAllDates(((AbstractTimeChartStrategy) this.datasetStrategy).getStartDate(), ((AbstractTimeChartStrategy) this.datasetStrategy).getEndDate(), ((AbstractTimeChartStrategy) this.datasetStrategy).getTimePeriod()); int width = (dates.length * ChartUtils.STANDARD_TIME_ENTRY_WIDTH) + ChartUtils.STANDARD_TIME_ADDITIONAL_WIDTH; if (width > ChartUtils.MINIMUM_WIDTH) { this.setWidth(width); } else { this.setWidth(ChartUtils.MINIMUM_WIDTH); } }
From source file:cn.edu.thss.iise.bpmdemo.charts.ThermometerDemo2.java
/** * Creates a new demo.//from w ww.j a va 2s.c o m * * @param title * the frame title. */ public ThermometerDemo2(final String title) { super(title); plot = new ThermometerPlot(dataset); chart = new JFreeChart("Thermometer Demo 2", // chart title JFreeChart.DEFAULT_TITLE_FONT, plot, // plot false); plot.setThermometerStroke(new BasicStroke(2.0f)); plot.setThermometerPaint(Color.lightGray); // OPTIONAL CUSTOMISATION COMPLETED. // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); setContentPane(chartPanel); }