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:required.ChartPlotter.java

/**
 * Creates a chart./*from   w  w  w .j  a  va2s.  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("Zipf's LAW", // chart title
            "frequency", // x axis label
            "words", // 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:com.cs572.assignments.Project2.view.LineChartPanel.java

/**
 * Creates a chart.//from www. j ava 2 s . c  om
 *
 * @param dataset the data for the chart.
 *
 * @return a chart.
 */
private JFreeChart createChart(final XYDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart("Expression Tree", // chart title
            "DataPoints", // x axis label
            "Output", // 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.setSeriesLinesVisible(1, true);
    renderer.setSeriesShapesVisible(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:pharoslabut.logger.CompassLoggerGUI.java

/**
 * Creates a chart.//  ww w.  j  av a  2 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("Proteus Robot Compass Measurements", // chart title
            "Time (s)", // x axis label
            "Angle (radians)", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, false, // 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 customization...
    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);

    final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setRange(new Range(0, 140));

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    // change the auto tick unit selection to integer units only...
    //        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setRange(new Range(-Math.PI, Math.PI));
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:Main.Chart.java

/**
 * Creates a chart./*  w  w  w.j ava 2s  .  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("Weather Forecast", // chart title
            "Time", // x axis label
            "Temperature", // 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:msi.gama.hpc.gui.perspective.chart.HeadlessChart.java

private JFreeChart createChart(final XYDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart("Line Chart from XML output file", // chart title
            "X", // x axis label
            "Y", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );// w ww.j  a  v  a 2  s. co m

    // 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.esa.s1tbx.insar.rcp.toolviews.insar_statistics.StatESDMeasure.java

public void update(final Product product) {
    try {/*from   ww w.  j a  v  a  2  s . c o  m*/
        if (InSARStatisticsTopComponent.isValidProduct(product) && readESDMeasure(product)) {
            setVisible(true);

            dataset.removeAllSeries();

            int i = 0;
            for (String subswath : esdData.keySet()) {

                final XYSeries series = new XYSeries(subswath);
                final Map<Integer, Double> values = esdData.get(subswath);
                for (Integer burst : values.keySet()) {
                    series.add(burst + 1, values.get(burst));
                }

                dataset.addSeries(series);

                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) chart.getXYPlot().getRenderer();
                renderer.setSeriesLinesVisible(i, true);
                renderer.setSeriesShapesVisible(i, true);

                chart.getXYPlot().getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
                ++i;
            }
        } else {
            setVisible(false);
        }
    } catch (Exception e) {
        SnapApp.getDefault().handleError("Unable to update product", e);
    }
}

From source file:adams.gui.visualization.jfreechart.chart.ScatterPlot.java

/**
 * Performs the actual generation of the chart.
 *
 * @param data   the data to use/*w  ww . j av  a  2 s  . c  om*/
 * @return      the chart
 */
@Override
protected JFreeChart doGenerate(XYDataset data) {
    JFreeChart result = ChartFactory.createScatterPlot(m_Title, m_LabelX, m_LabelY, data,
            m_Orientation.getOrientation(), m_Legend, m_ToolTips, false);
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    if (result.getXYPlot().getSeriesCount() == 2) {
        renderer.setSeriesLinesVisible(0, false);
        renderer.setSeriesLinesVisible(1, true);
        renderer.setSeriesShapesVisible(0, true);
        renderer.setSeriesShapesVisible(1, false);
        result.getXYPlot().setRenderer(renderer);
    }
    return result;
}

From source file:edu.utexas.ece.pharos.proteus3.sensors.CompassChartGUI.java

/**
 * Creates a chart./*from   ww w. j  a v  a  2  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("Proteus III Compass Measurements", // chart title
            "Time (s)", // x axis label
            "Angle (degrees)", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, false, // 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 customization...
    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);

    final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setRange(new Range(0, 140));

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    // change the auto tick unit selection to integer units only...
    //        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    //rangeAxis.setRange(new Range(-Math.PI, Math.PI));
    rangeAxis.setRange(new Range(-180, 180));

    return chart;

}

From source file:edu.turtlekit2.tools.chart.ChartWindow.java

/**
 * Creates a chart. Local use.// w ww.ja  v a2s .  c om
 * @param dataset - the data for the chart.
 * @param title - the name of the chart
 * @param xName - the name of the x-axis.
 * @param yName - the name of the y-axis.
 * @return a chart.
 */
private JFreeChart createChart(final XYDataset dataset, String title, String xName, String yName) {
    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
            xName, // x axis label
            yName, // 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);

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

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

    //      renderer.setSeriesStroke(
    //               0, new BasicStroke(
    //                   2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
    //                   1.0f, new float[] {1.0f, 6.0f}, 0.0f
    //               )
    //           );
    //           renderer.setSeriesStroke(
    //               1, new BasicStroke(
    //                   2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
    //                   1.0f, new float[] {1.0f, 6.0f}, 0.0f
    //               )
    //           );
    //           renderer.setSeriesStroke(
    //               2, new BasicStroke(
    //                   2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
    //                   1.0f, new float[] {1.0f, 6.0f}, 0.0f
    //               )
    //           );
    //      
    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    return chart;
}

From source file:org.drugis.addis.gui.ConvergencePlotsDialog.java

private JFreeChart createVhatVsWChart(final XYDataset dataset) {
    final JFreeChart VhatVsWChart = ChartFactory.createXYLineChart("Plots of sqrt(vHat) and sqrt(W)",
            "Iteration No.", "Variance Estimates", dataset, PlotOrientation.VERTICAL, true, true, false);

    VhatVsWChart.setBackgroundPaint(Color.white);
    final XYPlot VhatVsWPlot = VhatVsWChart.getXYPlot();
    VhatVsWPlot.setDomainGridlinePaint(Color.white);
    VhatVsWPlot.setRangeGridlinePaint(Color.white);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.red);
    renderer.setSeriesPaint(1, Color.blue);
    renderer.setSeriesShapesVisible(0, false);
    renderer.setSeriesShapesVisible(1, false);
    VhatVsWPlot.setRenderer(renderer);/*from  ww  w .  java 2s .  com*/

    return VhatVsWChart;
}