本文整理汇总了Java中org.jfree.chart.labels.CategoryItemLabelGenerator类的典型用法代码示例。如果您正苦于以下问题:Java CategoryItemLabelGenerator类的具体用法?Java CategoryItemLabelGenerator怎么用?Java CategoryItemLabelGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CategoryItemLabelGenerator类属于org.jfree.chart.labels包,在下文中一共展示了CategoryItemLabelGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSeriesItemLabelGenerator
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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)
*/
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 = (CategoryItemLabelGenerator)
this.itemLabelGeneratorList.get(series);
if (generator == null) {
generator = this.baseItemLabelGenerator;
}
return generator;
}
示例2: getSeriesItemLabelGenerator
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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;
}
示例3: getSeriesItemLabelGenerator
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* Returns the item label generator for a series.
*
* @param series the series index (zero based).
*
* @return The generator (possibly <code>null</code>).
*/
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 = (CategoryItemLabelGenerator)
this.itemLabelGeneratorList.get(series);
if (generator == null) {
generator = this.baseItemLabelGenerator;
}
return generator;
}
示例4: getSeriesItemLabelGenerator
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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 = (CategoryItemLabelGenerator)
this.itemLabelGeneratorList.get(series);
if (generator == null) {
generator = this.baseItemLabelGenerator;
}
return generator;
}
示例5: drawItemLabel
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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());
}
}
示例6: AbstractCategoryItemRenderer
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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();
}
示例7: drawItemLabel
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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());
}
}
示例8: AbstractCategoryItemRenderer
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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.itemLabelGeneratorMap
= new HashMap<Integer, CategoryItemLabelGenerator>();
this.toolTipGeneratorMap
= new HashMap<Integer, CategoryToolTipGenerator>();
this.itemURLGeneratorMap = new HashMap<Integer, CategoryURLGenerator>();
this.legendItemLabelGenerator
= new StandardCategorySeriesLabelGenerator();
}
示例9: getSeriesItemLabelGenerator
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* Returns the item label generator for a series.
*
* @param series the series index (zero based).
*
* @return The generator (possibly {@code null}).
*
* @see #setSeriesItemLabelGenerator(int, CategoryItemLabelGenerator)
*/
@Override
public CategoryItemLabelGenerator getSeriesItemLabelGenerator(int series) {
// otherwise look up the generator table
CategoryItemLabelGenerator generator = this.itemLabelGeneratorMap.get(
series);
if (generator == null) {
generator = this.defaultItemLabelGenerator;
}
return generator;
}
示例10: drawItemLabel
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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);
TextUtils.drawRotatedString(label, g2,
(float) anchorPoint.getX(), (float) anchorPoint.getY(),
position.getTextAnchor(),
position.getAngle(), position.getRotationAnchor());
}
}
示例11: createStackedBarChart
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
*
*/
protected JFreeChart createStackedBarChart() throws JRException
{
ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
JFreeChart jfreeChart =
ChartFactory.createStackedBarChart(
evaluateTextExpression(getChart().getTitleExpression()),
evaluateTextExpression(((JRBarPlot)getPlot()).getCategoryAxisLabelExpression()),
evaluateTextExpression(((JRBarPlot)getPlot()).getValueAxisLabelExpression()),
(CategoryDataset)getDataset(),
getPlot().getOrientationValue().getOrientation(),
isShowLegend(),
true,
false
);
configureChart(jfreeChart, getPlot());
CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
JRBarPlot barPlot = (JRBarPlot)getPlot();
//plot.setNoDataMessage("No data to display");
boolean isShowTickMarks = barPlot.getShowTickMarks() == null ? true : barPlot.getShowTickMarks().booleanValue();
boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().booleanValue();
boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels().booleanValue();
categoryPlot.getDomainAxis().setTickMarksVisible(isShowTickMarks);
categoryPlot.getDomainAxis().setTickLabelsVisible(isShowTickLabels);
((NumberAxis)categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks);
((NumberAxis)categoryPlot.getRangeAxis()).setTickLabelsVisible(isShowTickLabels);
BarRenderer categoryRenderer = (BarRenderer)categoryPlot.getRenderer();
categoryRenderer.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator());
categoryRenderer.setBaseItemLabelsVisible(isShowLabels);
categoryRenderer.setShadowVisible(false);
// Handle the axis formating for the category axis
configureAxis(categoryPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(),
barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(),
barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(), barPlot.getCategoryAxisVerticalTickLabels(),
barPlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(),
(Comparable<?>)evaluateExpression(barPlot.getDomainAxisMinValueExpression()),
(Comparable<?>)evaluateExpression(barPlot.getDomainAxisMaxValueExpression())
);
// Handle the axis formating for the value axis
configureAxis(categoryPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(),
barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(),
barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(), barPlot.getValueAxisVerticalTickLabels(),
barPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(),
(Comparable<?>)evaluateExpression(barPlot.getRangeAxisMinValueExpression()),
(Comparable<?>)evaluateExpression(barPlot.getRangeAxisMaxValueExpression())
);
return jfreeChart;
}
示例12: drawItemLabel
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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());
}
}
示例13: drawItemLabel
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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());
}
}
示例14: drawItemLabel
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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());
}
}
示例15: drawItemLabel
import org.jfree.chart.labels.CategoryItemLabelGenerator; //导入依赖的package包/类
/**
* 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());
}
}