= this.getCategoryLabelPositions().getLabelPosition(edge); double x0 = 0.0; double x1 = 0.0;
/** * Returns a new instance based on an existing instance but with the left * position changed. * * @param base the base (<code>null</code> not permitted). * @param left the left position (<code>null</code> not permitted). * * @return A new instance (never <code>null</code>). */ public static CategoryLabelPositions replaceLeftPosition( CategoryLabelPositions base, CategoryLabelPosition left) { if (base == null) { throw new IllegalArgumentException("Null 'base' argument."); } if (left == null) { throw new IllegalArgumentException("Null 'left' argument."); } return new CategoryLabelPositions( base.getLabelPosition(RectangleEdge.TOP), base.getLabelPosition(RectangleEdge.BOTTOM), left, base.getLabelPosition(RectangleEdge.RIGHT) ); }
CategoryLabelPosition position = usedCategoryLabelPositions.getLabelPosition(edge); r = getMaximumCategoryLabelWidthRatio(); if(r <= 0.0) setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(0.45D));
private CategoryLabelPositions categoryLabelPosition(String position) { if (position == null) { return CategoryLabelPositions.STANDARD; } else if (position.equals("UP_45")) { return CategoryLabelPositions.UP_45; } else if (position.equals("UP_90")) { return CategoryLabelPositions.UP_90; } else if (position.equals("DOWN_45")) { return CategoryLabelPositions.DOWN_45; } else if (position.equals("DOWN_90")) { return CategoryLabelPositions.DOWN_90; } double angle = Double.parseDouble(position); if (angle>0) { return CategoryLabelPositions.createUpRotationLabelPositions(angle); } else { return CategoryLabelPositions.createDownRotationLabelPositions(-angle); } }
CategoryLabelPositions.createUpRotationLabelPositions( Math.PI / 6.0));
/** * Creates a new instance where the category labels angled upwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createUpRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f) // RIGHT ); }
/** * Returns a new instance based on an existing instance but with the bottom * position changed. * * @param base the base (<code>null</code> not permitted). * @param bottom the bottom position (<code>null</code> not permitted). * * @return A new instance (never <code>null</code>). */ public static CategoryLabelPositions replaceBottomPosition( CategoryLabelPositions base, CategoryLabelPosition bottom) { if (base == null) { throw new IllegalArgumentException("Null 'base' argument."); } if (bottom == null) { throw new IllegalArgumentException("Null 'bottom' argument."); } return new CategoryLabelPositions( base.getLabelPosition(RectangleEdge.TOP), bottom, base.getLabelPosition(RectangleEdge.LEFT), base.getLabelPosition(RectangleEdge.RIGHT) ); }
public void setCategoryLabelRotation( final Node rotationDirection, final Node rotationAngle ) { // down is the default String direction = "down"; //$NON-NLS-1$ if ( rotationDirection != null ) { direction = rotationDirection.getText(); } if ( rotationAngle != null ) { if ( "up".equalsIgnoreCase( direction ) ) { //$NON-NLS-1$ setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions( Double .parseDouble( rotationAngle.getText() ) ) ); } else { setCategoryLabelPositions( CategoryLabelPositions.createDownRotationLabelPositions( Double .parseDouble( rotationAngle.getText() ) ) ); } } }
@Override public void customize(JFreeChart chart, ReportParameters reportParameters) { BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer(); renderer.setShadowPaint(Color.LIGHT_GRAY); renderer.setShadowVisible(true); CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); } }
/** * Creates a new instance where the category labels angled downwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createDownRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f) // RIGHT ); }
/** * Returns a new instance based on an existing instance but with the top * position changed. * * @param base the base (<code>null</code> not permitted). * @param top the top position (<code>null</code> not permitted). * * @return A new instance (never <code>null</code>). */ public static CategoryLabelPositions replaceTopPosition( CategoryLabelPositions base, CategoryLabelPosition top) { if (base == null) { throw new IllegalArgumentException("Null 'base' argument."); } if (top == null) { throw new IllegalArgumentException("Null 'top' argument."); } return new CategoryLabelPositions( top, base.getLabelPosition(RectangleEdge.BOTTOM), base.getLabelPosition(RectangleEdge.LEFT), base.getLabelPosition(RectangleEdge.RIGHT) ); }
= this.categoryLabelPositions.getLabelPosition(edge); float r = this.maximumCategoryLabelWidthRatio; if (r <= 0.0) {
CategoryLabelPositions.createUpRotationLabelPositions( (-labelRotation / 180.0) * Math.PI)); CategoryLabelPositions.createDownRotationLabelPositions((labelRotation / 180.0) * Math.PI));
/** * It creates a chart for the given dataset and adds the chart to the panel. * * @param dataset The dataset that will provide the values for the chart. */ private void addChart() { JFreeChart chart = ChartFactory.createStackedBarChart3D( getTitle(), null, "Breakdown" + unitSuffix(), dataset, PlotOrientation.VERTICAL, true, true, false); CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis(); domainAxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); chart.addProgressListener(locker); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setToolTipGenerator(dataset); mainPanel().add(BorderLayout.CENTER, new ChartPanel(chart)); }
return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT,
/** * Returns a new instance based on an existing instance but with the right * position changed. * * @param base the base (<code>null</code> not permitted). * @param right the right position (<code>null</code> not permitted). * * @return A new instance (never <code>null</code>). */ public static CategoryLabelPositions replaceRightPosition( CategoryLabelPositions base, CategoryLabelPosition right) { if (base == null) { throw new IllegalArgumentException("Null 'base' argument."); } if (right == null) { throw new IllegalArgumentException("Null 'right' argument."); } return new CategoryLabelPositions( base.getLabelPosition(RectangleEdge.TOP), base.getLabelPosition(RectangleEdge.BOTTOM), base.getLabelPosition(RectangleEdge.LEFT), right ); }
= this.categoryLabelPositions.getLabelPosition(edge); float r = this.maximumCategoryLabelWidthRatio; if (r <= 0.0) {
return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT,
/** * Returns a new instance based on an existing instance but with the top * position changed. * * @param base the base ({@code null} not permitted). * @param top the top position ({@code null} not permitted). * * @return A new instance (never {@code null}). */ public static CategoryLabelPositions replaceTopPosition( CategoryLabelPositions base, CategoryLabelPosition top) { Args.nullNotPermitted(base, "base"); Args.nullNotPermitted(top, "top"); return new CategoryLabelPositions(top, base.getLabelPosition(RectangleEdge.BOTTOM), base.getLabelPosition(RectangleEdge.LEFT), base.getLabelPosition(RectangleEdge.RIGHT)); }
= getCategoryLabelPositions().getLabelPosition(edge); float r = getMaximumCategoryLabelWidthRatio(); if (r <= 0.0) {