/** * Returns the item label position for all negative values in a series. * * @param series the series index (zero-based). * * @return The item label position (never <code>null</code>). */ public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series) { // return the override, if there is one... if (this.negativeItemLabelPosition != null) { return this.negativeItemLabelPosition; } // otherwise look up the position list ItemLabelPosition position = (ItemLabelPosition) this.negativeItemLabelPositionList.get(series); if (position == null) { position = this.baseNegativeItemLabelPosition; } return position; }
/** * Returns the item label position for all negative values in a series. * * @param series the series index (zero-based). * * @return The item label position (never <code>null</code>). * * @see #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition) */ public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series) { // return the override, if there is one... if (this.negativeItemLabelPosition != null) { return this.negativeItemLabelPosition; } // otherwise look up the position list ItemLabelPosition position = (ItemLabelPosition) this.negativeItemLabelPositionList.get(series); if (position == null) { position = this.baseNegativeItemLabelPosition; } return position; }
/** * Returns the item label position for all positive values in a series. * * @param series the series index (zero-based). * * @return The item label position (never <code>null</code>). * * @see #setSeriesPositiveItemLabelPosition(int, ItemLabelPosition) */ public ItemLabelPosition getSeriesPositiveItemLabelPosition(int series) { // return the override, if there is one... if (this.positiveItemLabelPosition != null) { return this.positiveItemLabelPosition; } // otherwise look up the position table ItemLabelPosition position = (ItemLabelPosition) this.positiveItemLabelPositionList.get(series); if (position == null) { position = this.basePositiveItemLabelPosition; } return position; }
public static void setTimeSeriesRender(Plot plot, boolean isShowData, boolean isShapesVisible) { XYPlot xyplot = (XYPlot) plot; xyplot.setNoDataMessage(NO_DATA_MSG); xyplot.setInsets(new RectangleInsets(10, 10, 5, 10)); XYLineAndShapeRenderer xyRenderer = (XYLineAndShapeRenderer) xyplot.getRenderer(); xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); xyRenderer.setBaseShapesVisible(false); if (isShowData) { xyRenderer.setBaseItemLabelsVisible(true); xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); xyRenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER)); } xyRenderer.setBaseShapesVisible(isShapesVisible); DateAxis domainAxis = (DateAxis) xyplot.getDomainAxis(); domainAxis.setAutoTickUnitSelection(false); DateTickUnit dateTickUnit = new DateTickUnit(DateTickUnitType.YEAR, 1, new SimpleDateFormat("yyyy-MM")); domainAxis.setTickUnit(dateTickUnit); StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0")); xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator); setXY_XAixs(xyplot); setXY_YAixs(xyplot); }
/** * Test that setting the positive item label position for ALL series does in fact work. */ public void testSetPositiveItemLabelPosition() { BarRenderer r = new BarRenderer(); r.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT) ); assertEquals( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT), r.getPositiveItemLabelPosition(0, 0) ); }
/** * Draws an item label. * * @param g2 the graphics device. * @param orientation the orientation. * @param dataset the dataset. * @param row the row. * @param column the column. * @param x the x coordinate (in Java2D space). * @param y the y coordinate (in Java2D space). * @param negative indicates a negative value (which affects the item * label position). */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column); if (generator != null) { Font labelFont = getItemLabelFont(row, column); Paint paint = getItemLabelPaint(row, column); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column); } else { position = getNegativeItemLabelPosition(row, column); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
/** * Sets the base negative item label position and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> not permitted). * @param notify notify registered listeners? */ public void setBaseNegativeItemLabelPosition(ItemLabelPosition position, boolean notify) { if (position == null) { throw new IllegalArgumentException("Null 'position' argument."); } this.baseNegativeItemLabelPosition = position; if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
/** * Returns the base item label anchor. * * @return The anchor point. * * @deprecated Use getBasePositiveItemLabelPosition()/getBaseNegativeItemLabelPosition(). */ public ItemLabelAnchor getBaseItemLabelAnchor() { ItemLabelAnchor result = null; ItemLabelPosition p = getBasePositiveItemLabelPosition(); if (p != null) { return p.getItemLabelAnchor(); } return result; }
/** * Returns the base item label text anchor. * * @return The text anchor. * * @deprecated Use getBasePositiveItemLabelPosition()/getBaseNegativeItemLabelPosition(). */ public TextAnchor getBaseItemLabelTextAnchor() { TextAnchor result = null; ItemLabelPosition p = getBasePositiveItemLabelPosition(); if (p != null) { result = p.getTextAnchor(); } return result; }
/** * Returns the base item label rotation anchor point. * * @return The anchor point. * * @deprecated Use getBasePositiveItemLabelPosition()/getBaseNegativeItemLabelPosition(). */ public TextAnchor getBaseItemLabelRotationAnchor() { TextAnchor result = null; ItemLabelPosition p = this.getBasePositiveItemLabelPosition(); if (p != null) { result = p.getRotationAnchor(); } return result; }
/** * Draws an item label. * * @param g2 the graphics device. * @param orientation the orientation. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param x the x coordinate (in Java2D space). * @param y the y coordinate (in Java2D space). * @param negative indicates a negative value (which affects the item label position). */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, XYDataset dataset, int series, int item, double x, double y, boolean negative) { XYLabelGenerator generator = getLabelGenerator(series, item); if (generator != null) { Font labelFont = getItemLabelFont(series, item); Paint paint = getItemLabelPaint(series, item); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, series, item); // get the label position.. ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(series, item); } else { position = getNegativeItemLabelPosition(series, item); } // work out the label anchor point... Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation ); RefineryUtilities.drawRotatedString( label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getRotationAnchor(), position.getAngle() ); } }
/** * Sets the base negative item label position and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> not permitted). * @param notify notify registered listeners? * * @see #getBaseNegativeItemLabelPosition() */ public void setBaseNegativeItemLabelPosition(ItemLabelPosition position, boolean notify) { if (position == null) { throw new IllegalArgumentException("Null 'position' argument."); } this.baseNegativeItemLabelPosition = position; if (notify) { fireChangeEvent(); } }
/** * Creates a new renderer. * * @param margin the percentual amount of the bars that are cut away. */ public StackedXYBarRenderer(double margin) { super(margin); this.renderAsPercentages = false; // set the default item label positions, which will only be used if // the user requests visible item labels... ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER); setBasePositiveItemLabelPosition(p); setBaseNegativeItemLabelPosition(p); setPositiveItemLabelPositionFallback(null); setNegativeItemLabelPositionFallback(null); }
/** * Draws an item label. * * @param g2 the graphics device. * @param orientation the orientation. * @param dataset the dataset. * @param row the row. * @param column the column. * @param x the x coordinate (in Java2D space). * @param y the y coordinate (in Java2D space). * @param negative indicates a negative value (which affects the item label position). */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, double x, double y, boolean negative) { CategoryLabelGenerator generator = getLabelGenerator(row, column); if (generator != null) { Font labelFont = getItemLabelFont(row, column); Paint paint = getItemLabelPaint(row, column); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column); } else { position = getNegativeItemLabelPosition(row, column); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation ); RefineryUtilities.drawRotatedString( label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getRotationAnchor(), position.getAngle() ); } }
/** * Draws an item label. This method is overridden so that the bar can be * used to calculate the label anchor point. * * @param g2 the graphics device. * @param dataset the dataset. * @param series the series index. * @param item the item index. * @param plot the plot. * @param generator the label generator. * @param bar the bar. * @param negative a flag indicating a negative value. */ protected void drawItemLabel(Graphics2D g2, XYDataset dataset, int series, int item, XYPlot plot, XYItemLabelGenerator generator, Rectangle2D bar, boolean negative) { String label = generator.generateLabel(dataset, series, item); if (label == null) { return; // nothing to do } Font labelFont = getItemLabelFont(series, item); g2.setFont(labelFont); Paint paint = getItemLabelPaint(series, item); g2.setPaint(paint); // find out where to place the label... ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(series, item); } else { position = getNegativeItemLabelPosition(series, item); } // work out the label anchor point... Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), bar, plot.getOrientation()); if (isInternalAnchor(position.getItemLabelAnchor())) { Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); if (bounds != null) { if (!bar.contains(bounds.getBounds2D())) { if (!negative) { position = getPositiveItemLabelPositionFallback(); } else { position = getNegativeItemLabelPositionFallback(); } if (position != null) { anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), bar, plot.getOrientation()); } } } } if (position != null) { TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
/** * Test that the equals() method distinguishes all fields. */ public void testEquals() { BarRenderer r1 = new BarRenderer(); BarRenderer r2 = new BarRenderer(); assertTrue(r1.equals(r2)); assertTrue(r2.equals(r1)); // itemMargin r1.setItemMargin(0.22); assertFalse(r1.equals(r2)); r2.setItemMargin(0.22); assertTrue(r1.equals(r2)); // drawBarOutline r1.setDrawBarOutline(!r1.isDrawBarOutline()); assertFalse(r1.equals(r2)); r2.setDrawBarOutline(!r2.isDrawBarOutline()); assertTrue(r1.equals(r2)); // maxBarWidth r1.setMaxBarWidth(0.11); assertFalse(r1.equals(r2)); r2.setMaxBarWidth(0.11); assertTrue(r1.equals(r2)); // minimumBarLength r1.setMinimumBarLength(0.04); assertFalse(r1.equals(r2)); r2.setMinimumBarLength(0.04); assertTrue(r1.equals(r2)); // gradientPaintTransformer r1.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL) ); assertFalse(r1.equals(r2)); r2.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL) ); assertTrue(r1.equals(r2)); // positiveItemLabelPositionFallback r1.setPositiveItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER) ); assertFalse(r1.equals(r2)); r2.setPositiveItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER) ); assertTrue(r1.equals(r2)); // negativeItemLabelPositionFallback r1.setNegativeItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER) ); assertFalse(r1.equals(r2)); r2.setNegativeItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER) ); assertTrue(r1.equals(r2)); }
/** * Draws an item label. This method is overridden so that the bar can be used * to calculate the label anchor point. * * @param g2 the graphics device. * @param data the dataset. * @param row the row. * @param column the column. * @param plot the plot. * @param generator the label generator. * @param bar the bar. * @param negative a flag indicating a negative value. */ protected void drawItemLabel(Graphics2D g2, CategoryDataset data, int row, int column, CategoryPlot plot, CategoryLabelGenerator generator, Rectangle2D bar, boolean negative) { String label = generator.generateLabel(data, row, column); if (label == null) { return; // nothing to do } Font labelFont = getItemLabelFont(row, column); g2.setFont(labelFont); Paint paint = getItemLabelPaint(row, column); g2.setPaint(paint); // find out where to place the label... ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column); } else { position = getNegativeItemLabelPosition(row, column); } // work out the label anchor point... Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), bar, plot.getOrientation() ); if (isInternalAnchor(position.getItemLabelAnchor())) { Shape bounds = RefineryUtilities.calculateRotatedStringBounds( label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getRotationAnchor(), position.getAngle() ); if (bounds != null) { if (!bar.contains(bounds.getBounds2D())) { if (!negative) { position = getPositiveItemLabelPositionFallback(); } else { position = getNegativeItemLabelPositionFallback(); } if (position != null) { anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), bar, plot.getOrientation() ); } } } } if (position != null) { RefineryUtilities.drawRotatedString( label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getRotationAnchor(), position.getAngle() ); } }
/** * Problem that the equals(...) method distinguishes all fields. */ public void testEquals() { ItemLabelPosition p1 = new ItemLabelPosition(); ItemLabelPosition p2 = new ItemLabelPosition(); assertEquals(p1, p2); }
/** * Test that the equals() method distinguishes all fields. */ public void testEquals() { // default instances XYBarRenderer r1 = new XYBarRenderer(); XYBarRenderer r2 = new XYBarRenderer(); assertTrue(r1.equals(r2)); assertTrue(r2.equals(r1)); // setBase() r1.setBase(1.0); assertFalse(r1.equals(r2)); r2.setBase(1.0); assertTrue(r1.equals(r2)); // setUseYInterval r1.setUseYInterval(!r1.getUseYInterval()); assertFalse(r1.equals(r2)); r2.setUseYInterval(!r2.getUseYInterval()); assertTrue(r1.equals(r2)); // setMargin() r1.setMargin(0.10); assertFalse(r1.equals(r2)); r2.setMargin(0.10); assertTrue(r1.equals(r2)); // setDrawBarOutline() r1.setDrawBarOutline(!r1.isDrawBarOutline()); assertFalse(r1.equals(r2)); r2.setDrawBarOutline(!r2.isDrawBarOutline()); assertTrue(r1.equals(r2)); // setGradientPaintTransformer() r1.setGradientPaintTransformer(new StandardGradientPaintTransformer( GradientPaintTransformType.CENTER_HORIZONTAL)); assertFalse(r1.equals(r2)); r2.setGradientPaintTransformer(new StandardGradientPaintTransformer( GradientPaintTransformType.CENTER_HORIZONTAL)); assertTrue(r1.equals(r2)); // legendBar r1.setLegendBar(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0)); assertFalse(r1.equals(r2)); r2.setLegendBar(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0)); assertTrue(r1.equals(r2)); // positiveItemLabelFallbackPosition r1.setPositiveItemLabelPositionFallback(new ItemLabelPosition()); assertFalse(r1.equals(r2)); r2.setPositiveItemLabelPositionFallback(new ItemLabelPosition()); assertTrue(r1.equals(r2)); // negativeItemLabelFallbackPosition r1.setNegativeItemLabelPositionFallback(new ItemLabelPosition()); assertFalse(r1.equals(r2)); r2.setNegativeItemLabelPositionFallback(new ItemLabelPosition()); assertTrue(r1.equals(r2)); }
/** * Test that the equals() method distinguishes all fields. */ public void testEquals() { BarRenderer r1 = new BarRenderer(); BarRenderer r2 = new BarRenderer(); assertTrue(r1.equals(r2)); assertTrue(r2.equals(r1)); // base value r1.setBase(0.123); assertFalse(r1.equals(r2)); r2.setBase(0.123); assertTrue(r1.equals(r2)); // itemMargin r1.setItemMargin(0.22); assertFalse(r1.equals(r2)); r2.setItemMargin(0.22); assertTrue(r1.equals(r2)); // drawBarOutline r1.setDrawBarOutline(!r1.isDrawBarOutline()); assertFalse(r1.equals(r2)); r2.setDrawBarOutline(!r2.isDrawBarOutline()); assertTrue(r1.equals(r2)); // maximumBarWidth r1.setMaximumBarWidth(0.11); assertFalse(r1.equals(r2)); r2.setMaximumBarWidth(0.11); assertTrue(r1.equals(r2)); // minimumBarLength r1.setMinimumBarLength(0.04); assertFalse(r1.equals(r2)); r2.setMinimumBarLength(0.04); assertTrue(r1.equals(r2)); // gradientPaintTransformer r1.setGradientPaintTransformer( new StandardGradientPaintTransformer( GradientPaintTransformType.CENTER_VERTICAL ) ); assertFalse(r1.equals(r2)); r2.setGradientPaintTransformer( new StandardGradientPaintTransformer( GradientPaintTransformType.CENTER_VERTICAL ) ); assertTrue(r1.equals(r2)); // positiveItemLabelPositionFallback r1.setPositiveItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER) ); assertFalse(r1.equals(r2)); r2.setPositiveItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER) ); assertTrue(r1.equals(r2)); // negativeItemLabelPositionFallback r1.setNegativeItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER) ); assertFalse(r1.equals(r2)); r2.setNegativeItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER) ); assertTrue(r1.equals(r2)); }
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { ItemLabelPosition p1 = new ItemLabelPosition(); ItemLabelPosition p2 = new ItemLabelPosition(); assertEquals(p1, p2); }
/** * Default constructor. */ public AbstractRenderer() { this.seriesVisible = null; this.seriesVisibleList = new BooleanList(); this.baseSeriesVisible = true; this.seriesVisibleInLegend = null; this.seriesVisibleInLegendList = new BooleanList(); this.baseSeriesVisibleInLegend = true; this.paint = null; this.paintList = new PaintList(); this.basePaint = DEFAULT_PAINT; this.fillPaint = null; this.fillPaintList = new PaintList(); this.baseFillPaint = Color.white; this.outlinePaint = null; this.outlinePaintList = new PaintList(); this.baseOutlinePaint = DEFAULT_OUTLINE_PAINT; this.stroke = null; this.strokeList = new StrokeList(); this.baseStroke = DEFAULT_STROKE; this.outlineStroke = null; this.outlineStrokeList = new StrokeList(); this.baseOutlineStroke = DEFAULT_OUTLINE_STROKE; this.shape = null; this.shapeList = new ShapeList(); this.baseShape = DEFAULT_SHAPE; this.itemLabelsVisible = null; this.itemLabelsVisibleList = new BooleanList(); this.baseItemLabelsVisible = Boolean.FALSE; this.itemLabelFont = null; this.itemLabelFontList = new ObjectList(); this.baseItemLabelFont = new Font("SansSerif", Font.PLAIN, 10); this.itemLabelPaint = null; this.itemLabelPaintList = new PaintList(); this.baseItemLabelPaint = Color.black; this.positiveItemLabelPosition = null; this.positiveItemLabelPositionList = new ObjectList(); this.basePositiveItemLabelPosition = new ItemLabelPosition( ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER); this.negativeItemLabelPosition = null; this.negativeItemLabelPositionList = new ObjectList(); this.baseNegativeItemLabelPosition = new ItemLabelPosition( ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER); this.createEntities = null; this.createEntitiesList = new BooleanList(); this.baseCreateEntities = true; this.listenerList = new EventListenerList(); }
/** * Draws an item label. This method is overridden so that the bar can be * used to calculate the label anchor point. * * @param g2 the graphics device. * @param data the dataset. * @param row the row. * @param column the column. * @param plot the plot. * @param generator the label generator. * @param bar the bar. * @param negative a flag indicating a negative value. */ protected void drawItemLabel(Graphics2D g2, CategoryDataset data, int row, int column, CategoryPlot plot, CategoryItemLabelGenerator generator, Rectangle2D bar, boolean negative) { String label = generator.generateLabel(data, row, column); if (label == null) { return; // nothing to do } Font labelFont = getItemLabelFont(row, column); g2.setFont(labelFont); Paint paint = getItemLabelPaint(row, column); g2.setPaint(paint); // find out where to place the label... ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column); } else { position = getNegativeItemLabelPosition(row, column); } // work out the label anchor point... Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), bar, plot.getOrientation()); if (isInternalAnchor(position.getItemLabelAnchor())) { Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); if (bounds != null) { if (!bar.contains(bounds.getBounds2D())) { if (!negative) { position = getPositiveItemLabelPositionFallback(); } else { position = getNegativeItemLabelPositionFallback(); } if (position != null) { anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), bar, plot.getOrientation()); } } } } if (position != null) { TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
/** * Sets the positive item label position for ALL series and (if requested) sends a * {@link RendererChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> permitted). * @param notify notify registered listeners? */ public void setPositiveItemLabelPosition(ItemLabelPosition position, boolean notify) { this.positiveItemLabelPosition = position; if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
/** * Sets the item label position for all positive values in a series and (if requested) sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero-based). * @param position the position (<code>null</code> permitted). * @param notify notify registered listeners? */ public void setSeriesPositiveItemLabelPosition(int series, ItemLabelPosition position, boolean notify) { this.positiveItemLabelPositionList.set(series, position); if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
/** * Sets the item label position for negative values in ALL series and (if requested) sends * a {@link RendererChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> permitted). * @param notify notify registered listeners? */ public void setNegativeItemLabelPosition(ItemLabelPosition position, boolean notify) { this.negativeItemLabelPosition = position; if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
/** * Sets the item label position for negative values in a series and (if requested) sends a. * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero-based). * @param position the position (<code>null</code> permitted). * @param notify notify registered listeners? */ public void setSeriesNegativeItemLabelPosition(int series, ItemLabelPosition position, boolean notify) { this.negativeItemLabelPositionList.set(series, position); if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
/** * Returns the item label anchor for all labels in a series. * * @param series the series. * * @return The anchor point. * * @deprecated Use getSeriesPositiveItemLabelPosition() or getSeriesNegativeItemLabelPosition(). */ public ItemLabelAnchor getSeriesItemLabelAnchor(int series) { ItemLabelAnchor result = null; ItemLabelPosition p = getSeriesPositiveItemLabelPosition(series); if (p != null) { result = p.getItemLabelAnchor(); } return result; }
/** * Returns the text anchor for all item labels in a series. * * @param series the series. * * @return The text anchor. * * @deprecated Use getSeriesPositiveItemLabelPosition()/getSeriesNegativeItemLabelPosition(). */ public TextAnchor getSeriesItemLabelTextAnchor(int series) { TextAnchor result = null; ItemLabelPosition p = getSeriesPositiveItemLabelPosition(series); if (p != null) { result = p.getTextAnchor(); } return result; }
/** * Returns the rotation anchor for all item labels in a series. * * @param series the series. * * @return The rotation anchor. * * @deprecated Use getSeriesPositiveItemLabelPosition()/getSeriesNegativeItemLabelPosition(). */ public TextAnchor getSeriesItemLabelRotationAnchor(int series) { TextAnchor result = null; ItemLabelPosition p = this.getSeriesPositiveItemLabelPosition(series); if (p != null) { result = p.getRotationAnchor(); } return result; }
/** * Returns the base positive item label position. * * @return The position (never <code>null</code>). */ public ItemLabelPosition getBasePositiveItemLabelPosition();
/** * Returns the item label position for positive values in ALL series. * * @return The item label position (possibly <code>null</code>). */ public ItemLabelPosition getPositiveItemLabelPosition();
/** * Returns the fallback position for negative item labels that don't fit * within a bar. * * @return The fallback position (<code>null</code> possible). * * @see #setNegativeItemLabelPositionFallback(ItemLabelPosition) * @since 1.0.2 */ public ItemLabelPosition getNegativeItemLabelPositionFallback() { return this.negativeItemLabelPositionFallback; }
/** * Returns the item label position for positive values in ALL series. * * @return The item label position (possibly <code>null</code>). * * @see #setPositiveItemLabelPosition(ItemLabelPosition) */ public ItemLabelPosition getPositiveItemLabelPosition();
/** * Returns the item label position for positive values. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The item label position (never <code>null</code>). */ public ItemLabelPosition getPositiveItemLabelPosition(int row, int column) { return getSeriesPositiveItemLabelPosition(row); }
/** * Returns the item label position for positive values in ALL series. * * @return The item label position (possibly <code>null</code>). */ public ItemLabelPosition getPositiveItemLabelPosition() { return this.positiveItemLabelPosition; }
/** * Sets the item label position for positive values in ALL series, and sends a * {@link RendererChangeEvent} to all registered listeners. You need to set this to * <code>null</code> to expose the settings for individual series. * * @param position the position (<code>null</code> permitted). */ public void setPositiveItemLabelPosition(ItemLabelPosition position) { setPositiveItemLabelPosition(position, true); }
/** * Returns the item label position for negative values. This method can be * overridden to provide customisation of the item label position for * individual data items. * * @param row the row index (zero-based). * @param column the column (zero-based). * * @return The item label position (never <code>null</code>). */ public ItemLabelPosition getNegativeItemLabelPosition(int row, int column);
/** * Sets the item label position for all positive values in a series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero-based). * @param position the position (<code>null</code> permitted). */ public void setSeriesPositiveItemLabelPosition(int series, ItemLabelPosition position) { setSeriesPositiveItemLabelPosition(series, position, true); }
/** * Returns the base positive item label position. * * @return The position (never <code>null</code>). */ public ItemLabelPosition getBasePositiveItemLabelPosition() { return this.basePositiveItemLabelPosition; }