Example usage for org.jfree.chart.plot XYPlot setOutlinePaint

List of usage examples for org.jfree.chart.plot XYPlot setOutlinePaint

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot setOutlinePaint.

Prototype

public void setOutlinePaint(Paint paint) 

Source Link

Document

Sets the paint used to draw the outline of the plot area and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.demo.SparklineDemo1.java

public static void main(String args[]) {
    XYSeries xyseries = new XYSeries("Series 1");
    xyseries.add(1.0D, 1.0D);/*from www  .ja  v  a2 s  .  c  o  m*/
    xyseries.add(2D, 3D);
    xyseries.add(3D, 2D);
    xyseries.add(4D, 4D);
    XYSeriesCollection xyseriescollection = new XYSeriesCollection();
    xyseriescollection.addSeries(xyseries);
    JFreeChart jfreechart = ChartFactory.createXYLineChart(null, "X", "Y", xyseriescollection,
            PlotOrientation.VERTICAL, false, false, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setInsets(RectangleInsets.ZERO_INSETS);
    xyplot.setDomainGridlinesVisible(false);
    xyplot.setRangeGridlinesVisible(false);
    xyplot.setOutlinePaint(null);
    xyplot.getDomainAxis().setVisible(false);
    xyplot.getRangeAxis().setVisible(false);
    try {
        ChartUtilities.saveChartAsPNG(new File("Sparky.png"), jfreechart, 100, 20);
    } catch (IOException ioexception) {
        ioexception.printStackTrace();
    }
}

From source file:org.jfree.chart.demo.VectorPlotDemo1.java

private static JFreeChart createChart(VectorXYDataset dataset) {
    NumberAxis xAxis = new NumberAxis("X");
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.01D);//from   www  . j ava  2  s . com
    xAxis.setUpperMargin(0.01D);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis("Y");
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.01D);
    yAxis.setUpperMargin(0.01D);
    yAxis.setAutoRangeIncludesZero(false);
    //
    VectorRenderer renderer = new VectorRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    plot.setOutlinePaint(Color.black);
    JFreeChart chart = new JFreeChart("Vector Plot Demo 1", plot);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:org.jfree.chart.demo.VectorRendererDemo1.java

private static JFreeChart createChart(VectorXYDataset dataset) {
    NumberAxis xAxis = new NumberAxis("X");
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.01D);//from   w ww.  j  av a2s  .c om
    xAxis.setUpperMargin(0.01D);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis("Y");
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.01D);
    yAxis.setUpperMargin(0.01D);
    yAxis.setAutoRangeIncludesZero(false);
    //
    VectorRenderer renderer = new VectorRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    plot.setOutlinePaint(Color.black);
    JFreeChart chart = new JFreeChart("Vector Renderer Demo 1", plot);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:temp1.RealTimeChart.java

public static JFreeChart createChart(String chartContent, String title, String yaxisName) {
    thread1 = new Thread();
    timeseries1 = new TimeSeries(chartContent, Millisecond.class);
    timeseries2 = new TimeSeries(chartContent, Millisecond.class);
    timeseries3 = new TimeSeries(chartContent, Millisecond.class);
    timeseries4 = new TimeSeries(chartContent, Millisecond.class);

    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries1);
    TimeSeriesCollection timeseriescollection1 = new TimeSeriesCollection(timeseries2);
    TimeSeriesCollection timeseriescollection2 = new TimeSeriesCollection(timeseries3);
    TimeSeriesCollection timeseriescollection3 = new TimeSeriesCollection(timeseries4);

    jfreechart = ChartFactory.createTimeSeriesChart("", "", "", timeseriescollection, false, false, false);

    final XYPlot xyplot = jfreechart.getXYPlot();
    xyplot.setOutlinePaint(Color.magenta);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setRangeGridlinePaint(Color.gray);
    xyplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    ValueAxis valueaxis = xyplot.getDomainAxis();
    valueaxis.setAutoRange(true);//from   w w  w.ja va2s .c  o  m
    valueaxis.setFixedAutoRange(20000D);
    //Value
    valueaxis = xyplot.getRangeAxis();
    valueaxis.setRange(800D, 3300D);
    xyplot.setDataset(0, timeseriescollection);
    xyplot.setDataset(1, timeseriescollection1);
    xyplot.setDataset(2, timeseriescollection2);
    xyplot.setDataset(3, timeseriescollection3);
    XYLineAndShapeRenderer xylineandshaperenderer0 = new XYLineAndShapeRenderer();
    XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer();
    XYLineAndShapeRenderer xylineandshaperenderer2 = new XYLineAndShapeRenderer();
    XYLineAndShapeRenderer xylineandshaperenderer3 = new XYLineAndShapeRenderer();
    xylineandshaperenderer0.setBaseShapesVisible(false);
    xylineandshaperenderer1.setBaseShapesVisible(false);
    xylineandshaperenderer2.setBaseShapesVisible(false);
    xylineandshaperenderer3.setBaseShapesVisible(false);
    xylineandshaperenderer0.setSeriesPaint(0, Color.RED);
    xylineandshaperenderer1.setSeriesPaint(0, Color.cyan);
    xylineandshaperenderer2.setSeriesPaint(0, Color.yellow);
    xylineandshaperenderer3.setSeriesPaint(0, Color.blue);
    xyplot.setRenderer(0, xylineandshaperenderer0);
    xyplot.setRenderer(1, xylineandshaperenderer1);
    xyplot.setRenderer(2, xylineandshaperenderer2);
    xyplot.setRenderer(3, xylineandshaperenderer3);
    //xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(0.5F, 1, 1, 5F, new float[] { 5F, 10F }, 0.0F));
    return jfreechart;
}

