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

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

Introduction

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

Prototype

public void setForegroundAlpha(float alpha) 

Source Link

Document

Sets the alpha-transparency for the plot and sends a PlotChangeEvent to all registered listeners.

Usage

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

private static JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    JFreeChart jfreechart = ChartFactory.createHistogram("Histogram Demo 1", null, null, intervalxydataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setForegroundAlpha(0.85F);
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setDrawBarOutline(false);
    return jfreechart;
}

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

private static JFreeChart createChart(XYZDataset xyzdataset) {
    JFreeChart jfreechart = ChartFactory.createBubbleChart("Bubble Chart Demo 1", "X", "Y", xyzdataset,
            PlotOrientation.HORIZONTAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setForegroundAlpha(0.65F);
    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    xyitemrenderer.setSeriesPaint(0, Color.blue);
    NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
    numberaxis.setLowerMargin(0.14999999999999999D);
    numberaxis.setUpperMargin(0.14999999999999999D);
    NumberAxis numberaxis1 = (NumberAxis) xyplot.getRangeAxis();
    numberaxis1.setLowerMargin(0.14999999999999999D);
    numberaxis1.setUpperMargin(0.14999999999999999D);
    return jfreechart;
}

From source file:cv.mikusher.freechart.BubbleChart.java

private static JFreeChart createChart(XYZDataset xyzdataset) {
    JFreeChart jfreechart = ChartFactory.createBubbleChart("AGE vs WEIGHT vs WORK", "Weight", "AGE", xyzdataset,
            PlotOrientation.HORIZONTAL, true, true, false);

    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setForegroundAlpha(0.65F);
    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    xyitemrenderer.setSeriesPaint(0, Color.blue);
    NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
    numberaxis.setLowerMargin(0.2);/*from   w ww. ja  v  a2 s.c  om*/
    numberaxis.setUpperMargin(0.5);
    NumberAxis numberaxis1 = (NumberAxis) xyplot.getRangeAxis();
    numberaxis1.setLowerMargin(0.8);
    numberaxis1.setUpperMargin(0.9);

    return jfreechart;
}

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

private static JFreeChart createChart(XYZDataset xyzdataset) {
    JFreeChart jfreechart = ChartFactory.createBubbleChart("Bubble Chart Demo 2", "X", "Y", xyzdataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setRenderer(new XYBubbleRenderer(0));
    xyplot.setForegroundAlpha(0.65F);
    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    xyitemrenderer.setSeriesPaint(0, Color.blue);
    xyitemrenderer.setBaseItemLabelGenerator(new BubbleXYItemLabelGenerator());
    xyitemrenderer.setBaseToolTipGenerator(new StandardXYZToolTipGenerator());
    xyitemrenderer.setBaseItemLabelsVisible(true);
    xyitemrenderer/*from  w w w . j a  va  2s.  c  o  m*/
            .setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER));
    NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
    numberaxis.setRange(0.0D, 10D);
    NumberAxis numberaxis1 = (NumberAxis) xyplot.getRangeAxis();
    numberaxis1.setRange(0.0D, 10D);
    return jfreechart;
}

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

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createXYAreaChart("XYAreaRenderer2Demo1", "Domain (X)", "Range (Y)",
            xydataset, PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setRenderer(new XYAreaRenderer2());
    xyplot.setForegroundAlpha(0.65F);
    ValueAxis valueaxis = xyplot.getDomainAxis();
    valueaxis.setTickMarkPaint(Color.black);
    valueaxis.setLowerMargin(0.0D);/* ww w . j  a v a2  s .  com*/
    valueaxis.setUpperMargin(0.0D);
    ValueAxis valueaxis1 = xyplot.getRangeAxis();
    valueaxis1.setTickMarkPaint(Color.black);
    return jfreechart;
}

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

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createXYAreaChart("XY Area Chart Demo", "Domain (X)", "Range (Y)",
            xydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setForegroundAlpha(0.65F);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    ValueAxis valueaxis = xyplot.getDomainAxis();
    valueaxis.setTickMarkPaint(Color.black);
    valueaxis.setLowerMargin(0.0D);/*from w  ww.j  a va 2s . co  m*/
    valueaxis.setUpperMargin(0.0D);
    ValueAxis valueaxis1 = xyplot.getRangeAxis();
    valueaxis1.setTickMarkPaint(Color.black);
    XYPointerAnnotation xypointerannotation = new XYPointerAnnotation("Test", 5D, -500D, 2.3561944901923448D);
    xypointerannotation.setTipRadius(0.0D);
    xypointerannotation.setBaseRadius(35D);
    xypointerannotation.setFont(new Font("SansSerif", 0, 9));
    xypointerannotation.setPaint(Color.blue);
    xypointerannotation.setTextAnchor(TextAnchor.HALF_ASCENT_RIGHT);
    xyplot.addAnnotation(xypointerannotation);
    return jfreechart;
}

