Java 类org.jfree.chart.axis.CategoryLabelPosition 实例源码

项目:parabuild-ci    文件:CategoryLabelPositionsTests.java   
/**
 * 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);
}
项目:parabuild-ci    文件:CategoryLabelPositionsTests.java   
/**
 * 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);
}
项目:nabs    文件:CategoryLabelPositionsTests.java   
/**
 * 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);
}
项目:astor    文件:CategoryLabelPositionsTests.java   
/**
 * 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);
}
项目:parabuild-ci    文件:CategoryLabelPositionTests.java   
/**
 * Problem equals method.
 */
public void testEquals() {
    CategoryLabelPosition p1 = new CategoryLabelPosition();
    CategoryLabelPosition p2 = new CategoryLabelPosition();
    assertTrue(p1.equals(p2));
    assertTrue(p2.equals(p1));
}
项目:parabuild-ci    文件:CategoryLabelPositionTests.java   
/**
 * 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);
}
项目:HTML5_WebSite    文件:BarChart3DDemo2.java   
/**
   * 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;        

  }
项目:nabs    文件:CategoryLabelPositionTests.java   
/**
 * 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);
}
项目:astor    文件:CategoryLabelPositionTests.java   
/**
 * 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);
}
项目:DEM    文件:BarChartPanel.java   
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;
}
项目:pfc-jose    文件:BarChart3DDemo2.java   
/**
 * 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;

}
项目:pfc-jose    文件:BarChart3DDemo2.java   
/**
 * 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;

}
项目:dynamicreports-jasper    文件:AreaChartTest.java   
@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());
}
项目:dynamicreports-jasper    文件:StackedAreaChartTest.java   
@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());
}
项目:dynamicreports-jasper    文件:GanttChartTest.java   
@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());
}
项目:dynamicreports-jasper    文件:StackedBar3DChartTest.java   
@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());
}
项目:dynamicreports-jasper    文件:Bar3DChartTest.java   
@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());
}
项目:dynamicreports-jasper    文件:WaterfallBarChartTest.java   
@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());
}
项目:dynamicreports-jasper    文件:BarChartTest.java   
@Override
public void test() {
    super.test();

    numberOfPagesTest(1);

    JFreeChart chart = getChart("summary.chart1", 0);
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", BarRenderer.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());
}
项目:dynamicreports-jasper    文件:StackedBarChartTest.java   
@Override
public void test() {
    super.test();

    numberOfPagesTest(1);

    JFreeChart chart = getChart("summary.chart1", 0);
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", StackedBarRenderer.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());
}
项目:dynamicreports-jasper    文件:LineChartTest.java   
@Override
public void test() {
    super.test();

    numberOfPagesTest(1);

    JFreeChart chart = getChart("summary.chart1", 0);
    CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer();
    Assert.assertEquals("renderer", LineAndShapeRenderer.class, renderer.getClass());
    Assert.assertFalse("show shapes", ((LineAndShapeRenderer) renderer).getBaseShapesVisible());
    Assert.assertFalse("show lines", ((LineAndShapeRenderer) renderer).getBaseLinesVisible());

    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());
}
项目:dynamicreports-jasper    文件:GroupedStackedBarChartTest.java   
@Override
public void test() {
    super.test();

    numberOfPagesTest(1);

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

    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());
}
项目:dynamicreports-jasper    文件:LayeredBarChartTest.java   
@Override
public void test() {
    super.test();

    numberOfPagesTest(1);

    JFreeChart chart = getChart("summary.chart1", 0);
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", LayeredBarRenderer.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());
}
项目:fhaes    文件:NumericCategoryAxis.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public List refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, RectangleEdge edge) {

    List ticks = new java.util.ArrayList();

    // sanity check for data area...
    if (dataArea.getHeight() <= 0.0 || dataArea.getWidth() < 0.0)
    {
        return ticks;
    }

    CategoryPlot plot = (CategoryPlot) getPlot();
    List categories = plot.getCategoriesForAxis(this);
    double max = 0.0;

    if (categories != null)
    {
        CategoryLabelPosition position = this.getCategoryLabelPositions().getLabelPosition(edge);
        float r = this.getMaximumCategoryLabelWidthRatio();
        if (r <= 0.0)
        {
            r = position.getWidthRatio();
        }

        float l = 0.0f;
        if (position.getWidthType() == CategoryLabelWidthType.CATEGORY)
        {
            l = (float) calculateCategorySize(categories.size(), dataArea, edge);
        }
        else
        {
            if (RectangleEdge.isLeftOrRight(edge))
            {
                l = (float) dataArea.getWidth();
            }
            else
            {
                l = (float) dataArea.getHeight();
            }
        }
        int categoryIndex = 0;
        Iterator iterator = categories.iterator();
        while (iterator.hasNext())
        {
            Comparable category = (Comparable) iterator.next();

            try
            {
                Integer intcategory = Integer.valueOf(category.toString());

                int modulus = intcategory % labelEveryXCategories;

                if (modulus != 0)
                    category = " ";

            }
            catch (NumberFormatException e)
            {

            }

            TextBlock label = createLabel(category, l * r, edge, g2);
            if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM)
            {
                max = Math.max(max, calculateTextBlockHeight(label, position, g2));
            }
            else if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT)
            {
                max = Math.max(max, calculateTextBlockWidth(label, position, g2));
            }
            Tick tick = new CategoryTick(category, label, position.getLabelAnchor(), position.getRotationAnchor(), position.getAngle());
            ticks.add(tick);
            categoryIndex = categoryIndex + 1;
        }
    }
    state.setMax(max);
    return ticks;
}