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

项目:parabuild-ci    文件:CategoryLabelWidthTypeTests.java   
/**
 * Confirm that the equals() method distinguishes the known values.
 */
public void testEquals() {
    assertEquals(
        CategoryLabelWidthType.CATEGORY, CategoryLabelWidthType.CATEGORY
    );
    assertEquals(
        CategoryLabelWidthType.RANGE, CategoryLabelWidthType.RANGE
    );
}
项目:parabuild-ci    文件:CategoryLabelWidthTypeTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    CategoryLabelWidthType a1 = CategoryLabelWidthType.CATEGORY;
    CategoryLabelWidthType a2 = CategoryLabelWidthType.CATEGORY;
    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    文件:CategoryLabelWidthTypeTests.java   
/**
 * Confirm that the equals() method distinguishes the known values.
 */
public void testEquals() {
    assertEquals(
        CategoryLabelWidthType.CATEGORY, CategoryLabelWidthType.CATEGORY
    );
    assertEquals(
        CategoryLabelWidthType.RANGE, CategoryLabelWidthType.RANGE
    );
}
项目:nabs    文件:CategoryLabelWidthTypeTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    CategoryLabelWidthType a1 = CategoryLabelWidthType.CATEGORY;
    CategoryLabelWidthType a2 = CategoryLabelWidthType.CATEGORY;
    assertTrue(a1.equals(a2));
    int h1 = a1.hashCode();
    int h2 = a2.hashCode();
    assertEquals(h1, h2);
}
项目:astor    文件:CategoryLabelWidthTypeTests.java   
/**
 * Confirm that the equals() method distinguishes the known values.
 */
public void testEquals() {
    assertEquals(CategoryLabelWidthType.CATEGORY,
            CategoryLabelWidthType.CATEGORY);
    assertEquals(CategoryLabelWidthType.RANGE,
            CategoryLabelWidthType.RANGE);
}
项目:astor    文件:CategoryLabelWidthTypeTests.java   
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashCode() {
    CategoryLabelWidthType a1 = CategoryLabelWidthType.CATEGORY;
    CategoryLabelWidthType a2 = CategoryLabelWidthType.CATEGORY;
    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;

}
项目:parabuild-ci    文件:CategoryLabelWidthTypeTests.java   
/**
 * Problem equals method.
 */
public void testEquals() {
    assertEquals(CategoryLabelWidthType.CATEGORY, CategoryLabelWidthType.CATEGORY);
    assertEquals(CategoryLabelWidthType.RANGE, CategoryLabelWidthType.RANGE);
}
项目: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;
}