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


Java CategoryLabelPosition类代码示例

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


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

示例1: testEquals

import org.jfree.chart.axis.CategoryLabelPosition; //导入依赖的package包/类
/**
 * Problem equals method.
 */
public void testEquals() {
    CategoryLabelPositions p1 = new CategoryLabelPositions(
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER) 
    );
    CategoryLabelPositions p2 = new CategoryLabelPositions(
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER) 
    );
    assertEquals(p1, p2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:CategoryLabelPositionsTests.java

示例2: testHashCode

import org.jfree.chart.axis.CategoryLabelPosition; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    CategoryLabelPositions p1 = new CategoryLabelPositions(
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER) 
    );
    CategoryLabelPositions p2 = new CategoryLabelPositions(
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER) 
    );
    assertTrue(p1.equals(p2));
    int h1 = p1.hashCode();
    int h2 = p2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:CategoryLabelPositionsTests.java

示例3: testHashCode

import org.jfree.chart.axis.CategoryLabelPosition; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashCode() {
    CategoryLabelPositions p1 = new CategoryLabelPositions(
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER));
    CategoryLabelPositions p2 = new CategoryLabelPositions(
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER));
    assertTrue(p1.equals(p2));
    int h1 = p1.hashCode();
    int h2 = p2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:CategoryLabelPositionsTests.java

示例4: testEquals

import org.jfree.chart.axis.CategoryLabelPosition; //导入依赖的package包/类
/**
 * Problem equals method.
 */
