List of usage examples for org.jfree.chart.plot XYPlot setOutlinePaint
public void setOutlinePaint(Paint paint)
From source file:figs.Chart.java
public void createChart() { final XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseLinesVisible(false); renderer.setBaseShapesVisible(true); plot.setRenderer(renderer);/*from ww w . j a v a 2 s . c om*/ chart.setBackgroundPaint(Color.white); plot.setOutlinePaint(Color.black); }
From source file:de.perdian.apps.dashboard.support.chart.ChartCreator.java
public JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYLineChart(this.getTitle(), null, null, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(null);/*from www. jav a 2s . c o m*/ chart.setBackgroundImageAlpha(0.0f); if (chart.getTitle() != null) { chart.getTitle().setFont(new Font(this.getFontName(), Font.BOLD, 14)); } XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(null); plot.setBackgroundAlpha(0.0f); plot.setOutlinePaint(this.getColor()); plot.getDomainAxis().setVisible(false); plot.getDomainAxis().setAxisLineVisible(false); plot.getDomainAxis().setMinorTickCount(10); plot.getDomainAxis().setTickMarksVisible(false); if (this.getDomainTickUnits() != null) { plot.getDomainAxis().setStandardTickUnits(this.getDomainTickUnits()); } plot.getRangeAxis().setVisible(true); plot.getRangeAxis().setAxisLineVisible(false); plot.getRangeAxis().setTickLabelFont(new Font(this.getFontName(), Font.PLAIN, 10)); plot.getRangeAxis().setTickLabelPaint(this.getColor()); plot.getRangeAxis().setTickMarksVisible(false); if (this.getRangeTickUnits() != null) { plot.getRangeAxis().setStandardTickUnits(this.getRangeTickUnits()); } plot.getRangeAxis().setAttributedLabel(this.getRangeAxisLabel()); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); for (int i = 0; i < this.getStrokeDefinitions().size(); i++) { ChartStrokeDefinition strokeDefinition = this.getStrokeDefinitions().get(i); strokeDefinition.applyTo(renderer, i); } return chart; }
From source file:diplomawork.model.JPEGSaver.java
public void saveChartToFile(JFreeChart chart, boolean trainFlag) { chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setVisible(false); plot.getRangeAxis().setVisible(false); plot.setBackgroundAlpha(0);/*from w w w . j a va 2 s.c o m*/ plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setOutlinePaint(null); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(false); renderer.setSeriesPaint(0, Color.BLACK); } plot.getRenderer().setSeriesStroke(0, new java.awt.BasicStroke(4f)); File f = null; if (trainFlag) { nameOfJPGFile = "src/resorce/TranePlot" + trainCount++ + ".jpg"; f = new File(nameOfJPGFile); } else { // f = new File("src/resorce/Plot" + n++ + ".jpg"); f = new File("src/resorce/Plot" + ".jpg"); } try { ChartUtilities.saveChartAsJPEG(f, chart, 80, 80); } catch (IOException ex) { Logger.getLogger(JPEGSaver.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JFreeChart createXYAreaSparkline(XYDataset dataset) { JFreeChart jfreechart = ChartFactory.createXYAreaChart(null, null, null, dataset, PlotOrientation.VERTICAL, false, false, false);/*w ww. java 2 s . c o m*/ XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setDomainPannable(true); xyplot.setBackgroundPaint(null); xyplot.setOutlinePaint(null); xyplot.setForegroundAlpha(0.8F); xyplot.setDomainGridlinesVisible(false); xyplot.setDomainCrosshairVisible(false); xyplot.setRangeGridlinesVisible(false); xyplot.setRangeCrosshairVisible(false); DateAxis dateaxis = new DateAxis(""); dateaxis.setTickLabelsVisible(false); dateaxis.setTickMarksVisible(false); dateaxis.setAxisLineVisible(false); dateaxis.setNegativeArrowVisible(false); dateaxis.setPositiveArrowVisible(false); dateaxis.setVisible(false); xyplot.setDomainAxis(dateaxis); ValueAxis rangeAxis = xyplot.getRangeAxis(); rangeAxis.setTickLabelsVisible(false); rangeAxis.setTickMarksVisible(false); rangeAxis.setAxisLineVisible(false); rangeAxis.setNegativeArrowVisible(false); rangeAxis.setPositiveArrowVisible(false); rangeAxis.setVisible(false); XYItemRenderer xyitemrenderer = xyplot.getRenderer(); xyitemrenderer.setSeriesPaint(1, UIConstants.INTEL_DARK_GRAY); xyitemrenderer.setSeriesPaint(0, NodeTypeViz.SWITCH.getColor()); return jfreechart; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JFreeChart createXYAreaChart(String xAxisLabel, String yAxisLabel, XYDataset dataset, boolean includeLegend) { JFreeChart jfreechart = ChartFactory.createXYAreaChart(null, xAxisLabel, yAxisLabel, dataset, PlotOrientation.VERTICAL, false, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setDomainPannable(true);//from w ww .j a v a 2 s . c o m xyplot.setBackgroundPaint(null); xyplot.setOutlinePaint(null); xyplot.setForegroundAlpha(0.8F); xyplot.setRangeGridlinePaint(UIConstants.INTEL_DARK_GRAY); DateAxis dateaxis = new DateAxis(xAxisLabel); dateaxis.setLowerMargin(0.0D); dateaxis.setUpperMargin(0.0D); xyplot.setDomainAxis(dateaxis); NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis(); rangeAxis.setRangeType(RangeType.POSITIVE); rangeAxis.setLabelFont(UIConstants.H5_FONT); rangeAxis.setLabelInsets(new RectangleInsets(0, 0, 0, 0)); if (includeLegend) { LegendTitle legendtitle = new LegendTitle(xyplot); legendtitle.setItemFont(UIConstants.H5_FONT); legendtitle.setBackgroundPaint(UIConstants.INTEL_WHITE); legendtitle.setFrame(new BlockBorder(UIConstants.INTEL_BLUE)); legendtitle.setPosition(RectangleEdge.BOTTOM); XYTitleAnnotation xytitleannotation = new XYTitleAnnotation(0.97999999999999998D, 0.99999999999999998D, legendtitle, RectangleAnchor.TOP_RIGHT); // xytitleannotation.setMaxWidth(0.47999999999999998D); xyplot.addAnnotation(xytitleannotation); } XYItemRenderer xyitemrenderer = xyplot.getRenderer(); xyitemrenderer.setSeriesPaint(1, UIConstants.INTEL_DARK_GRAY); xyitemrenderer.setSeriesPaint(0, NodeTypeViz.SWITCH.getColor()); xyitemrenderer.setBaseToolTipGenerator( new StandardXYToolTipGenerator("<html><b>{0}</b><br> Time: {1}<br> Data: {2}</html>", Util.getHHMMSS(), new DecimalFormat("#,##0.00"))); return jfreechart; }
From source file:utilities.GraphViewer.java
private ChartPanel graphe() { JFreeChart graph = ChartFactory.createXYLineChart("Sensors Energy", "Time", "Energy", dataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel cPanel = new ChartPanel(graph); cPanel.setBackground(Color.blue); cPanel.setPreferredSize(new Dimension(800, 600)); XYPlot plot = graph.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setOutlinePaint(Color.BLACK); plot.setRangeGridlinePaint(Color.BLACK); return cPanel; }
From source file:org.jfree.chart.demo.XYLogAxesDemo.java
/** * Creates a new demo.// w ww . j a v a 2 s .com * * @param title the frame title. */ public XYLogAxesDemo(final String title) { super(title); //Object[][][] data = new Object[3][50][2]; final XYSeries s1 = new XYSeries("Series 1"); final XYSeries s2 = new XYSeries("Series 2"); final XYSeries s3 = new XYSeries("Series 3"); // for (int i = 1; i <= 50; i++) { // s1.add(i, 1000 * Math.pow(i, -2)); // s2.add(i, 1000 * Math.pow(i, -3)); // s3.add(i, 1000 * Math.pow(i, -4)); // } for (int i = 1; i <= 50; i++) { s1.add(i, 10 * Math.exp(i / 5.0)); s2.add(i, 20 * Math.exp(i / 5.0)); s3.add(i, 30 * Math.exp(i / 5.0)); } final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(s1); dataset.addSeries(s2); dataset.addSeries(s3); final JFreeChart chart = ChartFactory.createXYLineChart("Log Axis Demo", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, false); final XYPlot plot = chart.getXYPlot(); final NumberAxis domainAxis = new NumberAxis("x"); final NumberAxis rangeAxis = new LogarithmicAxis("Log(y)"); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); chart.setBackgroundPaint(Color.white); plot.setOutlinePaint(Color.black); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:diplomawork.model.ViewForDiagram.java
/** * Creates a chart./*w ww . j a v a2s. c om*/ * * @param dataset a dataset. * * @return A chart. */ private JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart("EUR/USD", // 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); plot.setOutlinePaint(null); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); renderer.setSeriesPaint(0, Color.BLUE); } DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("dd HH:mm:ss")); return chart; }
From source file:visualizer.projection.distance.view.DistanceHistogram.java
private JFreeChart createChart(IntervalXYDataset intervalxydataset) { JFreeChart chart = ChartFactory.createHistogram("Distance Histogram", "Distances Values", "Occurences", intervalxydataset, PlotOrientation.VERTICAL, true, true, false); // JFreeChart chart = ChartFactory.createHistogram("Histograma das Distncias", // "Valores", "Ocorrncias", intervalxydataset, // PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.WHITE); XYPlot xyplot = (XYPlot) chart.getPlot(); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setAutoRangeIncludesZero(false); xyplot.setDomainGridlinePaint(Color.BLACK); xyplot.setRangeGridlinePaint(Color.BLACK); xyplot.setOutlinePaint(Color.BLACK); xyplot.setOutlineStroke(new BasicStroke(1.0f)); xyplot.setBackgroundPaint(Color.white); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer(); xybarrenderer.setDrawBarOutline(false); return chart; }
From source file:de.tsystems.mms.apm.performancesignature.PerfSigBuildActionResultsDisplay.java
private JFreeChart createXYLineChart(final StaplerRequest req, final XYDataset dataset) throws UnsupportedEncodingException { final String chartDashlet = req .getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamChartDashlet()); final String measure = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamMeasure()); final String unit = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamUnit()); String color = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamColor()); if (StringUtils.isBlank(color)) color = Messages.PerfSigBuildActionResultsDisplay_DefaultColor(); else/*from ww w .j a v a 2 s . c om*/ URLDecoder.decode(req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamColor()), "UTF-8"); final JFreeChart chart = ChartFactory.createXYLineChart( PerfSigUtils.generateTitle(measure, chartDashlet).replaceAll("\\d+\\w", ""), // title "%", // category axis label unit, // value axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // urls ); final XYPlot xyPlot = chart.getXYPlot(); xyPlot.setForegroundAlpha(0.8f); xyPlot.setRangeGridlinesVisible(true); xyPlot.setRangeGridlinePaint(Color.black); xyPlot.setOutlinePaint(null); final XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyPlot.getRenderer(); renderer.setSeriesPaint(0, Color.decode(color)); renderer.setSeriesStroke(0, new BasicStroke(2)); chart.setBackgroundPaint(Color.white); return chart; }