From source file:com.compomics.pepshell.view.statistics.JFreeChartPanel.java

private static void setupPlot(XYPlot xYPlot) {
    // set background to white and grid color to black
    xYPlot.setBackgroundPaint(Color.white);
    xYPlot.setRangeGridlinePaint(Color.black);
    // hide the border of the sorrounding box
    xYPlot.setOutlinePaint(Color.white);
    // get domanin and range axes
    ValueAxis domainAxis = xYPlot.getDomainAxis();
    ValueAxis rangeAxis = xYPlot.getRangeAxis();
    // set label paint for axes to black
    domainAxis.setLabelPaint(Color.black);
    rangeAxis.setLabelPaint(Color.black);
    // set font for labels, both on domain and range axes
    domainAxis.setLabelFont(new Font("Tahoma", Font.BOLD, 12));
    rangeAxis.setLabelFont(new Font("Tahoma", Font.BOLD, 12));
}

From source file:org.jfree.chart.demo.XYBlockChartDemo1.java

private static JFreeChart createChart(XYZDataset xyzdataset) {
    NumberAxis numberaxis = new NumberAxis("X");
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis.setLowerMargin(0.0D);/*from  ww w  . jav  a  2s.co m*/
    numberaxis.setUpperMargin(0.0D);
    numberaxis.setAxisLinePaint(Color.white);
    numberaxis.setTickMarkPaint(Color.white);
    NumberAxis numberaxis1 = new NumberAxis("Y");
    numberaxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis1.setLowerMargin(0.0D);
    numberaxis1.setUpperMargin(0.0D);
    numberaxis1.setAxisLinePaint(Color.white);
    numberaxis1.setTickMarkPaint(Color.white);
    XYBlockRenderer xyblockrenderer = new XYBlockRenderer();
    GrayPaintScale graypaintscale = new GrayPaintScale(-2D, 1.0D);
    xyblockrenderer.setPaintScale(graypaintscale);
    XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyblockrenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinesVisible(false);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setOutlinePaint(Color.blue);
    JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo1", xyplot);
    jfreechart.removeLegend();
    NumberAxis numberaxis2 = new NumberAxis("Scale");
    numberaxis2.setAxisLinePaint(Color.white);
    numberaxis2.setTickMarkPaint(Color.white);
    numberaxis2.setTickLabelFont(new Font("Dialog", 0, 7));
    PaintScaleLegend paintscalelegend = new PaintScaleLegend(new GrayPaintScale(), numberaxis2);
    paintscalelegend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    paintscalelegend.setAxisOffset(5D);
    paintscalelegend.setMargin(new RectangleInsets(5D, 5D, 5D, 5D));
    paintscalelegend.setFrame(new BlockBorder(Color.red));
    paintscalelegend.setPadding(new RectangleInsets(10D, 10D, 10D, 10D));
    paintscalelegend.setStripWidth(10D);
    paintscalelegend.setPosition(RectangleEdge.RIGHT);
    paintscalelegend.setBackgroundPaint(new Color(120, 120, 180));
    jfreechart.addSubtitle(paintscalelegend);
    jfreechart.setBackgroundPaint(new Color(180, 180, 250));
    return jfreechart;
}

