当前位置: 首页>>代码示例>>Java>>正文


Java XYAreaRenderer类代码示例

本文整理汇总了Java中org.jfree.chart.renderer.xy.XYAreaRenderer的典型用法代码示例。如果您正苦于以下问题:Java XYAreaRenderer类的具体用法?Java XYAreaRenderer怎么用?Java XYAreaRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XYAreaRenderer类属于org.jfree.chart.renderer.xy包,在下文中一共展示了XYAreaRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createXYAreaChart

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/**
 * 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;

}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:34,代码来源:ChartFactory.java

示例2: createTimeAreaChart

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:27,代码来源:GraphEngine.java

示例3: showChart

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
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;
	}
 
开发者ID:nullbox,项目名称:Data-and-Information-Visualization-Project,代码行数:27,代码来源:ControlsJPanel.java

示例4: testHashcode

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:XYAreaRendererTests.java

示例5: testDrawWithNullInfo

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:XYAreaRendererTests.java

示例6: testBug1593156

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:StackedXYAreaRendererTests.java

示例7: createXyAreaChart

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
@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;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:12,代码来源:EyeCandySixtiesChartTheme.java

示例8: createTimeAreaChart

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
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;
}
 
开发者ID:mtpettyp,项目名称:openreports,代码行数:32,代码来源:ChartReportEngine.java

示例9: createXYAreaChart

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
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;
}
 
开发者ID:mtpettyp,项目名称:openreports,代码行数:36,代码来源:ChartReportEngine.java

示例10: createChart

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
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;
}
 
开发者ID:robbyn,项目名称:hiketools,代码行数:34,代码来源:Profile.java

示例11: testHashcode

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:XYAreaRendererTests.java

示例12: testDrawWithNullInfo

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:37,代码来源:XYAreaRendererTests.java

示例13: testGetLegendItemSeriesIndex

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:35,代码来源:XYAreaRendererTests.java

示例14: testBug1593156

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:38,代码来源:StackedXYAreaRendererTests.java

示例15: createChart

import org.jfree.chart.renderer.xy.XYAreaRenderer; //导入依赖的package包/类
/** {@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;
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:15,代码来源:AreaChartCreator.java


注:本文中的org.jfree.chart.renderer.xy.XYAreaRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。