Example usage for org.jfree.chart.renderer.xy XYLineAndShapeRenderer setDrawOutlines

List of usage examples for org.jfree.chart.renderer.xy XYLineAndShapeRenderer setDrawOutlines

Introduction

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

Prototype

public void setDrawOutlines(boolean flag) 

Source Link

Document

Sets the flag that controls whether outlines are drawn for shapes, and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:edu.ucla.stat.SOCR.chart.ChartGenerator.java

private JFreeChart createLineChart(String title, String xLabel, String yLabel, XYDataset dataset,
        String other) {//  w  ww. j a  va 2 s .c  om

    // create the chart...
    JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
            xLabel, // domain axis label
            yLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips
            false // urls
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    //plot.setNoDataMessage("No data available");

    // customise the range axis...

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    //rangeAxis.setAutoRange(false);   
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    // domainAxis.setAutoRange(false);   
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // customise the renderer...
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setBaseLinesVisible(false);
    renderer.setDrawOutlines(true);
    renderer.setBaseShapesFilled(true);
    renderer.setUseFillPaint(true);
    //renderer.setFillPaint(Color.white);

    if (other.toLowerCase().indexOf("noshape") != -1) {
        renderer.setBaseShapesVisible(false);
        renderer.setBaseLinesVisible(true);
    }

    if (other.toLowerCase().indexOf("excludeszero") != -1) {
        rangeAxis.setAutoRangeIncludesZero(false);
        domainAxis.setAutoRangeIncludesZero(false);
    }

    return chart;
}

From source file:visualizer.datamining.dataanalysis.NeighborhoodHit.java

private JFreeChart createChart(XYDataset xydataset) {
    JFreeChart chart = ChartFactory.createXYLineChart("Neighborhood Hit", "Number Neighbors", "Precision",
            xydataset, 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);

    xyplot.setDrawingSupplier(new DefaultDrawingSupplier(
            new Paint[] { Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE,
                    Color.BLACK, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY, Color.YELLOW },
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylineandshaperenderer.setBaseShapesVisible(true);
    xylineandshaperenderer.setBaseShapesFilled(true);
    xylineandshaperenderer.setDrawOutlines(true);

    return chart;
}

From source file:org.glotaran.core.datadisplayers.common.ImageSVDPanel.java

public void createSVDPlots() {

    int maxSpinnerNumberModel = Math.min(MAX_NUMBER_SINGULAR_VALUES, (int) svdResult[1].getRowCount());
    jTFtotalNumSV/*from   w  w  w .  j a v  a2s.  c o m*/
            .setText("Max " + maxSpinnerNumberModel + " of  " + String.valueOf(svdResult[1].getRowCount()));
    jSnumSV.setModel(new SpinnerNumberModel((int) 1, (int) 0, maxSpinnerNumberModel, (int) 1));

    //creare collection with first 2 LSV
    XYSeriesCollection lSVCollection = new XYSeriesCollection();
    XYSeries seria;
    seria = new XYSeries("LSV1");
    for (int i = 0; i < timeSteps; i++) {
        seria.add(timeAxe[i], svdResult[0].getAsDouble((long) i, 0));
    }
    lSVCollection.addSeries(seria);

    //creare chart for 2 LSV
    leftSVChart = ChartFactory.createXYLineChart("Left singular vectors", "Time (~s)", null, lSVCollection,
            PlotOrientation.VERTICAL, false, false, false);
    //leftSVChart.getTitle().setFont(new Font(leftSVChart.getTitle().getFont().getFontName(), Font.PLAIN, 12));
    leftSVChart.setBackgroundPaint(JFreeChart.DEFAULT_BACKGROUND_PAINT);
    GraphPanel chpan = new GraphPanel(leftSVChart);
    jPLeftSingVectors.removeAll();
    jPLeftSingVectors.add(chpan);

    //creare collection with first RSV
    double[] tempRsingVec = null;
    double minVal = 0;
    double maxVal = 0;

    //            seria = new XYSeries("RSV" + (j + 1));
    tempRsingVec = new double[imageWitdth * imageHeight];
    double tempValue;
    for (int i = 0; i < imageWitdth * imageHeight; i++) {
        tempValue = svdResult[2].getAsDouble(i, 0);
        tempRsingVec[i] = tempValue;
        minVal = minVal > tempValue ? tempValue : minVal;
        maxVal = maxVal < tempValue ? tempValue : maxVal;
    }

    IntensImageDataset rSingVec = new IntensImageDataset(imageWitdth, imageHeight, tempRsingVec);
    PaintScale ps = new RedGreenPaintScale(minVal, maxVal);
    JFreeChart rSingVect = CommonDataDispTools
            .createScatChart(ImageUtilities.createColorCodedImage(rSingVec, ps), ps, imageWitdth, imageHeight);
    //            rSingVect.setTitle("R Singular vector " + String.valueOf(j + 1));
    //rSingVect.getTitle().setFont(new Font(tracechart.getTitle().getFont().getFontName(), Font.PLAIN, 12));
    ChartPanel rSingVectPanel = new ChartPanel(rSingVect);
    rSingVectPanel.setFillZoomRectangle(true);
    rSingVectPanel.setMouseWheelEnabled(true);

    jPRightSingVectors.removeAll();
    jPRightSingVectors.add(rSingVectPanel);

    //creare collection with singular values
    XYSeriesCollection sVCollection = new XYSeriesCollection();
    seria = new XYSeries("SV");
    for (int i = 0; i < maxSpinnerNumberModel; i++) {
        seria.add(i + 1, svdResult[1].getAsDouble((long) i, (long) i));
    }
    sVCollection.addSeries(seria);

    //create chart for singular values
    JFreeChart tracechart = ChartFactory.createXYLineChart("Screeplot", "Singular Value index (n)", null,
            sVCollection, PlotOrientation.VERTICAL, false, false, false);
    LogAxis logAxe = new LogAxis("Log(SVn)");
    final NumberAxis domainAxis = (NumberAxis) tracechart.getXYPlot().getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    tracechart.getXYPlot().setRangeAxis(logAxe);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) tracechart.getXYPlot().getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseFillPaint(Color.white);
    renderer.setSeriesStroke(0, new BasicStroke(1.0f));
    renderer.setSeriesOutlineStroke(0, new BasicStroke(1.0f));
    renderer.setSeriesShape(0, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0));

    //tracechart.getTitle().setFont(new Font(tracechart.getTitle().getFont().getFontName(), Font.PLAIN, 12));
    tracechart.setBackgroundPaint(JFreeChart.DEFAULT_BACKGROUND_PAINT);

    chpan = new GraphPanel(tracechart);
    //add chart with 2 RSV to JPannel
    jPSingValues.removeAll();
    jPSingValues.add(chpan);
}

