Java 类org.jfree.chart.renderer.xy.XYAreaRenderer 实例源码

项目:astor    文件:ChartFactory.java   
/**
 * Creates an area chart using an {@link XYDataset}.
 * <P>
 * The chart object returned by this method uses an {@link XYPlot} instance
 * as the plot, with a {@link NumberAxis} for the domain axis, a
 * {@link NumberAxis} as the range axis, and a {@link XYAreaRenderer} as
 * the renderer.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
 * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 *
 * @return An XY area chart.
 */
public static JFreeChart createXYAreaChart(String title, String xAxisLabel,
        String yAxisLabel, XYDataset dataset, boolean legend) {

    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setForegroundAlpha(0.5f);
    XYAreaRenderer renderer = new XYAreaRenderer(XYAreaRenderer.AREA);
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    plot.setRenderer(renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
项目:Openfire    文件:GraphEngine.java   
/**
 * Generates a generic Time Area Chart.
 *
 * @param title      the title of the Chart.
 * @param valueLabel the Y Axis label.
 * @param data       the data to populate with.
 * @return the generated Chart.
 */
private JFreeChart createTimeAreaChart(String title, String color, String valueLabel, XYDataset data) {
    PlotOrientation orientation = PlotOrientation.VERTICAL;

    DateAxis xAxis = generateTimeAxis();

    NumberAxis yAxis = new NumberAxis(valueLabel);

    NumberFormat formatter = NumberFormat.getNumberInstance(JiveGlobals.getLocale());
    formatter.setMaximumFractionDigits(2);
    formatter.setMinimumFractionDigits(0);
    yAxis.setNumberFormatOverride(formatter);

    XYAreaRenderer renderer = new XYAreaRenderer(XYAreaRenderer.AREA);
    renderer.setOutline(true);

    return createChart(title, data, xAxis, yAxis, orientation, renderer,
            GraphDefinition.getDefinition(color));
}
项目:g3server    文件:GraphEngine.java   
/**
 * Generates a generic Time Area Chart.
 *
 * @param title      the title of the Chart.
 * @param valueLabel the Y Axis label.
 * @param data       the data to populate with.
 * @return the generated Chart.
 */
private JFreeChart createTimeAreaChart(String title, String color, String valueLabel, XYDataset data) {
    PlotOrientation orientation = PlotOrientation.VERTICAL;

    DateAxis xAxis = generateTimeAxis();

    NumberAxis yAxis = new NumberAxis(valueLabel);

    NumberFormat formatter = NumberFormat.getNumberInstance(JiveGlobals.getLocale());
    formatter.setMaximumFractionDigits(2);
    formatter.setMinimumFractionDigits(0);
    yAxis.setNumberFormatOverride(formatter);

    XYAreaRenderer renderer = new XYAreaRenderer(XYAreaRenderer.AREA);
    renderer.setOutline(true);

    return createChart(title, data, xAxis, yAxis, orientation, renderer,
            GraphDefinition.getDefinition(color));
}
项目:openfire    文件:GraphEngine.java   
/**
 * Generates a generic Time Area Chart.
 *
 * @param title      the title of the Chart.
 * @param valueLabel the Y Axis label.
 * @param data       the data to populate with.
 * @return the generated Chart.
 */
private JFreeChart createTimeAreaChart(String title, String color, String valueLabel, XYDataset data) {
    PlotOrientation orientation = PlotOrientation.VERTICAL;

    DateAxis xAxis = generateTimeAxis();

    NumberAxis yAxis = new NumberAxis(valueLabel);

    NumberFormat formatter = NumberFormat.getNumberInstance(JiveGlobals.getLocale());
    formatter.setMaximumFractionDigits(2);
    formatter.setMinimumFractionDigits(0);
    yAxis.setNumberFormatOverride(formatter);

    XYAreaRenderer renderer = new XYAreaRenderer(XYAreaRenderer.AREA);
    renderer.setOutline(true);

    return createChart(title, data, xAxis, yAxis, orientation, renderer,
            GraphDefinition.getDefinition(color));
}
项目:Data-and-Information-Visualization-Project    文件:ControlsJPanel.java   
public JFreeChart showChart(IntervalXYDataset dataset) {

        JFreeChart chart = ChartFactory.createHistogram("", "", "", dataset, PlotOrientation.VERTICAL, true, false, false);

        chart.setBackgroundPaint(Color.white);
        XYPlot plot = (XYPlot) chart.getPlot();
        plot.setBackgroundPaint(Color.lightGray);
        plot.setDomainGridlinesVisible(false);
        plot.setRangeGridlinesVisible(false);
        plot.setRangeAxis(new LogarithmicAxis("packetCount"));

        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setVisible(false);

        rangeAxis.setAutoTickUnitSelection(true);
        rangeAxis.setAutoRangeIncludesZero(true);
        DateAxis dAxis = new DateAxis();
        dAxis.setRange((long) ControlsJPanel.QW_MIN * 1000L, (long) ControlsJPanel.QW_MAX * 1000L);
        plot.setDomainAxis(dAxis);

        plot.setRenderer(new XYAreaRenderer());
        plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
        chart.setPadding(new RectangleInsets(0, 0, 0, 0));

        return chart;
    }
项目:openfire-bespoke    文件:GraphEngine.java   
/**
 * Generates a generic Time Area Chart.
 *
 * @param title      the title of the Chart.
 * @param valueLabel the Y Axis label.
 * @param data       the data to populate with.
 * @return the generated Chart.
 */
private JFreeChart createTimeAreaChart(String title, String color, String valueLabel, XYDataset data) {
    PlotOrientation orientation = PlotOrientation.VERTICAL;

    DateAxis xAxis = generateTimeAxis();

    NumberAxis yAxis = new NumberAxis(valueLabel);

    NumberFormat formatter = NumberFormat.getNumberInstance(JiveGlobals.getLocale());
    formatter.setMaximumFractionDigits(2);
    formatter.setMinimumFractionDigits(0);
    yAxis.setNumberFormatOverride(formatter);

    XYAreaRenderer renderer = new XYAreaRenderer(XYAreaRenderer.AREA);
    renderer.setOutline(true);

    return createChart(title, data, xAxis, yAxis, orientation, renderer,
            GraphDefinition.getDefinition(color));
}
项目:parabuild-ci    文件:XYAreaRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    XYAreaRenderer r1 = new XYAreaRenderer();
    XYAreaRenderer r2 = new XYAreaRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:parabuild-ci    文件:XYAreaRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    XYAreaRenderer r1 = new XYAreaRenderer();
    XYAreaRenderer r2 = new XYAreaRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:parabuild-ci    文件:XYAreaRendererTests.java   
/**
 * Draws the chart with a <code>null</code> info object to make sure that 
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultTableXYDataset dataset = new DefaultTableXYDataset();

        XYSeries s1 = new XYSeries("Series 1", true, false);
        s1.add(5.0, 5.0);
        s1.add(10.0, 15.5);
        s1.add(15.0, 9.5);
        s1.add(20.0, 7.5);
        dataset.addSeries(s1);

        XYSeries s2 = new XYSeries("Series 2", true, false);
        s2.add(5.0, 5.0);
        s2.add(10.0, 15.5);
        s2.add(15.0, 9.5);
        s2.add(20.0, 3.5);
        dataset.addSeries(s2);
        XYPlot plot = new XYPlot(dataset, 
                new NumberAxis("X"), new NumberAxis("Y"), 
                new XYAreaRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
项目:parabuild-ci    文件:StackedXYAreaRendererTests.java   
/**
 * A test for bug 1593156.
 */
public void testBug1593156() {
    boolean success = false;
    try {
        DefaultTableXYDataset dataset = new DefaultTableXYDataset();

        XYSeries s1 = new XYSeries("Series 1", true, false);
        s1.add(5.0, 5.0);
        s1.add(10.0, 15.5);
        s1.add(15.0, 9.5);
        s1.add(20.0, 7.5);
        dataset.addSeries(s1);

        XYSeries s2 = new XYSeries("Series 2", true, false);
        s2.add(5.0, 5.0);
        s2.add(10.0, 15.5);
        s2.add(15.0, 9.5);
        s2.add(20.0, 3.5);
        dataset.addSeries(s2);
        StackedXYAreaRenderer renderer = new StackedXYAreaRenderer(
                XYAreaRenderer.LINES);
        XYPlot plot = new XYPlot(dataset, 
                new NumberAxis("X"), new NumberAxis("Y"), 
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
项目:jasperreports    文件:EyeCandySixtiesChartTheme.java   
@Override
protected JFreeChart createXyAreaChart() throws JRException
{
    JFreeChart jfreeChart = super.createXyAreaChart();

    XYPlot xyPlot = (XYPlot)jfreeChart.getPlot();
    SquareXYAreaRenderer squareXyAreaRenderer = new SquareXYAreaRenderer((XYAreaRenderer)xyPlot.getRenderer());
    xyPlot.setRenderer(squareXyAreaRenderer);

    return jfreeChart;
}
项目:openreports    文件:ChartReportEngine.java   
private JFreeChart createTimeAreaChart(ReportChart reportChart, ChartValue[] values, boolean displayInline)
{
    XYDataset dataset = createTimeDataset(values);

    ValueAxis timeAxis = new DateAxis(reportChart.getXAxisLabel());
    NumberAxis valueAxis = new NumberAxis(reportChart.getYAxisLabel());

    XYAreaRenderer renderer = new XYAreaRenderer();
    renderer.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());

    if (reportChart.getDrillDownReport() != null)
    {
        renderer.setURLGenerator(new TimeSeriesURLGenerator(
                "executeReport.action?displayInline=" + displayInline
                        + "&exportType=0&reportId="
                        + reportChart.getDrillDownReport().getId(), "series",
                ReportChart.DRILLDOWN_PARAMETER));
    }

    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
    plot.setOrientation(PlotOrientation.VERTICAL);

    if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL)
    {
        plot.setOrientation(PlotOrientation.HORIZONTAL);
    }

    JFreeChart chart = new JFreeChart(reportChart.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());

    return chart;
}
项目:openreports    文件:ChartReportEngine.java   
private JFreeChart createXYAreaChart(ReportChart reportChart, ChartValue[] values, boolean displayInline)
{
    XYDataset dataset = createXYDataset(values);

    NumberAxis xAxis = new NumberAxis(reportChart.getXAxisLabel());
    xAxis.setAutoRangeIncludesZero(false);

    NumberAxis yAxis = new NumberAxis(reportChart.getYAxisLabel());

    XYAreaRenderer renderer = new XYAreaRenderer();
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());

    if (reportChart.getDrillDownReport() != null)
    {
        renderer.setURLGenerator(new XYURLGenerator(
                "executeReport.action?displayInline=" + displayInline
                        + "&exportType=0&reportId="
                        + reportChart.getDrillDownReport().getId(), "series",
                ReportChart.DRILLDOWN_PARAMETER));
    }

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setForegroundAlpha(0.5F);
    plot.setOrientation(PlotOrientation.VERTICAL);

    if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL)
    {
        plot.setOrientation(PlotOrientation.HORIZONTAL);
    }

    JFreeChart chart = new JFreeChart(reportChart.getTitle(),
            JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());

    return chart;
}
项目:hiketools    文件:Profile.java   
private static JFreeChart createChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createXYAreaChart(
        null,  // chart title
        null,                       // domain axis label
        null,                       // range axis label
        dataset,                         // data
        PlotOrientation.VERTICAL,        // the plot orientation
        false,                            // legend
        false,                            // tooltips
        false                            // urls
    );
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis axis = (NumberAxis)plot.getRangeAxis();
    axis.setAutoRangeIncludesZero(false);
    DecimalFormatSymbols syms = new DecimalFormatSymbols();
    syms.setGroupingSeparator('\'');
    syms.setDecimalSeparator('.');
    DecimalFormat format = new DecimalFormat("#,##0'm'");
    format.setDecimalFormatSymbols(syms);
    axis.setNumberFormatOverride(format);
    axis = (NumberAxis)plot.getDomainAxis();
    format = new DecimalFormat("#,##0.#'km'");
    format.setDecimalFormatSymbols(syms);
    axis.setNumberFormatOverride(format);
    XYAreaRenderer renderer = (XYAreaRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, Color.BLUE);
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.BLACK);
    plot.setRangeGridlinePaint(Color.BLACK);
    plot.setInsets(RectangleInsets.ZERO_INSETS);
    plot.setOutlineVisible(false);
    return chart;
}
项目:nabs    文件:XYAreaRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    XYAreaRenderer r1 = new XYAreaRenderer();
    XYAreaRenderer r2 = new XYAreaRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:nabs    文件:XYAreaRendererTests.java   
