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


Java WaterfallBarRenderer类代码示例

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


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

示例1: testEquals

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
/**
 * Problem that the equals(...) method distinguishes all fields.
 */
public void testEquals() {
    WaterfallBarRenderer r1 = new WaterfallBarRenderer();
    WaterfallBarRenderer r2 = new WaterfallBarRenderer();
    assertEquals(r1, r2);
            
    // firstBarPaint;
    r1.setFirstBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setFirstBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));
    
    // lastBarPaint;
    r1.setLastBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setLastBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

    // positiveBarPaint;
    r1.setPositiveBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setPositiveBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

    //private Paint negativeBarPaint;
    r1.setNegativeBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setNegativeBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:WaterfallBarRendererTests.java

示例2: testHashcode

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    WaterfallBarRenderer r1 = new WaterfallBarRenderer();
    WaterfallBarRenderer r2 = new WaterfallBarRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:WaterfallBarRendererTests.java

示例3: testEquals

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    WaterfallBarRenderer r1 = new WaterfallBarRenderer();
    WaterfallBarRenderer r2 = new WaterfallBarRenderer();
    assertEquals(r1, r2);
            
    // firstBarPaint;
    r1.setFirstBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setFirstBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));
    
    // lastBarPaint;
    r1.setLastBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setLastBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

    // positiveBarPaint;
    r1.setPositiveBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setPositiveBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

    //private Paint negativeBarPaint;
    r1.setNegativeBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setNegativeBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:WaterfallBarRendererTests.java

示例4: testEquals

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    WaterfallBarRenderer r1 = new WaterfallBarRenderer();
    WaterfallBarRenderer r2 = new WaterfallBarRenderer();
    assertEquals(r1, r2);

    // firstBarPaint;
    r1.setFirstBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setFirstBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

    // lastBarPaint;
    r1.setLastBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setLastBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

    // positiveBarPaint;
    r1.setPositiveBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setPositiveBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

    //private Paint negativeBarPaint;
    r1.setNegativeBarPaint(Color.cyan);
    assertFalse(r1.equals(r2));
    r2.setNegativeBarPaint(Color.cyan);
    assertTrue(r1.equals(r2));

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

示例5: testHashcode

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashcode() {
    WaterfallBarRenderer r1 = new WaterfallBarRenderer();
    WaterfallBarRenderer r2 = new WaterfallBarRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:WaterfallBarRendererTests.java

示例6: createWaterfallChart

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
/**
 * Creates a waterfall chart.  The chart object returned by this method
 * uses a {@link CategoryPlot} instance as the plot, with a
 * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
 * range axis, and a {@link WaterfallBarRenderer} as the renderer.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param categoryAxisLabel  the label for the category axis
 *                           (<code>null</code> permitted).
 * @param valueAxisLabel  the label for the value 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 A waterfall chart.
 */
public static JFreeChart createWaterfallChart(String title,
        String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset, boolean legend) {

    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    categoryAxis.setCategoryMargin(0.0);
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    WaterfallBarRenderer renderer = new WaterfallBarRenderer();
    ItemLabelPosition position = new ItemLabelPosition(
            ItemLabelAnchor.CENTER, TextAnchor.CENTER,
            TextAnchor.CENTER, 0.0);
    renderer.setBasePositiveItemLabelPosition(position);
    renderer.setBaseNegativeItemLabelPosition(position);
    StandardCategoryToolTipGenerator generator
            = new StandardCategoryToolTipGenerator();
    renderer.setBaseToolTipGenerator(generator);
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
            renderer);
    plot.clearRangeMarkers();
    Marker baseline = new ValueMarker(0.0);
    baseline.setPaint(Color.black);
    plot.addRangeMarker(baseline, Layer.FOREGROUND);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

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

示例7: test

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
@Override
public void test() {
	super.test();

	numberOfPagesTest(1);

	JFreeChart chart = getChart("summary.chart1", 0);
	CategoryPlot categoryPlot = chart.getCategoryPlot();
	Assert.assertEquals("renderer", WaterfallBarRenderer.class, categoryPlot.getRenderer().getClass());
	Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible());
	Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible());
	Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible());

	chart = getChart("summary.chart2", 0);
	Axis axis = chart.getCategoryPlot().getDomainAxis();
	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());
	CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions().getLabelPosition(RectangleEdge.LEFT);
	Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle());
	Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

	chart = getChart("summary.chart3", 0);
	axis = chart.getCategoryPlot().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());
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:37,代码来源:WaterfallBarChartTest.java

示例8: testFindRangeBounds

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
/**
 * Some tests for the findRangeBounds() method.
 */
public void testFindRangeBounds() {
    WaterfallBarRenderer r = new WaterfallBarRenderer();
    assertNull(r.findRangeBounds(null));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:WaterfallBarRendererTests.java

示例9: testPublicCloneable

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
/**
 * Check that this class implements PublicCloneable.
 */
public void testPublicCloneable() {
    WaterfallBarRenderer r1 = new WaterfallBarRenderer();
    assertTrue(r1 instanceof PublicCloneable);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:WaterfallBarRendererTests.java

示例10: customize

import org.jfree.chart.renderer.category.WaterfallBarRenderer; //导入依赖的package包/类
@Override
public void customize(JFreeChart chart, ReportParameters reportParameters) {
	BarRenderer categoryRenderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
	WaterfallBarRenderer renderer = new WaterfallBarRenderer();

   renderer.setBaseItemLabelsVisible(categoryRenderer.getBaseItemLabelsVisible());
   renderer.setBaseItemLabelFont(categoryRenderer.getBaseItemLabelFont());
   renderer.setBaseItemLabelPaint(categoryRenderer.getBaseItemLabelPaint());
   renderer.setBaseItemLabelGenerator(categoryRenderer.getBaseItemLabelGenerator());
	renderer.setShadowVisible(categoryRenderer.getShadowsVisible());
	CategoryDataset categoryDataset = chart.getCategoryPlot().getDataset();
	if(categoryDataset != null)	{
		for(int i = 0; i < categoryDataset.getRowCount(); i++) {
			Paint seriesOutlinePaint = categoryRenderer.getSeriesOutlinePaint(i);
			if (seriesOutlinePaint != null) {
				renderer.setSeriesOutlinePaint(i, seriesOutlinePaint);
			}
			Paint seriesPaint = categoryRenderer.getSeriesPaint(i);
			if (seriesPaint != null) {
				renderer.setSeriesPaint(i, seriesPaint);
			}
		}
	}
	renderer.setItemMargin(categoryRenderer.getItemMargin());
	GradientPaintTransformer gradientPaintTransformer = categoryRenderer.getGradientPaintTransformer();
	if (gradientPaintTransformer != null) {
		renderer.setGradientPaintTransformer(gradientPaintTransformer);
	}

	if (firstBarPaint != null) {
		renderer.setFirstBarPaint(firstBarPaint);
	}
	if (lastBarPaint != null) {
		renderer.setLastBarPaint(lastBarPaint);
	}
	if (positiveBarPaint != null) {
		renderer.setPositiveBarPaint(positiveBarPaint);
	}
	if (negativeBarPaint != null) {
		renderer.setNegativeBarPaint(negativeBarPaint);
	}

   chart.getCategoryPlot().setRenderer(renderer);
 }
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:45,代码来源:WaterfallBarRendererCustomizer.java


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