From source file:visualizer.datamining.dataanalysis.NeighborhoodPreservation.java

private JFreeChart createChart(XYDataset xydataset) {
    JFreeChart chart = ChartFactory.createXYLineChart("Neighborhood Preservation", "Number Neighbors",
            "Precision", xydataset, 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);

    xyplot.setDrawingSupplier(new DefaultDrawingSupplier(
            new Paint[] { Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE,
                    Color.BLACK, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY, Color.YELLOW },
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylineandshaperenderer.setBaseShapesVisible(true);
    xylineandshaperenderer.setBaseShapesFilled(true);
    xylineandshaperenderer.setDrawOutlines(true);

    return chart;
}

From source file:charts.Chart.java

public static void MultipleLineChart(XYSeriesCollection datasets, String title, String x_axis_label,
        String y_axis_label) {/*from   w  ww.j a  v a2s .c  om*/
    JFrame chartwindow = new JFrame(title);
    JFreeChart jfreechart = ChartFactory.createXYLineChart(title, x_axis_label, y_axis_label, datasets,
            PlotOrientation.VERTICAL, true, true, true);

    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.black);

    NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(true);

    XYLineAndShapeRenderer lineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    lineandshaperenderer.setShapesVisible(true);
    lineandshaperenderer.setDrawOutlines(true);
    lineandshaperenderer.setUseFillPaint(true);
    lineandshaperenderer.setFillPaint(Color.white);

    JPanel jpanel = new ChartPanel(jfreechart);
    jpanel.setPreferredSize(new Dimension(defaultwidth, defaultheight));
    chartwindow.setContentPane(jpanel);
    chartwindow.pack();
    RefineryUtilities.centerFrameOnScreen(chartwindow);
    chartwindow.setVisible(true);
}

From source file:com.anrisoftware.prefdialog.miscswing.multichart.freechart.FreechartXYChart.java

private XYLineAndShapeRenderer createLineShapeRenderer() {
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, true);
    renderer.setBaseStroke(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);//from ww  w.j  a  v  a  2  s  .  co m
    renderer.setDrawOutlines(true);
    int columns = model == null ? 1 : model.getColumnCount();
    if (blackWhite) {
        for (int i = 0; i < columns; i++) {
            renderer.setSeriesPaint(i, Color.black, false);
        }
    } else {
        Iterator<Color> it = paletteFactory.createBright().iterator();
        for (int i = 0; i < columns; i++, it.hasNext()) {
            renderer.setSeriesPaint(i, it.next(), false);
        }
    }
    if (!showShapes) {
        for (int i = 0; i < columns; i++) {
            renderer.setSeriesShapesVisible(i, false);
        }
    }
    renderer.notifyListeners(new RendererChangeEvent(renderer));
    return renderer;
}

From source file:io.github.mzmine.modules.plots.chromatogram.ChromatogramPlotWindowController.java

