Example usage for org.jfree.chart.plot DefaultDrawingSupplier DEFAULT_OUTLINE_PAINT_SEQUENCE

List of usage examples for org.jfree.chart.plot DefaultDrawingSupplier DEFAULT_OUTLINE_PAINT_SEQUENCE

Introduction

In this page you can find the example usage for org.jfree.chart.plot DefaultDrawingSupplier DEFAULT_OUTLINE_PAINT_SEQUENCE.

Prototype

Paint[] DEFAULT_OUTLINE_PAINT_SEQUENCE

To view the source code for org.jfree.chart.plot DefaultDrawingSupplier DEFAULT_OUTLINE_PAINT_SEQUENCE.

Click Source Link

Document

The default outline paint sequence.

Usage

From source file:tarea1.histogram.java

private ChartPanel createChartPanel() {
    // dataset// w w w  . j  a  va  2s . co  m
    HistogramDataset dataset = new HistogramDataset();
    Raster raster = image.getRaster();
    final int w = image.getWidth();
    final int h = image.getHeight();
    double[] r = new double[w * h];
    r = raster.getSamples(0, 0, w, h, 0, r);
    dataset.addSeries("Red", r, BINS);
    r = raster.getSamples(0, 0, w, h, 1, r);
    dataset.addSeries("Green", r, BINS);
    r = raster.getSamples(0, 0, w, h, 2, r);
    dataset.addSeries("Blue", r, BINS);
    // chart
    JFreeChart chart = ChartFactory.createHistogram("Histogram", "Value", "Count", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarPainter(new StandardXYBarPainter());
    // translucent red, green & blue
    Paint[] paintArray = { new Color(0x80ff0000, true), new Color(0x8000ff00, true),
            new Color(0x800000ff, true) };
    plot.setDrawingSupplier(
            new DefaultDrawingSupplier(paintArray, DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);
    return panel;
}

From source file:com.pureinfo.srm.reports.impl.PieChartBuilder.java

/**
 * @throws PureException/*from  w  ww.  ja v  a 2 s  .  c o m*/
 * @see com.pureinfo.srm.reports.IChartBuilder#draw(java.util.List, int)
 */
public JFreeChart buildChart() {
    Iterator result = m_datas.iterator();
    DefaultPieDataset ds = getDataset(result);

    JFreeChart jfreechart = ChartFactory.createPieChart3D(null, ds, false, false, false);
    jfreechart.setBackgroundPaint(Color.WHITE);

    PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
    pieplot3d.setOutlinePaint(Color.GRAY);
    pieplot3d.setOutlineStroke(new BasicStroke(1));
    pieplot3d.setStartAngle(30D);
    pieplot3d.setDepthFactor(0.04);
    pieplot3d.setDrawingSupplier(new DefaultDrawingSupplier(MyPaintMgr.getPaints(),
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    pieplot3d.setCircular(false);
    pieplot3d.setDirection(Rotation.CLOCKWISE);
    pieplot3d.setOutlinePaint(Color.WHITE);
    pieplot3d.setInteriorGap(.15);
    Color color = new Color(0xaa, 0xaa, 0xaa, 255);
    pieplot3d.setBaseSectionOutlinePaint(color);
    pieplot3d.setBaseSectionOutlineStroke(new BasicStroke(0));
    pieplot3d.setForegroundAlpha(0.6f);
    pieplot3d.setLabelLinkStroke(new BasicStroke(1));
    pieplot3d.setLabelOutlinePaint(new Color(0x777777));
    pieplot3d.setLabelBackgroundPaint(new Color(0xf1f1f7));
    pieplot3d.setLabelLinkPaint(new Color(0xaa, 0xaa, 0xaa, 60));
    pieplot3d.setNoDataMessage("No data to display");
    pieplot3d.setLabelShadowPaint(new Color(0xdddddd));
    pieplot3d.setLabelFont(new Font("", Font.PLAIN, 10));
    if (m_nType == TYPE_PERCENT) {

        pieplot3d.setLabelGenerator(new StandardPieItemLabelGenerator("{0} = {2}",
                NumberFormat.getNumberInstance(), PERCENT_NUMBER_FORMAT));
    }

    fillChartInfo(ds);
    return jfreechart;
}

From source file:org.fhcrc.cpl.viewer.mrm.Utils.java

public static DrawingSupplier plainDrawingSupplier(Color c) {
    Paint black[] = new Paint[1];
    black[0] = c;/*from   w w w.java2  s. c  o m*/
    return new DefaultDrawingSupplier(black, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
}

From source file:org.xwiki.chart.internal.DrawingSupplierFactory.java

/**
 * @param parameters the user-defined parameters, containing {@link ChartGenerator#COLORS_PARAM} if the user
 *        wants custom colors/*  www  .  ja  v a2  s . c  o  m*/
 * @return the Drawing Supplier to use
 */
public DrawingSupplier createDrawingSupplier(Map<String, String> parameters) {
    DrawingSupplier supplier;

    String colorParam = parameters.get(ChartGenerator.COLORS_PARAM);
    if (colorParam != null) {
        List<Color> colors = new ArrayList<Color>();
        for (String colorAsString : colorParam.split(",")) {
            if (colorAsString.length() == 6) {
                int red = Integer.parseInt(colorAsString.substring(0, 2), 16);
                int green = Integer.parseInt(colorAsString.substring(2, 4), 16);
                int blue = Integer.parseInt(colorAsString.substring(4, 6), 16);
                colors.add(new Color(red, green, blue));
            }
        }
        Paint[] paint = new Paint[colors.size()];
        int i = 0;
        for (Color color : colors) {
            paint[i++] = color;
        }
        supplier = new DefaultDrawingSupplier(paint, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
                DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
                DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
                DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    } else {
        supplier = new DefaultDrawingSupplier();
    }

    return supplier;
}

From source file:org.gumtree.vis.awt.DefaultChartTheme.java

/**
 * @param name/*w  w w  .ja  va  2  s . c o m*/
 */
public DefaultChartTheme(String name) {
    super(name);
    setExtraLargeFont(new Font("SansSerif", Font.BOLD, 16));
    setLargeFont(new Font("SansSerif", Font.BOLD, 14));
    setRegularFont(new Font("SansSerif", Font.PLAIN, 12));
    setSmallFont(new Font("SansSerif", Font.PLAIN, 10));
    setDrawingSupplier(new DefaultDrawingSupplier(createDefaultPaintArray(),
            DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
}

From source file:pdi.HistogramaRGB.java

public ChartPanel criaHistograma() {
    dataset = new HistogramDataset();
    //pega o RGB/*w  w  w. ja v a  2 s . c  om*/
    r = raster.getSamples(0, 0, w, h, 0, r);
    dataset.addSeries("Red", r, BINS);
    r = raster.getSamples(0, 0, w, h, 1, r);
    dataset.addSeries("Green", r, BINS);
    r = raster.getSamples(0, 0, w, h, 2, r);
    dataset.addSeries("Blue", r, BINS);
    JFreeChart chart = ChartFactory.createHistogram("Histograma", "Pixels", "Y", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    //Plota as cores
    XYPlot plot = (XYPlot) chart.getPlot();
    renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarPainter(new StandardXYBarPainter());
    //vermelho, verde, azul
    Paint[] paintArray = { new Color(0x80ff0000, true), new Color(0x8000ff00, true),
            new Color(0x800000ff, true) };
    //desenhando o grfico
    plot.setDrawingSupplier(
            new DefaultDrawingSupplier(paintArray, DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);
    return panel;
}

From source file:com.pureinfo.srm.reports.impl.CategoryChartBuilder.java

/**
 * @see com.pureinfo.srm.reports.IChartBuilder#buildChart(java.util.List,
 *      int, java.lang.String)/*w w  w  .j  av  a 2 s  .  c o  m*/
 */
public JFreeChart buildChart() {
    CategoryDataset dataset = createDataset();

    JFreeChart jfreechart = MyChartFactory.createBarChart3D(null, m_sXAxisName, m_sYXxisName, dataset,
            PlotOrientation.VERTICAL, false, false, false);

    CategoryPlot categoryplot = jfreechart.getCategoryPlot();
    jfreechart.setBackgroundPaint(Color.white);
    categoryplot.setDomainGridlinesVisible(false);
    categoryplot.setRangeGridlinesVisible(true);

    categoryplot.setForegroundAlpha(0.8f);
    categoryplot.setDrawingSupplier(new DefaultDrawingSupplier(MyPaintMgr.getPaints(),
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    CategoryAxis categoryAxisX = categoryplot.getDomainAxis();
    categoryAxisX.setTickLabelsVisible(true);
    categoryAxisX.setLabel(null);
    categoryAxisX.setMaximumCategoryLabelWidthRatio(.8f);
    ValueAxis categoryAxisY = categoryplot.getRangeAxis();
    categoryAxisY.setVerticalTickLabels(false);

    //        categoryplot.setDrawSharedDomainAxis(false);
    categoryAxisX.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(0.39269908169872414D));

    BarRenderer3D barrenderer3d = (BarRenderer3D) categoryplot.getRenderer();
    barrenderer3d.setDrawBarOutline(false);
    barrenderer3d.setItemLabelsVisible(true);

    barrenderer3d.setBaseItemLabelsVisible(false);
    barrenderer3d.setSeriesVisible(Boolean.FALSE);

    //CategoryPlot categoryPlot = jfreechart.getCategoryPlot();
    //        categoryPlot.setBackgroundPaint(Color.lightGray);
    //        categoryPlot.setDomainGridlinePaint(Color.white);
    //        categoryPlot.setRangeGridlinePaint(Color.white);
    //
    //        BarRenderer barRenderer = (BarRenderer) categoryPlot.getRenderer();
    //        barRenderer.setDrawBarOutline(false);
    //        barRenderer.setMaxBarWidth(0.03);
    //        GradientPaint gradientPaint = new GradientPaint(0.0F, 0.0F,
    // Color.red, 0.0F, 0.0F, new Color(64, 0, 0));
    //        barRenderer.setSeriesPaint(0, gradientPaint);

    DecimalFormat format = null;
    if (m_dblMaxData > 1) {
        format = new DecimalFormat("#,###");
    } else {
        StringBuffer sb = new StringBuffer();
        sb.append("0.00#");
        for (double i = m_dblMaxData; i != 0 && i < 1; i *= 10f) {
            sb.append("#");
        }
        format = new DecimalFormat(sb.toString());
    }
    fillChartInfo(dataset, format);
    barrenderer3d.setMaxBarWidth(8.0 / m_ChartInfo.getChartSize().x);
    NumberAxis numberAxis = (NumberAxis) categoryplot.getRangeAxis(0);
    numberAxis.setUpperMargin(0.149999999999D);
    numberAxis.setNumberFormatOverride(format);

    categoryAxisX.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    NumberAxis dataNumberAxis = (NumberAxis) categoryplot.getRangeAxisForDataset(0);
    dataNumberAxis.setUpperMargin(0.149999999999D);
    dataNumberAxis.setNumberFormatOverride(format);

    //        CategoryItemRenderer renderer = categoryPlot.getRenderer();
    //        CategoryItemLabelGenerator generator = new StandardCategoryItemLabelGenerator("{2}", format);
    //        renderer.setItemLabelGenerator(generator);
    //        renderer.setItemLabelFont(new Font("Serif", 0, 9));
    //        renderer.setItemLabelsVisible(true);
    return jfreechart;
}

From source file:task5.Histogram.java

private ChartPanel createChartPanel() {
    // dataset// w  ww  .j  av  a  2  s.c om
    dataset = new HistogramDataset();
    Raster raster = img.getRaster();
    final int w = img.getWidth();
    final int h = img.getHeight();
    double[] r = new double[w * h + 1];
    r = raster.getSamples(0, 0, w, h, 0, r);
    dataset.addSeries("Red", r, BINS);
    r = raster.getSamples(0, 0, w, h, 1, r);
    dataset.addSeries("Green", r, BINS);
    r = raster.getSamples(0, 0, w, h, 2, r);
    dataset.addSeries("Blue", r, BINS);
    // chart
    JFreeChart chart = ChartFactory.createHistogram("Histogram", "Value", "Count", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarPainter(new StandardXYBarPainter());
    // translucent red, green & blue
    Paint[] paintArray = { new Color(0x80ff0000, true), new Color(0x8000ff00, true),
            new Color(0x800000ff, true) };
    plot.setDrawingSupplier(
            new DefaultDrawingSupplier(paintArray, DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);
    return panel;
}

From source file:gavisualizer.LineChart.java

@Override
public void generate() {
    // Creates Line Chart from variables
    JFreeChart chart = ChartFactory.createLineChart(_title, // chart title
            _axisLabelDomain, // domain axis label
            _axisLabelRange, // range axis label
            _dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            false, // tooltips
            false // urls
    );// w w  w  . jav  a 2s  .  c  o  m

    // Set the Plot to certain colors
    final CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setOutlinePaint(Color.white);

    // Set Legend to the right of the chart
    final LegendTitle lt = (LegendTitle) chart.getLegend();
    lt.setPosition(RectangleEdge.RIGHT);

    // Set paints for lines in the chart
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    DefaultDrawingSupplier dw = new DefaultDrawingSupplier(PAINTS,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    plot.setDrawingSupplier(dw);

    // Customize stroke width of the series
    ((AbstractRenderer) renderer).setAutoPopulateSeriesStroke(false);
    renderer.setBaseStroke(STROKE_WIDTH);
    renderer.setBaseShapesVisible(false);

    // Include dashed lines if necessary
    List<String> rows = _dataset.getRowKeys();

    // See if the title includes Downloads (Dashed lines are for Download lines)
    if (rows.get(rows.size() - 1).endsWith("Downloads")) {
        // Set the start to half the rows
        int start = _dataset.getRowCount() / 2;

        // Create an initial value
        int init = 0;

        // Iterate through the Download lines
        while (start < _dataset.getRowCount()) {
            // Make sure series and legend have dashes
            renderer.setSeriesStroke(start, DASHED_STROKE);
            LegendItemCollection legend = renderer.getLegendItems();
            LegendItem li = legend.get(start - 1);
            li.setLineStroke(DASHED_STROKE);

            // Make sure the color matches the undashed year
            renderer.setSeriesPaint(start, renderer.getItemPaint(init, 0));
            init++;
            start++;
        }
    }

    // Customise the range axis...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(true);

    _chart = chart;
}

From source file:net.sourceforge.processdash.ui.lib.chart.DrawingSupplierFactory.java

public DrawingSupplierFactory() {
    this.paintSequence = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE;
    this.fillPaintSequence = DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE;
    this.outlinePaintSequence = DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE;
    this.strokeSequence = DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE;
    this.outlineStrokeSequence = DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE;
    this.shapeSequence = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE;
}