Example usage for org.jfree.chart.renderer.xy StandardXYItemRenderer StandardXYItemRenderer

List of usage examples for org.jfree.chart.renderer.xy StandardXYItemRenderer StandardXYItemRenderer

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy StandardXYItemRenderer StandardXYItemRenderer.

Prototype

public StandardXYItemRenderer() 

Source Link

Document

Constructs a new renderer.

Usage

From source file:no.met.jtimeseries.chart.ErrorPlot.java

public static XYPlot getMarinogramErrorPlot() {
    XYItemRenderer renderer = new StandardXYItemRenderer();
    NumberAxis rangeAxis = new NumberAxis();
    XYPlot plot = new XYPlot(null, null, rangeAxis, renderer);
    XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 0.5, 0.5);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    plot.addAnnotation(annotation);/*from  w w  w.  j  a v  a  2 s .  c  o m*/
    return plot;
}

From source file:no.met.jtimeseries.chart.RendererFactory.java

public static XYItemRenderer createRenderer(String splineStyle) {
    // render the line with spline
    if (splineStyle.equalsIgnoreCase(SplineStyle.STANDARD)) {
        return new XYSplineRenderer();
    } else if (splineStyle.equalsIgnoreCase(SplineStyle.CARDINAL)) {
        return new XYCardinalSplineRenderer();
    } else {/*from   ww w  .j a  va2 s.c  om*/
        // render the line without spline
        StandardXYItemRenderer render = new StandardXYItemRenderer();
        render.setDrawSeriesLineAsPath(true);
        return render;
    }
}

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

private static JFreeChart createChart() {
    IntervalXYDataset dataset1 = createDataset1();
    XYBarRenderer renderer1 = new XYBarRenderer(0.20000000000000001D);
    renderer1.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0}: ({1}, {2})",
            new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
    DateAxis domainAxis = new DateAxis("Date");
    domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    NumberAxis valueAxis = new NumberAxis("Value");
    XYPlot plot = new XYPlot(dataset1, domainAxis, valueAxis, renderer1);
    XYDataset dataset2 = createDataset2();
    StandardXYItemRenderer renderer2 = new StandardXYItemRenderer();
    renderer2.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0}: ({1}, {2})",
            new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
    plot.setDataset(1, dataset2);/* w  w  w .  jav  a  2 s.c o m*/
    plot.setRenderer(1, renderer2);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    return new JFreeChart("Overlaid XYPlot Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
}

From source file:audio.cords.old.RegressionDemo.java

private static JFreeChart createChart(XYSeriesCollection data) {
    JFreeChart chart = ChartFactory.createScatterPlot(null, "X", "Y", data, PlotOrientation.VERTICAL, true,
            false, false);//from   ww  w.  j a  v  a 2  s. c  om
    XYPlot plot = (XYPlot) chart.getPlot();
    XYItemRenderer scatterRenderer = plot.getRenderer();
    StandardXYItemRenderer regressionRenderer = new StandardXYItemRenderer();
    regressionRenderer.setBaseSeriesVisibleInLegend(false);
    plot.setDataset(1, regress(data));
    plot.setRenderer(1, regressionRenderer);
    DrawingSupplier ds = plot.getDrawingSupplier();
    for (int i = 0; i < data.getSeriesCount(); i++) {
        Paint paint = ds.getNextPaint();
        scatterRenderer.setSeriesPaint(i, paint);
        regressionRenderer.setSeriesPaint(i, paint);
    }
    return chart;
}

From source file:grafix.graficos.eixos.EixoExtra.java

private void prepararPlotVazio(final XYPlot plot) {
    StandardXYItemRenderer indicesRenderer = new StandardXYItemRenderer();
    plot.setRenderer(0, indicesRenderer);
}

From source file:de.laures.cewolf.taglib.PlotTypes.java

/**
 * Create a renderer for the given type index.
 * We create a new renderer instance for each chart, because they may want to customize
 * it in a post-processor./*from  www.j  av a 2  s. c  om*/
 * 
 * @param idx The index of the type
 * @return A new renderer instance
 */