private void configureRenderer(ChromatogramPlotDataSet dataset, int datasetIndex) {

    final XYPlot plot = chartNode.getChart().getXYPlot();

    XYLineAndShapeRenderer newRenderer = new XYLineAndShapeRenderer();
    final int lineThickness = dataset.getLineThickness();
    newRenderer.setBaseShape(new Ellipse2D.Double(-2 * lineThickness, -2 * lineThickness, 4 * lineThickness + 1,
            4 * lineThickness + 1));/*from   w  w w.ja  va  2  s  .c o  m*/
    newRenderer.setBaseShapesFilled(true);
    newRenderer.setBaseShapesVisible(dataset.getShowDataPoints());
    newRenderer.setDrawOutlines(false);

    Stroke baseStroke = new BasicStroke(lineThickness);
    newRenderer.setBaseStroke(baseStroke);

    // Set tooltips for legend
    newRenderer.setLegendItemToolTipGenerator((ds, series) -> {
        if (ds instanceof ChromatogramPlotDataSet) {
            return ((ChromatogramPlotDataSet) ds).getDescription();
        } else
            return null;
    });

    // Set color
    Color baseColor = dataset.getColor();
    newRenderer.setBasePaint(JavaFXUtil.convertColorToAWT(baseColor));

    // Set label generator
    XYItemLabelGenerator intelligentLabelGenerator = new IntelligentItemLabelGenerator(chartNode, 100, dataset);
    newRenderer.setBaseItemLabelGenerator(intelligentLabelGenerator);
    newRenderer.setBaseItemLabelPaint(JavaFXUtil.convertColorToAWT(labelsColor));
    newRenderer.setBaseItemLabelsVisible(itemLabelsVisible.get());
    newRenderer.setBaseItemLabelsVisible(true);

    // Set tooltip generator
    newRenderer.setBaseToolTipGenerator(dataset);

    plot.setRenderer(datasetIndex, newRenderer);

}

From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java

/**
 * Creates a line chart.//w  w  w  . j  a  v a 2  s  . c  o m
 * 
 * @param title
 * @param categoryAxisLabel
 *            (X-Axis label)
 * @param valueAxisLabel
 *            (Y-Axis label)
 * @param dataset
 * @param includeZero
 *            True when zero shall be included to the axis range.
 * @return JfreeChart instance.
 */
public JFreeChart createXYLineChart(String title, String categoryAxisLabel, String valueAxisLabel,
        XYDataset dataset, boolean includeZero, boolean drawShapes) {
    JFreeChart chart = ChartFactory.createXYLineChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            this.orientation, this.drawLegend, false, false);
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);
    XYPlot plot = chart.getXYPlot();
    ValueAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0.025);
    domainAxis.setUpperMargin(0.025);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setAutoRangeIncludesZero(includeZero);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesPaint(1, Color.red);
    renderer.setSeriesPaint(2, Color.green);
    renderer.setSeriesPaint(3, Color.darkGray);
    renderer.setSeriesPaint(4, Color.yellow);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseShapesVisible(drawShapes);
    renderer.setBaseShapesFilled(true);
    return chart;
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.targetcharts.SparkLine.java

private void addPointSeries(TimeSeries series, XYPlot plot) {
    logger.debug("IN");
    TimeSeries pointSerie = new TimeSeries("Point", Month.class);
    for (int i = 0; i < series.getItemCount(); i++) {
        pointSerie.add(series.getTimePeriod(i), series.getValue(i));
    }/*  w w w .j  av a 2s.co  m*/
    final TimeSeriesCollection avgDs = new TimeSeriesCollection(pointSerie);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false) {
        public boolean getItemShapeVisible(int _series, int item) {
            return (true);
        }
    };
    renderer.setSeriesPaint(2, Color.LIGHT_GRAY);
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseFillPaint(Color.BLACK);
    renderer.setBaseOutlinePaint(Color.BLACK);
    renderer.setUseOutlinePaint(true);
    renderer.setSeriesShape(0, new Ellipse2D.Double(-2.0, -2.0, 4.0, 4.0));

    plot.setDataset(2, avgDs);
    plot.setRenderer(2, renderer);
    logger.debug("OUT");

}

From source file:org.operamasks.faces.render.graph.LineChartRenderer.java

private void setLineStyles(XYLineAndShapeRenderer renderer, UIChart comp) {
    Boolean drawLines = comp.getDrawLines();
    if (drawLines != null) {
        renderer.setBaseLinesVisible(drawLines);
    }/*from w ww .  j  a  v a 2 s.  c o  m*/

    Boolean drawMarkers = comp.getDrawMarkers();
    if (drawMarkers != null) {
        renderer.setBaseShapesVisible(drawMarkers);
    }

    Boolean fillMarkers = comp.getFillMarkers();
    if (fillMarkers != null) {
        renderer.setBaseShapesFilled(fillMarkers);
    }
    renderer.setUseFillPaint(true);

    Boolean drawOutline = comp.getDrawOutline();
    if (drawOutline != null) {
        renderer.setDrawOutlines(drawOutline);
    }
    renderer.setUseOutlinePaint(true);
}