/**
 * Draws the chart with a <code>null</code> info object to make sure that 
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultTableXYDataset dataset = new DefaultTableXYDataset();

        XYSeries s1 = new XYSeries("Series 1", true, false);
        s1.add(5.0, 5.0);
        s1.add(10.0, 15.5);
        s1.add(15.0, 9.5);
        s1.add(20.0, 7.5);
        dataset.addSeries(s1);

        XYSeries s2 = new XYSeries("Series 2", true, false);
        s2.add(5.0, 5.0);
        s2.add(10.0, 15.5);
        s2.add(15.0, 9.5);
        s2.add(20.0, 3.5);
        dataset.addSeries(s2);
        XYPlot plot = new XYPlot(dataset, 
                new NumberAxis("X"), new NumberAxis("Y"), 
                new XYAreaRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
项目:nabs    文件:StackedXYAreaRendererTests.java   
/**
 * A test for bug 1593156.
 */
public void testBug1593156() {
    boolean success = false;
    try {
        DefaultTableXYDataset dataset = new DefaultTableXYDataset();

        XYSeries s1 = new XYSeries("Series 1", true, false);
        s1.add(5.0, 5.0);
        s1.add(10.0, 15.5);
        s1.add(15.0, 9.5);
        s1.add(20.0, 7.5);
        dataset.addSeries(s1);

        XYSeries s2 = new XYSeries("Series 2", true, false);
        s2.add(5.0, 5.0);
        s2.add(10.0, 15.5);
        s2.add(15.0, 9.5);
        s2.add(20.0, 3.5);
        dataset.addSeries(s2);
        StackedXYAreaRenderer renderer = new StackedXYAreaRenderer(
                XYAreaRenderer.LINES);
        XYPlot plot = new XYPlot(dataset, 
                new NumberAxis("X"), new NumberAxis("Y"), 
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
项目:astor    文件:XYAreaRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashcode() {
    XYAreaRenderer r1 = new XYAreaRenderer();
    XYAreaRenderer r2 = new XYAreaRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:astor    文件:XYAreaRendererTests.java   
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultTableXYDataset dataset = new DefaultTableXYDataset();

        XYSeries s1 = new XYSeries("Series 1", true, false);
        s1.add(5.0, 5.0);
        s1.add(10.0, 15.5);
        s1.add(15.0, 9.5);
        s1.add(20.0, 7.5);
        dataset.addSeries(s1);

        XYSeries s2 = new XYSeries("Series 2", true, false);
        s2.add(5.0, 5.0);
        s2.add(10.0, 15.5);
        s2.add(15.0, 9.5);
        s2.add(20.0, 3.5);
        dataset.addSeries(s2);
        XYPlot plot = new XYPlot(dataset,
                new NumberAxis("X"), new NumberAxis("Y"),
                new XYAreaRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
项目:astor    文件:XYAreaRendererTests.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
public void testGetLegendItemSeriesIndex() {
    XYSeriesCollection d1 = new XYSeriesCollection();
    XYSeries s1 = new XYSeries("S1");
    s1.add(1.0, 1.1);
    XYSeries s2 = new XYSeries("S2");
    s2.add(1.0, 1.1);
    d1.addSeries(s1);
    d1.addSeries(s2);

    XYSeriesCollection d2 = new XYSeriesCollection();
    XYSeries s3 = new XYSeries("S3");
    s3.add(1.0, 1.1);
    XYSeries s4 = new XYSeries("S4");
    s4.add(1.0, 1.1);
    XYSeries s5 = new XYSeries("S5");
    s5.add(1.0, 1.1);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    XYAreaRenderer r = new XYAreaRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:astor    文件:StackedXYAreaRendererTests.java   
/**
 * A test for bug 1593156.
 */
public void testBug1593156() {
    boolean success = false;
    try {
        DefaultTableXYDataset dataset = new DefaultTableXYDataset();

        XYSeries s1 = new XYSeries("Series 1", true, false);
        s1.add(5.0, 5.0);
        s1.add(10.0, 15.5);
        s1.add(15.0, 9.5);
        s1.add(20.0, 7.5);
        dataset.addSeries(s1);

        XYSeries s2 = new XYSeries("Series 2", true, false);
        s2.add(5.0, 5.0);
        s2.add(10.0, 15.5);
        s2.add(15.0, 9.5);
        s2.add(20.0, 3.5);
        dataset.addSeries(s2);
        StackedXYAreaRenderer renderer = new StackedXYAreaRenderer(
                XYAreaRenderer.LINES);
        XYPlot plot = new XYPlot(dataset,
                new NumberAxis("X"), new NumberAxis("Y"),
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
项目:conqat    文件:AreaChartCreator.java   
/** {@inheritDoc} */
@Override
protected JFreeChart createChart() {
    JFreeChart chart = super.createChart();

    XYPlot plot = chart.getXYPlot();
    plot.setRenderer(new XYAreaRenderer(XYAreaRenderer.AREA));

    ValueAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);

    return chart;
}
项目:jrunalyzer    文件:MapProfilePlugin.java   
private static DatasetConfig createElevationConfig() {
    DatasetConfig config = new DatasetConfigDelegate(
            new DefaultDatasetConfig.Builder(0)
                    .description(
                            getText("com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.elevation")) //$NON-NLS-1$
                    .yFunc(createElevationFunction())
                    .renderer(
                            rendererColor(new XYAreaRenderer(
                                    XYAreaRenderer.AREA), Color.lightGray
                                    .darker())).build()) {

        @Override
        public NumberAxis createNumberAxis(Track track) {
            NumberAxis axis = super.createNumberAxis(track);
            axis.setAutoRangeIncludesZero(false);
            WayPoint maxEle = track.getStatistics().getMaxElevation();
            WayPoint minEle = track.getStatistics().getMinElevation();
            if (maxEle != null && maxEle.getElevation() != null
                    && minEle != null && minEle.getElevation() != null) {
                int max = maxEle.getElevation().intValue();
                int min = minEle.getElevation().intValue();
                int add = (int) (((double) (max - min)) / 3);
                axis.setRange(new Range((double) min - add, (double) max
                        + add));
            }
            return axis;
        }

    };
    return new StrokeRendererConfigDecorator(
            new MovingAverageConfigDecorator(config,
                    "", MOVING_AVG_VALUE, MOVING_AVG_SKIP), //$NON-NLS-1$
            new BasicStroke(2));
}
项目:openreportsv2    文件:ChartReportEngine.java   
private JFreeChart createTimeAreaChart(ReportChart reportChart, ChartValue[] values, boolean displayInline)
{
    XYDataset dataset = createTimeDataset(values);

    ValueAxis timeAxis = new DateAxis(reportChart.getXAxisLabel());
    NumberAxis valueAxis = new NumberAxis(reportChart.getYAxisLabel());

    XYAreaRenderer renderer = new XYAreaRenderer();
       renderer.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());

       if (reportChart.getDrillDownReport() != null)
    {
        renderer.setURLGenerator(new TimeSeriesURLGenerator(
                "executeReport.action?displayInline=" + displayInline
                        + "&exportType=0&reportId="
                        + reportChart.getDrillDownReport().getId(), "series",
                ReportChart.DRILLDOWN_PARAMETER));
    }       

    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);      
    plot.setOrientation(PlotOrientation.VERTICAL);

    if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL)
    {
        plot.setOrientation(PlotOrientation.HORIZONTAL);
    }

    JFreeChart chart = new JFreeChart(reportChart.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());

    return chart;
}
项目:openreportsv2    文件:ChartReportEngine.java   
private JFreeChart createXYAreaChart(ReportChart reportChart, ChartValue[] values, boolean displayInline)
{
    XYDataset dataset = createXYDataset(values);

    NumberAxis xAxis = new NumberAxis(reportChart.getXAxisLabel());
    xAxis.setAutoRangeIncludesZero(false);

    NumberAxis yAxis = new NumberAxis(reportChart.getYAxisLabel());

    XYAreaRenderer renderer = new XYAreaRenderer();
       renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());

       if (reportChart.getDrillDownReport() != null)
    {
        renderer.setURLGenerator(new XYURLGenerator(
                "executeReport.action?displayInline=" + displayInline
                        + "&exportType=0&reportId="
                        + reportChart.getDrillDownReport().getId(), "series",
                ReportChart.DRILLDOWN_PARAMETER));
    }       

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setForegroundAlpha(0.5F);
    plot.setOrientation(PlotOrientation.VERTICAL);

    if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL)
    {
        plot.setOrientation(PlotOrientation.HORIZONTAL);
    }

    JFreeChart chart = new JFreeChart(reportChart.getTitle(),
            JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());

    return chart;
}
项目:dynamicreports-jasper    文件:XyAreaChartTest.java   
@Override
public void test() {
    super.test();

    numberOfPagesTest(1);

    JFreeChart chart = getChart("summary.chart1", 0);
    Axis axis = chart.getXYPlot().getDomainAxis();
    XYPlot plot = chart.getXYPlot();
    Assert.assertEquals("renderer", XYAreaRenderer.class, plot.getRenderer().getClass());
    Assert.assertEquals("category label", "category", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

    chart = getChart("summary.chart2", 0);
    axis = chart.getXYPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
}
项目:parabuild-ci    文件:XYAreaRendererTests.java   
/**
 * Problem that the equals(...) method distinguishes all fields.
 */
public void testEquals() {
    XYAreaRenderer r1 = new XYAreaRenderer();
    XYAreaRenderer r2 = new XYAreaRenderer();
    assertEquals(r1, r2);
}
项目:jasperreports    文件:EyeCandySixtiesChartTheme.java   
public SquareXYAreaRenderer(XYAreaRenderer parent)
{
    super(XYAreaRenderer.AREA, parent.getBaseToolTipGenerator(), parent.getURLGenerator());
}
项目:astor    文件:XYAreaRendererTests.java   
/**
 * Verify that this class implements {@link PublicCloneable}.
 */
public void testPublicCloneable() {
    XYAreaRenderer r1 = new XYAreaRenderer();
    assertTrue(r1 instanceof PublicCloneable);
}
项目:jClipCorn    文件:StatisticsSeriesViewedChart.java   
@Override
protected JFreeChart createChart(CCMovieList movielist, StatisticsTypeFilter source) {
    if (chart != null) return chart;

    indexMap = new HashMap<>();
    datasetList = new HashMap<>();

    DateAxis dateAxis = new DateAxis(""); //$NON-NLS-1$

    DateFormat chartFormatter = new SimpleDateFormat("dd.MM.yyyy"); //$NON-NLS-1$
    dateAxis.setDateFormatOverride(chartFormatter);

    valueAxis = new NumberAxis(""); //$NON-NLS-1$
    valueAxis.setRange(0, 35);

    plot = new XYPlot(new DefaultXYDataset(), dateAxis, valueAxis, new StandardXYItemRenderer(StandardXYItemRenderer.LINES, null, null));

    List<TupleSeriesEpList> serieslist = getIncludedSeries(movielist);
    CCDate startdate = GetStartDate(serieslist);
    CCDate enddate = GetEndDate(serieslist);

    int idx = 0;
    for (TupleSeriesEpList series : serieslist) {
        indexMap.put(series.series, idx);

        Color cf = new Color(StatisticsHelper.CHART_COLORS[idx % StatisticsHelper.CHART_COLORS.length]);
        Color ca = new Color(cf.getRed(), cf.getGreen(), cf.getBlue(), 178);

        XYDataset dataset = getDataSet(series, startdate, enddate, false);
        XYDataset startset = getDataSet(series, startdate, enddate, true);

        datasetList.put(3*idx, dataset);
        plot.setDataset(3*idx, dataset);
        plot.setRenderer(3*idx, new XYAreaRenderer(XYAreaRenderer.AREA, null, null));
        plot.getRenderer(3*idx).setSeriesPaint(0, ca);
        plot.getRenderer(3*idx).setSeriesVisibleInLegend(0, false);

        datasetList.put(3*idx + 1, dataset);
        plot.setDataset(3*idx + 1, dataset);
        plot.setRenderer(3*idx + 1, new StandardXYItemRenderer(StandardXYItemRenderer.LINES, null, null));
        plot.getRenderer(3*idx + 1).setSeriesPaint(0, cf);
        plot.getRenderer(3*idx + 1).setSeriesVisibleInLegend(0, false);

        datasetList.put(3*idx + 2, startset);
        plot.setDataset( 3*idx + 2, startset);
        plot.setRenderer(3*idx + 2, new StandardXYItemRenderer(StandardXYItemRenderer.LINES, null, null));
        plot.getRenderer(3*idx + 2).setSeriesPaint(0, cf);
        plot.getRenderer(3*idx + 2).setSeriesVisibleInLegend(0, false);
        plot.getRenderer(3*idx + 2).setBaseItemLabelGenerator(new StandardXYItemLabelGenerator("{0}")); //$NON-NLS-1$
        plot.getRenderer(3*idx + 2).setBaseItemLabelPaint(cf);
        plot.getRenderer(3*idx + 2).setBaseItemLabelsVisible(true);
        plot.getRenderer(3*idx + 2).setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, -45));
        plot.getRenderer(3*idx + 2).setSeriesItemLabelsVisible(0, true);

        idx++;
    }

       domainTotalRangeMin = startdate.asMilliseconds();
       domainTotalRangeMax = enddate.asMilliseconds();

       if (domainTotalRangeMin == domainTotalRangeMax) domainTotalRangeMax++;

    plot.setBackgroundPaint(XYBACKGROUND_COLOR);
    plot.setDomainGridlinePaint(GRIDLINECOLOR);
    plot.setRangeGridlinePaint(GRIDLINECOLOR);

    chart = new JFreeChart(plot);
    //chart.removeLegend();

    chart.setBackgroundPaint(null);
    plot.getDomainAxis().setTickLabelPaint(TEXT_FOREGROUND);
    plot.getRangeAxis().setTickLabelPaint(TEXT_FOREGROUND);
    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    domainAxis = plot.getDomainAxis();

    return chart;
}
项目:jClipCorn    文件:StatisticsFormatOverTimeChart.java   
@Override
protected JFreeChart createChart(CCMovieList movielist, StatisticsTypeFilter source) {
    DateAxis dateAxis = new DateAxis(""); //$NON-NLS-1$

    DateFormat chartFormatter = new SimpleDateFormat("dd.MM.yyyy"); //$NON-NLS-1$
    dateAxis.setDateFormatOverride(chartFormatter);

    NumberAxis valueAxis = new NumberAxis(""); //$NON-NLS-1$

    XYPlot plot = new XYPlot(new DefaultXYDataset(), dateAxis, valueAxis, new StandardXYItemRenderer(StandardXYItemRenderer.LINES, null, null));

    List<DefaultXYDataset> datasets = getDataSet(movielist, source);
    LegendItemCollection coll = new LegendItemCollection();
    for (int idx = 0; idx < datasets.size(); idx++) {
        Color cf = new Color(StatisticsHelper.CHART_COLORS[idx % StatisticsHelper.CHART_COLORS.length]);
        Color ca = new Color(cf.getRed(), cf.getGreen(), cf.getBlue(), 50);

        plot.setDataset( 2*idx+0, datasets.get(idx));
        plot.setRenderer(2*idx+0, new XYAreaRenderer(XYAreaRenderer.AREA, null, null));
        plot.getRenderer(2*idx+0).setSeriesPaint(0, ca);
        plot.getRenderer(2*idx+0).setSeriesVisibleInLegend(0, false);

        plot.setDataset( 2*idx+1, datasets.get(idx));
        plot.setRenderer(2*idx+1, new StandardXYItemRenderer(StandardXYItemRenderer.LINES, null, null));
        plot.getRenderer(2*idx+1).setSeriesPaint(0, cf);
        plot.getRenderer(2*idx+1).setSeriesVisibleInLegend(0, true);
        plot.getRenderer(2*idx+1).setSeriesShape(0, ShapeUtilities.createDiamond(5));

        coll.add(new LegendItem(datasets.get(idx).getSeriesKey(0).toString(), "", "", "", ShapeUtilities.createDiamond(5), cf)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

    plot.setFixedLegendItems(coll);

    plot.setBackgroundPaint(XYBACKGROUND_COLOR);
    plot.setDomainGridlinePaint(GRIDLINECOLOR);
    plot.setRangeGridlinePaint(GRIDLINECOLOR);


    JFreeChart chart = new JFreeChart(plot);

    chart.setBackgroundPaint(null);
    plot.getDomainAxis().setTickLabelPaint(TEXT_FOREGROUND);
    plot.getRangeAxis().setTickLabelPaint(TEXT_FOREGROUND);

    plot.getDomainAxis().setLabel(LocaleBundle.getString("StatisticsFrame.chartAxis.Date")); //$NON-NLS-1$

    plot.getRangeAxis().setLabelPaint(TEXT_FOREGROUND);
    plot.getDomainAxis().setLabelPaint(TEXT_FOREGROUND);

    plot.getRangeAxis().setAutoRange(true);

    domainAxis = plot.getDomainAxis();

    return chart;
}
项目:jClipCorn    文件:StatisticsQualityOverTimeChart.java   
@Override
protected JFreeChart createChart(CCMovieList movielist, StatisticsTypeFilter source) {
    DateAxis dateAxis = new DateAxis(""); //$NON-NLS-1$

    DateFormat chartFormatter = new SimpleDateFormat("dd.MM.yyyy"); //$NON-NLS-1$
    dateAxis.setDateFormatOverride(chartFormatter);

    NumberAxis valueAxis = new NumberAxis(""); //$NON-NLS-1$

    XYPlot plot = new XYPlot(new DefaultXYDataset(), dateAxis, valueAxis, new StandardXYItemRenderer(StandardXYItemRenderer.LINES, null, null));

    List<DefaultXYDataset> datasets = getDataSet(movielist, source);
    LegendItemCollection coll = new LegendItemCollection();
    for (int idx = 0; idx < datasets.size(); idx++) {
        Color cf = new Color(StatisticsHelper.CHART_COLORS[idx % StatisticsHelper.CHART_COLORS.length]);
        Color ca = new Color(cf.getRed(), cf.getGreen(), cf.getBlue(), 50);

        plot.setDataset( 2*idx+0, datasets.get(idx));
        plot.setRenderer(2*idx+0, new XYAreaRenderer(XYAreaRenderer.AREA, null, null));
        plot.getRenderer(2*idx+0).setSeriesPaint(0, ca);
        plot.getRenderer(2*idx+0).setSeriesVisibleInLegend(0, false);

        plot.setDataset( 2*idx+1, datasets.get(idx));
        plot.setRenderer(2*idx+1, new StandardXYItemRenderer(StandardXYItemRenderer.LINES, null, null));
        plot.getRenderer(2*idx+1).setSeriesPaint(0, cf);
        plot.getRenderer(2*idx+1).setSeriesVisibleInLegend(0, true);
        plot.getRenderer(2*idx+1).setSeriesShape(0, ShapeUtilities.createDiamond(5));

        coll.add(new LegendItem(datasets.get(idx).getSeriesKey(0).toString(), "", "", "", ShapeUtilities.createDiamond(5), cf)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

    plot.setFixedLegendItems(coll);

    plot.setBackgroundPaint(XYBACKGROUND_COLOR);
    plot.setDomainGridlinePaint(GRIDLINECOLOR);
    plot.setRangeGridlinePaint(GRIDLINECOLOR);


    JFreeChart chart = new JFreeChart(plot);

    chart.setBackgroundPaint(null);
    plot.getDomainAxis().setTickLabelPaint(TEXT_FOREGROUND);
    plot.getRangeAxis().setTickLabelPaint(TEXT_FOREGROUND);

    plot.getDomainAxis().setLabel(LocaleBundle.getString("StatisticsFrame.chartAxis.Date")); //$NON-NLS-1$

    plot.getRangeAxis().setLabelPaint(TEXT_FOREGROUND);
    plot.getDomainAxis().setLabelPaint(TEXT_FOREGROUND);

    plot.getRangeAxis().setAutoRange(true);

    domainAxis = plot.getDomainAxis();

    return chart;
}