public void testEquals() {
    CategoryLabelPosition p1 = new CategoryLabelPosition();
    CategoryLabelPosition p2 = new CategoryLabelPosition();
    assertTrue(p1.equals(p2));
    assertTrue(p2.equals(p1));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:10,代码来源:CategoryLabelPositionTests.java

示例5: testHashCode

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

示例6: createChart

import org.jfree.chart.axis.CategoryLabelPosition; //导入依赖的package包/类
/**
   * Creates a chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
      
      JFreeChart chart = ChartFactory.createBarChart3D(
          chartTitle,       // chart title
          domainLabel,                  // domain axis label
          rangeLabel,                     // range axis label
          dataset,                     // data
          PlotOrientation.HORIZONTAL,  // orientation
          !legendPanelOn,                        // include legend
          true,                        // tooltips
          false                        // urls
      );

      CategoryPlot plot = chart.getCategoryPlot();
      plot.setForegroundAlpha(1.0f);

      // left align the category labels...
      CategoryAxis axis = plot.getDomainAxis();
      CategoryLabelPositions p = axis.getCategoryLabelPositions();
      
      CategoryLabelPosition left = new CategoryLabelPosition(
          RectangleAnchor.LEFT, TextBlockAnchor.CENTER_LEFT, 
          TextAnchor.CENTER_LEFT, 0.0,
          CategoryLabelWidthType.RANGE, 0.30f
      );
      axis.setCategoryLabelPositions(CategoryLabelPositions.replaceLeftPosition(p, left));
      
      BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
setCategorySummary(dataset);
      return chart;        
  
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:41,代码来源:BarChart3DDemo2.java

示例7: testHashCode

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

示例8: createChart

import org.jfree.chart.axis.CategoryLabelPosition; //导入依赖的package包/类
private JFreeChart createChart(final CategoryDataset dataset, String str) {
    final JFreeChart chart = ChartFactory.createBarChart3D(
        str,                            // chart title
        "Names",                        // domain axis label
        "Values(%)",                       // range axis label
        dataset,                        // data
        PlotOrientation.HORIZONTAL,     // orientation
        true,                           // include legend
        true,                           // tooltips
        false                           // urls
    );

    
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setForegroundAlpha(1.0f);

    // left align the category labels...
    final CategoryAxis axis = plot.getDomainAxis();
    final CategoryLabelPositions p = axis.getCategoryLabelPositions();

    final CategoryLabelPosition left = new CategoryLabelPosition(
        RectangleAnchor.LEFT, TextBlockAnchor.CENTER_LEFT,
        TextAnchor.CENTER_LEFT, 0.0,
        CategoryLabelWidthType.RANGE, 0.30f
    );
    axis.setCategoryLabelPositions(CategoryLabelPositions.replaceLeftPosition(p, left));

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setRange(from, to);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    return chart;
}
 
开发者ID:CoEIA,项目名称:DEM,代码行数:35,代码来源:BarChartPanel.java

示例9: createChart

import org.jfree.chart.axis.CategoryLabelPosition; //导入依赖的package包/类
/**
 * Creates a chart.
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createBarChart3D(
        "3D Bar Chart Demo 2",       // chart title
        "Category",                  // domain axis label
        "Value",                     // range axis label
        dataset,                     // data
        PlotOrientation.HORIZONTAL,  // orientation
        true,                        // include legend
        true,                        // tooltips
        false                        // urls
    );

    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setForegroundAlpha(1.0f);

    // left align the category labels...
    final CategoryAxis axis = plot.getDomainAxis();
    final CategoryLabelPositions p = axis.getCategoryLabelPositions();

    final CategoryLabelPosition left = new CategoryLabelPosition(
        RectangleAnchor.LEFT, TextBlockAnchor.CENTER_LEFT,
        TextAnchor.CENTER_LEFT, 0.0,
        CategoryLabelWidthType.RANGE, 0.30f
    );
    axis.setCategoryLabelPositions(CategoryLabelPositions.replaceLeftPosition(p, left));

    return chart;

}
 
开发者ID:josejamilena,项目名称:pfc-jose,代码行数:38,代码来源:BarChart3DDemo2.java

示例10: test

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

	numberOfPagesTest(1);

	JFreeChart chart = getChart("summary.chart1", 0);
	Axis axis = chart.getCategoryPlot().getDomainAxis();
	CategoryPlot categoryPlot = chart.getCategoryPlot();
	Assert.assertEquals("renderer", AreaRenderer.class, categoryPlot.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());
	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.chart2", 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,代码行数:32,代码来源:AreaChartTest.java

示例11: test

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

	numberOfPagesTest(1);

	JFreeChart chart = getChart("summary.chart1", 0);
	Axis axis = chart.getCategoryPlot().getDomainAxis();
	CategoryPlot categoryPlot = chart.getCategoryPlot();
	Assert.assertEquals("renderer", StackedAreaRenderer.class, categoryPlot.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());
	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.chart2", 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,代码行数:32,代码来源:StackedAreaChartTest.java

示例12: test

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

	numberOfPagesTest(1);

	JFreeChart chart = getChart("summary.chart1", 0);
	CategoryPlot categoryPlot = chart.getCategoryPlot();
	Assert.assertEquals("renderer", GanttRenderer.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());
	ganttChartDataTest(chart, "label", new String[] {"task1", "task2", "task3"}, new Object[][] {{toDate(2011, 1, 1), toDate(2011, 1, 8), 1d}, {toDate(2011, 1, 10), toDate(2011, 1, 15), 0.5d}, {toDate(2011, 1, 15), toDate(2011, 1, 25), 0.8d}});
	ganttChartDataTest(chart, "serie1", new String[] {"task1", "task2", "task3"}, new Object[][] {{toDate(2011, 1, 2), toDate(2011, 1, 9), null}, {toDate(2011, 1, 8), toDate(2011, 1, 14), null}, {toDate(2011, 1, 16), toDate(2011, 1, 20), null}});

	chart = getChart("summary.chart2", 0);
	Axis axis = chart.getCategoryPlot().getDomainAxis();
	Assert.assertEquals("task label", "task", axis.getLabel());
	Assert.assertEquals("task label color", Color.BLUE, axis.getLabelPaint());
	Assert.assertEquals("task 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("time label", "time", axis.getLabel());
	Assert.assertEquals("time label color", Color.BLUE, axis.getLabelPaint());
	Assert.assertEquals("time 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());
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:36,代码来源:GanttChartTest.java

示例13: test

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

	numberOfPagesTest(1);

	JFreeChart chart = getChart("summary.chart1", 0);
	CategoryPlot categoryPlot = chart.getCategoryPlot();
	Assert.assertEquals("renderer", StackedBarRenderer3D.class, categoryPlot.getRenderer().getClass());
	BarRenderer3D renderer = (BarRenderer3D) categoryPlot.getRenderer();
	Assert.assertTrue("show labels", renderer.getBaseItemLabelsVisible());
	Assert.assertEquals("x offset", 2d, renderer.getXOffset());
	Assert.assertEquals("y offset", 3d, renderer.getYOffset());

	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,代码行数:38,代码来源:StackedBar3DChartTest.java

示例14: test

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

	numberOfPagesTest(1);

	JFreeChart chart = getChart("summary.chart1", 0);
	CategoryPlot categoryPlot = chart.getCategoryPlot();
	Assert.assertEquals("renderer", BarRenderer3D.class, categoryPlot.getRenderer().getClass());
	BarRenderer3D renderer = (BarRenderer3D) categoryPlot.getRenderer();
	Assert.assertTrue("show labels", renderer.getBaseItemLabelsVisible());
	Assert.assertEquals("x offset", 2d, renderer.getXOffset());
	Assert.assertEquals("y offset", 3d, renderer.getYOffset());

	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,代码行数:38,代码来源:Bar3DChartTest.java

示例15: test

import org.jfree.chart.axis.CategoryLabelPosition; //导入依赖的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


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