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

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

Introduction

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

Prototype

public void setSeriesShapesVisible(int series, Boolean flag) 

Source Link

Document

Sets the 'shapes visible' flag for a series and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:richclient.EvolutionChart.java

/**
 * Creates a chart.//from  ww w  . j a  v a2  s .  com
 *
 * @param dataset the data for the chart.
 *
 * @return a chart.
 */
public JFreeChart createChart(XYDataset dataset) {

    // create the chart
    final JFreeChart chart = ChartFactory.createXYLineChart("Market evolution", // chart title
            "Time", // x axis label
            "Value", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    //        final StandardLegend legend = (StandardLegend) chart.getLegend();
    //      legend.setDisplaySeriesShapes(true);
    // get a reference to the plot for further customisation...
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    //    plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, true);
    renderer.setSeriesShapesVisible(1, true);
    plot.setRenderer(renderer);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:com.googlecode.logVisualizer.chart.LineChartBuilder.java

private JFreeChart createChart(final XYDataset dataset) {
    final JFreeChart chart = ChartFactory.createXYLineChart(getTitle(), xLable, yLable, dataset,
            PlotOrientation.VERTICAL, isIncludeLegend(), true, false);
    final XYPlot plot = (XYPlot) chart.getPlot();

    double lastXValue = 0;
    if (dataset.getSeriesCount() > 0)
        lastXValue = dataset.getXValue(0, dataset.getItemCount(0) - 1);

    plot.setDomainAxis(new FixedZoomNumberAxis(lastXValue));
    plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);
    plot.setNoDataMessage("No data available");
    if (dataset.getSeriesCount() > 0)
        ((NumberAxis) plot.getDomainAxis()).setUpperBound(lastXValue);
    ((NumberAxis) plot.getRangeAxis()).setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    for (int i = 0; i < dataset.getSeriesCount(); i++) {
        renderer.setSeriesShapesVisible(i, false);
        renderer.setSeriesStroke(i, new BasicStroke(2));
    }//from w  w  w  .j  a v  a 2 s  .  com
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    plot.setRenderer(renderer);

    return chart;
}

From source file:com.seniorproject.augmentedreality.test.LineChartDemo6.java

/**
 * Creates a chart.//  w  ww  .ja  v a 2s . com
 * 
 * @param dataset  the data for the chart.
 * 
 * @return a chart.
 */
private JFreeChart createChart(final XYDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart("Line Chart Demo 6", // chart title
            "X", // x axis label
            "Y", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    //        final StandardLegend legend = (StandardLegend) chart.getLegend();
    //      legend.setDisplaySeriesShapes(true);

    // get a reference to the plot for further customisation...
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    //    plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesShapesVisible(1, false);
    plot.setRenderer(renderer);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:org.ow2.clif.jenkins.chart.MovingStatChart.java

private XYLineAndShapeRenderer getThroughputRenderer() {
    final XYLineAndShapeRenderer rendererThroughput = new XYLineAndShapeRenderer();
    rendererThroughput.setSeriesShapesVisible(0, false);
    rendererThroughput.setSeriesPaint(0, Color.MAGENTA);
    rendererThroughput.setSeriesStroke(0, new BasicStroke(1));
    return rendererThroughput;
}

From source file:org.ow2.clif.jenkins.chart.MovingStatChart.java

private XYLineAndShapeRenderer getGlobalRenderer() {
    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesShapesVisible(0, false);
    renderer.setSeriesPaint(0, Color.BLUE);
    renderer.setSeriesStroke(0, new BasicStroke(1));
    renderer.setSeriesShapesVisible(1, false);
    renderer.setSeriesPaint(1, Color.RED);
    renderer.setSeriesStroke(1, new BasicStroke(1));
    renderer.setSeriesShapesVisible(2, false);
    renderer.setSeriesPaint(2, Color.GREEN);
    renderer.setSeriesStroke(2, new BasicStroke(1));
    renderer.setSeriesShapesVisible(3, false);
    renderer.setSeriesPaint(3, Color.YELLOW);
    renderer.setSeriesStroke(3, new BasicStroke(1));
    renderer.setSeriesShapesVisible(4, false);
    renderer.setSeriesPaint(4, Color.ORANGE);
    renderer.setSeriesStroke(4, new BasicStroke(1));
    return renderer;
}

From source file:statUtil.TurnMovementPlot.java

public TurnMovementPlot(String title) throws IOException {
    super(title);
    Data data = CSVData.getCSVData(TURN_CSV_LOG);
    JFreeChart chart = ChartFactory.createXYLineChart(title, "X", "Y",
            XYDatasetGenerator.generateXYDataset(data.csvData));
    final XYPlot xyPlot = chart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesStroke(0, new BasicStroke(3f));
    renderer.setSeriesLinesVisible(0, true);
    renderer.setSeriesShapesVisible(0, false);
    renderer.setSeriesLinesVisible(1, false);
    renderer.setSeriesShapesVisible(1, true);
    Shape cross = ShapeUtilities.createDiagonalCross(2f, 0.5f);
    renderer.setSeriesShape(1, cross);//from ww w.j  a v  a 2s . c o  m
    xyPlot.setRenderer(renderer);
    xyPlot.setQuadrantOrigin(new Point(0, 0));

    int i = 0;
    for (Double[] csvRow : data.csvData) {
        if (i % 20 == 1) {
            final XYTextAnnotation annotation = new XYTextAnnotation(Double.toString(csvRow[3]), csvRow[0],
                    csvRow[1]);
            annotation.setFont(new Font("SansSerif", Font.PLAIN, 10));
            xyPlot.addAnnotation(annotation);
        }
        i++;
    }

    int width = (int) Math.round(data.maxX - data.minX) + 50;
    int height = (int) Math.round(data.maxY - data.minY) + 50;
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(width, height));
    setContentPane(chartPanel);
    File XYChart = new File(FILE_PATH + "\\TurnMovementPlot.png");
    ChartUtilities.saveChartAsPNG(XYChart, chart, width, height);
}

From source file:grafix.graficos.indices.IndiceADX.java

@Override
public void plotar(final XYPlot plot, final JanelaGraficos janela, final int contador) {
    XYLineAndShapeRenderer r = new XYLineAndShapeRenderer();
    r.setSeriesLinesVisible(0, true);//from ww  w  .j  av  a 2  s . c  om
    r.setSeriesShapesVisible(0, false);
    r.setSeriesPaint(0, Color.BLUE);
    r.setSeriesStroke(0, new BasicStroke(.75f));

    r.setSeriesPaint(1, Color.RED);
    r.setSeriesStroke(1, new BasicStroke(.6f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 3.0f, 4.0f }, 0.0f));
    r.setSeriesLinesVisible(1, true);
    r.setSeriesShapesVisible(1, false);

    r.setSeriesPaint(2, new Color(0f, .6f, 0f));
    r.setSeriesStroke(2, new BasicStroke(.6f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 2.0f,
            new float[] { 3.0f, 4.0f }, 0.0f));
    r.setSeriesLinesVisible(2, true);
    r.setSeriesShapesVisible(2, false);

    r.setToolTipGenerator(new IndiceToolTipGenerator(this));
    plot.setRenderer(contador, r);
    plot.setDataset(contador, getDataSet(janela));
}

From source file:com.marvelution.jira.plugins.hudson.charts.BuildTestResultsRatioChartGenerator.java

/**
 * {@inheritDoc}//from  www  .  ja v a 2 s.c  o m
 */
@Override
public ChartHelper generateChart() {
    buildMap = new HashMap<Integer, Build>();
    final CategoryTableXYDataset dataset = new CategoryTableXYDataset();
    for (Build build : builds) {
        final TestResult results = build.getTestResult();
        double percentagePass = 0.0D, percentageFail = 0.0D, percentageSkipped = 0.0D;
        if (results != null && results.getTotal() > 0) {
            percentagePass = Double.valueOf(results.getPassed()) / Double.valueOf(results.getTotal()) * 100.0D;
            percentageFail = Double.valueOf(results.getFailed()) / Double.valueOf(results.getTotal()) * 100.0D;
            percentageSkipped = Double.valueOf(results.getSkipped()) / Double.valueOf(results.getTotal())
                    * 100.0D;
        }
        dataset.add(Double.valueOf(build.getBuildNumber()), percentagePass, seriesNames[0]);
        dataset.add(Double.valueOf(build.getBuildNumber()), percentageFail, seriesNames[1]);
        dataset.add(Double.valueOf(build.getBuildNumber()), percentageSkipped, seriesNames[2]);
        buildMap.put(Integer.valueOf(build.getBuildNumber()), build);
    }
    final JFreeChart chart = ChartFactory.createStackedXYAreaChart("", "",
            getI18n().getText("hudson.charts.tests"), dataset, PlotOrientation.VERTICAL, false, false, false);
    chart.setBackgroundPaint(Color.WHITE);
    chart.setBorderVisible(false);
    XYPlot xyPlot = chart.getXYPlot();
    xyPlot.setDataset(1, dataset);
    if (dataset.getItemCount() > 0) {
        XYLineAndShapeRenderer shapeRenderer = new XYLineAndShapeRenderer(false, true);
        shapeRenderer.setSeriesShapesVisible(1, false);
        shapeRenderer.setSeriesLinesVisible(1, false);
        shapeRenderer.setSeriesShapesVisible(2, false);
        shapeRenderer.setSeriesLinesVisible(2, false);
        shapeRenderer.setSeriesShape(0, new Ellipse2D.Double(-3.0D, -3.0D, 6.0D, 6.0D));
        shapeRenderer.setSeriesPaint(0, GREEN_PAINT);
        shapeRenderer.setSeriesShapesFilled(0, true);
        shapeRenderer.setBaseToolTipGenerator(this);
        shapeRenderer.setBaseItemLabelFont(ChartDefaults.defaultFont);
        shapeRenderer.setBaseItemLabelsVisible(false);
        xyPlot.setRenderer(0, shapeRenderer);
        StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
        renderer.setSeriesPaint(0, GREEN_PAINT);
        renderer.setSeriesPaint(1, RED_PAINT);
        renderer.setSeriesPaint(2, YELLOW_PAINT);
        renderer.setBaseItemLabelFont(ChartDefaults.defaultFont);
        renderer.setBaseItemLabelsVisible(false);
        xyPlot.setRenderer(1, renderer);
        renderer.setBaseToolTipGenerator(this);
    }
    ValueAxis rangeAxis = xyPlot.getRangeAxis();
    rangeAxis.setLowerBound(0.0D);
    rangeAxis.setUpperBound(100.0D);
    final NumberAxis domainAxis = new NumberAxis();
    domainAxis.setLowerBound(Collections.min(buildMap.keySet()));
    domainAxis.setUpperBound(Collections.max(buildMap.keySet()));
    final TickUnitSource ticks = NumberAxis.createIntegerTickUnits();
    domainAxis.setStandardTickUnits(ticks);
    xyPlot.setDomainAxis(domainAxis);
    ChartUtil.setupPlot(xyPlot);
    return new ChartHelper(chart);
}

From source file:presentationGui.GraphFrame.java

/**
 * Creates a chart.//from  ww w  .  ja va2 s .  c  o m
 *
 * @param dataset the data for the chart.
 *
 * @return a chart.
 */
private JFreeChart createChart(final XYDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart("Comportamento Asintotico del throughput", // chart title
            "numero job", // x axis label
            "throughput", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    //        final StandardLegend legend = (StandardLegend) chart.getLegend();
    //      legend.setDisplaySeriesShapes(true);
    // get a reference to the plot for further customisation...
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    //    plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesShapesVisible(1, false);
    plot.setRenderer(renderer);

    // change the auto tick unit selection to integer units only...
    /*final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());*/
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:gov.sandia.umf.platform.ui.jobs.Plot.java

public JFreeChart createChart(final XYDataset dataset) {
    final JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title
            null, // x axis label
            null, // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );/* w  w  w  . jav a  2  s .  c om*/

    chart.setBackgroundPaint(Color.white);

    LegendTitle legend = chart.getLegend();
    legend.setVisible(dataset.getSeriesCount() <= 5);

    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    ValueAxis axis = plot.getRangeAxis();
    if (axis instanceof NumberAxis)
        ((NumberAxis) axis).setAutoRangeIncludesZero(false);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    for (int i = 0; i < dataset.getSeriesCount(); i++)
        renderer.setSeriesShapesVisible(i, false);
    plot.setRenderer(renderer);

    return chart;
}