From source file:tools.descartes.bungee.chart.ChartGenerator.java

private static void customizePlot(final XYPlot plot) {
    plot.setOutlinePaint(null);
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    //plot.setShadowGenerator(new DefaultShadowGenerator());
    Font font = new Font("Dialog", Font.PLAIN, 20);
    Font labelFont = new Font("Dialog", Font.PLAIN, 16);
    plot.getDomainAxis().setLabelFont(labelFont);
    plot.getRangeAxis().setLabelFont(labelFont);
    plot.getDomainAxis().setTickLabelFont(font);
    plot.getRangeAxis().setTickLabelFont(font);
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JFreeChart createHistogramChart(String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset) {
    JFreeChart jfreechart = ChartFactory.createHistogram(null, xAxisLabel, yAxisLabel, dataset,
            PlotOrientation.VERTICAL, false, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(null);/*ww  w.  java2s .  co  m*/
    xyplot.setOutlinePaint(null);
    xyplot.setRangeGridlinePaint(UIConstants.INTEL_DARK_GRAY);
    NumberAxis yAxis = (NumberAxis) xyplot.getRangeAxis();
    yAxis.setRangeType(RangeType.POSITIVE);
    yAxis.setLabelFont(UIConstants.H5_FONT);
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xyplot.getDomainAxis().setLabelFont(UIConstants.H5_FONT);
    xyplot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYBarRenderer renderer = (XYBarRenderer) xyplot.getRenderer();
    renderer.setShadowVisible(false);
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelFont(UIConstants.H5_FONT);
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setSeriesPaint(0, UIConstants.INTEL_BLUE);
    return jfreechart;
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JFreeChart createPlainHistoryChart(IntervalXYDataset dataset,
        XYItemLabelGenerator labelGenerator) {
    if (dataset == null) {
        throw new IllegalArgumentException("No dataset.");
    }// www.j  a v  a2 s  .c  om

    JFreeChart jfreechart = ChartFactory.createXYBarChart(null, null, true, null, dataset,
            PlotOrientation.VERTICAL, false, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(null);
    xyplot.setOutlinePaint(null);
    XYBarRenderer renderer = (XYBarRenderer) xyplot.getRenderer();
    renderer.setShadowVisible(false);
    renderer.setBaseItemLabelsVisible(true);
    if (labelGenerator != null) {
        renderer.setBaseItemLabelGenerator(labelGenerator);
    }
    renderer.setBaseItemLabelFont(UIConstants.H4_FONT);
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setSeriesPaint(0, UIConstants.INTEL_BLUE);
    // xyplot.getDomainAxis().setVisible(false);
    xyplot.getDomainAxis().setAxisLineVisible(true);
    xyplot.getDomainAxis().setTickLabelsVisible(false);
    NumberAxis axis = (NumberAxis) xyplot.getRangeAxis();
    axis.setRangeType(RangeType.POSITIVE);
    axis.setVisible(false);
    return jfreechart;
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JFreeChart createXYBarChart(String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset,
        XYItemLabelGenerator labelGenerator) {
    if (dataset == null) {
        throw new IllegalArgumentException("No dataset.");
    }//  w w w . ja v a2s  .  c o m

    JFreeChart jfreechart = ChartFactory.createXYBarChart(null, xAxisLabel, false, yAxisLabel, dataset,
            PlotOrientation.VERTICAL, false, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(null);
    xyplot.setOutlinePaint(null);
    xyplot.setRangeGridlinePaint(UIConstants.INTEL_DARK_GRAY);

    NumberAxis axis = (NumberAxis) xyplot.getRangeAxis();
    axis.setRangeType(RangeType.POSITIVE);
    axis.setLabelFont(UIConstants.H5_FONT);
    xyplot.getDomainAxis().setLabelFont(UIConstants.H5_FONT);
    XYBarRenderer renderer = (XYBarRenderer) xyplot.getRenderer();
    renderer.setShadowVisible(false);
    renderer.setBaseItemLabelsVisible(true);
    if (labelGenerator != null) {
        renderer.setBaseItemLabelGenerator(labelGenerator);
    }
    renderer.setBaseItemLabelFont(UIConstants.H5_FONT);
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setSeriesPaint(0, UIConstants.INTEL_BLUE);
    return jfreechart;
}