org.jfree.chart.labels.CategoryItemLabelGenerator Java Examples
The following examples show how to use
org.jfree.chart.labels.CategoryItemLabelGenerator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractCategoryItemRenderer.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Returns the item label generator for a series. * * @param series the series index (zero based). * * @return The generator (possibly <code>null</code>). * * @see #setSeriesItemLabelGenerator(int, CategoryItemLabelGenerator) */ @Override public CategoryItemLabelGenerator getSeriesItemLabelGenerator(int series) { // return the generator for ALL series, if there is one... if (this.itemLabelGenerator != null) { return this.itemLabelGenerator; } // otherwise look up the generator table CategoryItemLabelGenerator generator = this.itemLabelGeneratorMap.get( series); if (generator == null) { generator = this.baseItemLabelGenerator; } return generator; }
Example #2
Source File: 1_AbstractCategoryItemRenderer.java From SimFix with GNU General Public License v2.0 | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #3
Source File: AbstractCategoryItemRenderer.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * 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; 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()); } }
Example #4
Source File: AbstractCategoryItemRenderer.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * 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; 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()); } }
Example #5
Source File: AbstractCategoryItemRenderer.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Creates a new renderer with no tool tip generator and no URL generator. * The defaults (no tool tip or URL generators) have been chosen to * minimise the processing required to generate a default chart. If you * require tool tips or URLs, then you can easily add the required * generators. */ protected AbstractCategoryItemRenderer() { this.itemLabelGenerator = null; this.itemLabelGeneratorMap = new HashMap<Integer, CategoryItemLabelGenerator>(); this.toolTipGenerator = null; this.toolTipGeneratorMap = new HashMap<Integer, CategoryToolTipGenerator>(); this.itemURLGenerator = null; this.itemURLGeneratorMap = new HashMap<Integer, CategoryURLGenerator>(); this.legendItemLabelGenerator = new StandardCategorySeriesLabelGenerator(); }
Example #6
Source File: JGenProg2017_00102_s.java From coming with MIT License | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #7
Source File: Arja_000_s.java From coming with MIT License | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #8
Source File: Cardumen_000_s.java From coming with MIT License | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #9
Source File: JGenProg2017_00102_t.java From coming with MIT License | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #10
Source File: patch1-Chart-1-jMutRepair_patch1-Chart-1-jMutRepair_t.java From coming with MIT License | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #11
Source File: Arja_0089_s.java From coming with MIT License | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #12
Source File: JGenProg2017_000_t.java From coming with MIT License | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #13
Source File: Arja_00112_s.java From coming with MIT License | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #14
Source File: Arja_0062_t.java From coming with MIT License | 5 votes |
/** * 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 selected is the item selected? * @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). * * @since 1.2.0 */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, boolean selected, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column, selected); if (generator != null) { Font labelFont = getItemLabelFont(row, column, selected); Paint paint = getItemLabelPaint(row, column, selected); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position = null; if (!negative) { position = getPositiveItemLabelPosition(row, column, selected); } else { position = getNegativeItemLabelPosition(row, column, selected); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } }
Example #15
Source File: DefaultChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
protected JFreeChart createBar3DChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createBarChart3D( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBar3DPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRBar3DPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); JRBar3DPlot bar3DPlot = (JRBar3DPlot)getPlot(); BarRenderer3D barRenderer3D = new BarRenderer3D( bar3DPlot.getXOffsetDouble() == null ? BarRenderer3D.DEFAULT_X_OFFSET : bar3DPlot.getXOffsetDouble(), bar3DPlot.getYOffsetDouble() == null ? BarRenderer3D.DEFAULT_Y_OFFSET : bar3DPlot.getYOffsetDouble() ); boolean isShowLabels = bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels(); barRenderer3D.setBaseItemLabelsVisible( isShowLabels ); if (isShowLabels) { JRItemLabel itemLabel = bar3DPlot.getItemLabel(); barRenderer3D.setBaseItemLabelFont( fontUtil.getAwtFont( getFont(itemLabel == null ? null : itemLabel.getFont()), getLocale() ) ); if (itemLabel != null) { if (itemLabel.getColor() != null) { barRenderer3D.setBaseItemLabelPaint(itemLabel.getColor()); } else { barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } // categoryRenderer.setBaseFillPaint(itemLabel.getBackgroundColor()); // if (itemLabel.getMask() != null) // { // barRenderer3D.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( // StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, // new DecimalFormat(itemLabel.getMask()))); // } // else // { barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); // } } else { barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } } categoryPlot.setRenderer(barRenderer3D); // Handle the axis formating for the category axis configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(), bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(), bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(), bar3DPlot.getCategoryAxisVerticalTickLabels(), bar3DPlot.getCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(), bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(), bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(), bar3DPlot.getValueAxisVerticalTickLabels(), bar3DPlot.getValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #16
Source File: BarRenderer.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * 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; 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()); } }
Example #17
Source File: BarRenderer.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * 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; 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()); } }
Example #18
Source File: Cardumen_00139_t.java From coming with MIT License | 3 votes |
/** * Sets the base item label generator and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getBaseItemLabelGenerator() */ public void setBaseItemLabelGenerator( CategoryItemLabelGenerator generator, boolean notify) { this.baseItemLabelGenerator = generator; if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
Example #19
Source File: Cardumen_000_s.java From coming with MIT License | 3 votes |
/** * Sets the base item label generator and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getBaseItemLabelGenerator() */ public void setBaseItemLabelGenerator( CategoryItemLabelGenerator generator, boolean notify) { this.baseItemLabelGenerator = generator; if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
Example #20
Source File: jMutRepair_000_t.java From coming with MIT License | 3 votes |
/** * Sets the base item label generator and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getBaseItemLabelGenerator() */ public void setBaseItemLabelGenerator( CategoryItemLabelGenerator generator, boolean notify) { this.baseItemLabelGenerator = generator; if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
Example #21
Source File: Elixir_000_t.java From coming with MIT License | 3 votes |
/** * Sets the item label generator for a series and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero based). * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getSeriesItemLabelGenerator(int) */ public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator, boolean notify) { this.itemLabelGeneratorList.set(series, generator); if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
Example #22
Source File: jKali_0031_t.java From coming with MIT License | 3 votes |
/** * Returns the item label generator for a data item. This implementation * returns the series item label generator if one is defined, otherwise * it returns the default item label generator (which may be * <code>null</code>). * * @param row the row index (zero based). * @param column the column index (zero based). * @param selected is the item selected? * * @return The generator (possibly <code>null</code>). * * @since 1.2.0 */ public CategoryItemLabelGenerator getItemLabelGenerator(int row, int column, boolean selected) { CategoryItemLabelGenerator generator = (CategoryItemLabelGenerator) this.itemLabelGeneratorList.get(row); if (generator == null) { generator = this.baseItemLabelGenerator; } return generator; }
Example #23
Source File: AbstractCategoryItemRenderer.java From SIMVA-SoS with Apache License 2.0 | 3 votes |
/** * Sets the item label generator for a series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero based). * @param generator the generator (<code>null</code> permitted). * * @see #getSeriesItemLabelGenerator(int) */ @Override public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator) { this.itemLabelGeneratorMap.put(series, generator); fireChangeEvent(); }
Example #24
Source File: jKali_0019_s.java From coming with MIT License | 3 votes |
/** * Sets the base item label generator and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getBaseItemLabelGenerator() */ public void setBaseItemLabelGenerator( CategoryItemLabelGenerator generator, boolean notify) { this.baseItemLabelGenerator = generator; if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
Example #25
Source File: AbstractCategoryItemRenderer.java From SIMVA-SoS with Apache License 2.0 | 3 votes |
/** * Sets the base item label generator and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * * @see #getBaseItemLabelGenerator() */ @Override public void setBaseItemLabelGenerator( CategoryItemLabelGenerator generator) { this.baseItemLabelGenerator = generator; fireChangeEvent(); }
Example #26
Source File: JGenProg2017_0078_s.java From coming with MIT License | 3 votes |
/** * Sets the item label generator for a series and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero based). * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getSeriesItemLabelGenerator(int) */ public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator, boolean notify) { this.itemLabelGeneratorList.set(series, generator); if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
Example #27
Source File: Cardumen_00191_t.java From coming with MIT License | 3 votes |
/** * Sets the item label generator for a series and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero based). * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getSeriesItemLabelGenerator(int) */ public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator, boolean notify) { this.itemLabelGeneratorList.set(series, generator); if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
Example #28
Source File: Cardumen_00139_t.java From coming with MIT License | 3 votes |
/** * Sets the item label generator for a series and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero based). * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getSeriesItemLabelGenerator(int) */ public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator, boolean notify) { this.itemLabelGeneratorList.set(series, generator); if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
Example #29
Source File: Arja_0089_t.java From coming with MIT License | 3 votes |
/** * Sets the item label generator for a series and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero based). * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getSeriesItemLabelGenerator(int) */ public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator, boolean notify) { this.itemLabelGeneratorList.set(series, generator); if (notify) { notifyListeners(new RendererChangeEvent(this)); } }
Example #30
Source File: Chart_1_AbstractCategoryItemRenderer_s.java From coming with MIT License | 3 votes |
/** * Sets the item label generator for a series and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero based). * @param generator the generator (<code>null</code> permitted). * @param notify notify listeners? * * @since 1.2.0 * * @see #getSeriesItemLabelGenerator(int) */ public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator, boolean notify) { this.itemLabelGeneratorList.set(series, generator); if (notify) { notifyListeners(new RendererChangeEvent(this)); } }