public static AbstractRenderer getRenderer(int idx) {
    switch (idx) {
    case 0:
        return new XYAreaRenderer();
    case 1:
        return new StandardXYItemRenderer();
    case 2:
        return new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES);
    case 3:
        return new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES);
    case 4:
        return new XYBarRenderer();
    case 5:
        return new XYStepRenderer();
    case 6:
        return new CandlestickRenderer();
    case 7:
        return new HighLowRenderer();
    //case 8: return new SignalRenderer();
    case 9:
        return new BarRenderer();
    case 10:
        return new AreaRenderer();
    case 11:
        return new LineAndShapeRenderer(true, false);
    case 12:
        return new LineAndShapeRenderer(true, true);
    default:
        throw new RuntimeException("Invalid renderer index:" + idx);
    }
}

From source file:sim.app.sugarscape.Charts.java

JFreeChart createTradeChart() {
    JFreeChart chart = ChartFactory.createXYLineChart("Trading and Population over Time", "Time", "Level",
            model.agents_series_coll, PlotOrientation.VERTICAL, true, true, false);
    model.trade_chart = chart;//from ww w  .  j a va2 s .c om
    NumberAxis rangeAxis1 = new NumberAxis("Time");
    rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    org.jfree.chart.axis.NumberAxis domainAxis = new NumberAxis("Bins");
    XYPlot plot = chart.getXYPlot();
    ValueAxis xAxis = plot.getDomainAxis();
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.BLUE);
    plot.setDataset(1, model.trade_coll);
    XYItemRenderer rend2 = new StandardXYItemRenderer();
    //if (rend2 != null)
    rend2.setSeriesPaint(1, Color.BLACK);
    plot.setRenderer(1, rend2);
    return chart;
}

From source file:com.ivli.roim.controls.ChartView.java

protected void initChart() {
    if (null != iPlot) {
        ((XYSeriesCollection) iPlot.getDataset()).removeAllSeries();
    } else {/*w  ww  .j a  v  a2 s . c o m*/
        iPlot = new XYPlot();
        iPlot.setRenderer(new StandardXYItemRenderer());
        iPlot.setDomainAxis(new NumberAxis(java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle")
                .getString("ROI_CHART.TIME_SERIES_VALUES")));
        iPlot.setRangeAxis(0, new NumberAxis(java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle")
                .getString("ROI_CHART.ROI_INTDEN_VALUES")));
        iPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
        iPlot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

        iJfc = new JFreeChart(
                java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle").getString("ROI_CHART.CHART_TITLE"),
                iPlot);

        iChart = new ChartControl(iJfc);

        iPlot.setDataset(new XYSeriesCollection());

        iChart.setPreferredSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
        iChart.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
        setLayout(new BorderLayout());

        this.add(iChart);
    }
    iChart.setMouseZoomable(false);
    iChart.setMouseWheelEnabled(true);
}

From source file:com.leonarduk.finance.analysis.CashFlowToChart.java

/**
 * Adds the cash flow axis to the plot./*from w w  w  . j  a va  2s  .co  m*/
 *
 * @param plot
 *            the plot
 * @param dataset
 *            the cash flow dataset
 */
private static void addCashFlowAxis(final XYPlot plot, final TimeSeriesCollection dataset) {
    final NumberAxis cashAxis = new NumberAxis("Cash Flow Ratio");
    cashAxis.setAutoRangeIncludesZero(false);
    plot.setRangeAxis(1, cashAxis);
    plot.setDataset(1, dataset);
    plot.mapDatasetToRangeAxis(1, 1);
    final StandardXYItemRenderer cashFlowRenderer = new StandardXYItemRenderer();
    cashFlowRenderer.setSeriesPaint(0, Color.blue);
    plot.setRenderer(1, cashFlowRenderer);
}

From source file:net.sf.mzmine.chartbasics.gui.javafx.demo.FXCombinedChartGestureDemo.java

private JFreeChart createCombinedChart() {
    // create subplot 1...
    final XYDataset data1 = createDataset();
    final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);

    // create subplot 2...
    final XYDataset data2 = createDataset();
    final XYItemRenderer renderer2 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);

    // parent plot...
    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    plot.setGap(10.0);//ww  w.j  a  v a2  s .  c om

    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);

    // return a new chart containing the overlaid plot...
    return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
}