From source file:piilSource.Histogram.java

private static JFreeChart createChart(String s, IntervalXYDataset intervalxydataset, String metaLabel) {
    JFreeChart jfreechart = ChartFactory.createHistogram(
            "Histogram of the " + metaLabel + " values for all samples - " + s, null, null, intervalxydataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setForegroundAlpha(0.85F);
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setDrawBarOutline(false);
    return jfreechart;
}

From source file:org.jfree.chart.demo.selection.SelectionDemo4.java

/**
 * Creates a chart.//from w  w  w . jav a  2s  .  c om
 * 
 * @param dataset  a dataset.
 * 
 * @return The chart.
 */
private static JFreeChart createChart(IntervalXYDataset dataset, DatasetSelectionExtension<XYCursor> ext) {
    JFreeChart chart = ChartFactory.createHistogram("SelectionDemo4", null, null, dataset);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.setForegroundAlpha(0.85f);
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(true);
    renderer.setDefaultOutlinePaint(Color.red);
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setShadowVisible(false);

    //add selection specific rendering
    IRSUtilities.setSelectedItemPaint(renderer, ext, Color.white);

    //register plot as selection change listener
    ext.addChangeListener(plot);

    return chart;
}

From source file:org.jfree.expdemo.SelectionDemo4.java

/**
 * Creates a chart./*from www  . ja v  a  2 s .  co m*/
 * 
 * @param dataset
 *            a dataset.
 * 
 * @return The chart.
 */
private static JFreeChart createChart(IntervalXYDataset dataset, DatasetSelectionExtension ext) {
    JFreeChart chart = ChartFactory.createHistogram("SelectionDemo4", null, null, dataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.setForegroundAlpha(0.85f);
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(true);
    renderer.setBaseOutlinePaint(Color.red);
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setShadowVisible(false);

    //add selection specific rendering
    IRSUtilities.setSelectedItemPaint(renderer, ext, Color.white);

    //register plot as selection change listener
    ext.addSelectionChangeListener(plot);

    return chart;
}

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

private static JFreeChart createChart(XYZDataset xyzdataset) {
    NumberAxis numberaxis = new NumberAxis("X");
    numberaxis.setLowerMargin(0.0D);/*from  w w  w .  j  av  a 2s  .  com*/
    numberaxis.setUpperMargin(0.0D);
    NumberAxis numberaxis1 = new NumberAxis("Y");
    numberaxis1.setAutoRangeIncludesZero(false);
    numberaxis1.setInverted(true);
    numberaxis1.setLowerMargin(0.0D);
    numberaxis1.setUpperMargin(0.0D);
    numberaxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYBlockRenderer xyblockrenderer = new XYBlockRenderer();
    LookupPaintScale lookuppaintscale = new LookupPaintScale(0.5D, 3.5D, Color.black);
    lookuppaintscale.add(0.5D, Color.green);
    lookuppaintscale.add(1.5D, Color.orange);
    lookuppaintscale.add(2.5D, Color.red);
    xyblockrenderer.setPaintScale(lookuppaintscale);
    XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyblockrenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setForegroundAlpha(0.66F);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo3", xyplot);
    jfreechart.removeLegend();
    jfreechart.setBackgroundPaint(Color.white);
    SymbolAxis symbolaxis = new SymbolAxis(null, new String[] { "", "OK", "Uncertain", "Bad" });
    symbolaxis.setRange(0.5D, 3.5D);
    symbolaxis.setPlot(new PiePlot());
    symbolaxis.setGridBandsVisible(false);
    PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, symbolaxis);
    paintscalelegend.setAxisOffset(5D);
    paintscalelegend.setPosition(RectangleEdge.BOTTOM);
    paintscalelegend.setMargin(new RectangleInsets(5D, 5D, 5D, 5D));
    jfreechart.addSubtitle(paintscalelegend);
    return jfreechart;
}