本文整理汇总了Java中org.jfree.chart.labels.ItemLabelAnchor.CENTER属性的典型用法代码示例。如果您正苦于以下问题:Java ItemLabelAnchor.CENTER属性的具体用法?Java ItemLabelAnchor.CENTER怎么用?Java ItemLabelAnchor.CENTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jfree.chart.labels.ItemLabelAnchor
的用法示例。
在下文中一共展示了ItemLabelAnchor.CENTER属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInternalAnchor
/**
* Returns <code>true</code> if the specified anchor point is inside a bar.
*
* @param anchor the anchor point.
*
* @return A boolean.
*/
private boolean isInternalAnchor(ItemLabelAnchor anchor) {
return anchor == ItemLabelAnchor.CENTER
|| anchor == ItemLabelAnchor.INSIDE1
|| anchor == ItemLabelAnchor.INSIDE2
|| anchor == ItemLabelAnchor.INSIDE3
|| anchor == ItemLabelAnchor.INSIDE4
|| anchor == ItemLabelAnchor.INSIDE5
|| anchor == ItemLabelAnchor.INSIDE6
|| anchor == ItemLabelAnchor.INSIDE7
|| anchor == ItemLabelAnchor.INSIDE8
|| anchor == ItemLabelAnchor.INSIDE9
|| anchor == ItemLabelAnchor.INSIDE10
|| anchor == ItemLabelAnchor.INSIDE11
|| anchor == ItemLabelAnchor.INSIDE12;
}
示例2: isInternalAnchor
/**
* Returns <code>true</code> if the specified anchor point is inside a bar.
*
* @param anchor the anchor point.
*
* @return A boolean.
*/
private boolean isInternalAnchor(ItemLabelAnchor anchor) {
return anchor == ItemLabelAnchor.CENTER
|| anchor == ItemLabelAnchor.INSIDE1
|| anchor == ItemLabelAnchor.INSIDE2
|| anchor == ItemLabelAnchor.INSIDE3
|| anchor == ItemLabelAnchor.INSIDE4
|| anchor == ItemLabelAnchor.INSIDE5
|| anchor == ItemLabelAnchor.INSIDE6
|| anchor == ItemLabelAnchor.INSIDE7
|| anchor == ItemLabelAnchor.INSIDE8
|| anchor == ItemLabelAnchor.INSIDE9
|| anchor == ItemLabelAnchor.INSIDE10
|| anchor == ItemLabelAnchor.INSIDE11
|| anchor == ItemLabelAnchor.INSIDE12;
}
示例3: isInternalAnchor
/**
* Returns {@code true} if the specified anchor point is inside a bar.
*
* @param anchor the anchor point.
*
* @return A boolean.
*/
private boolean isInternalAnchor(ItemLabelAnchor anchor) {
return anchor == ItemLabelAnchor.CENTER
|| anchor == ItemLabelAnchor.INSIDE1
|| anchor == ItemLabelAnchor.INSIDE2
|| anchor == ItemLabelAnchor.INSIDE3
|| anchor == ItemLabelAnchor.INSIDE4
|| anchor == ItemLabelAnchor.INSIDE5
|| anchor == ItemLabelAnchor.INSIDE6
|| anchor == ItemLabelAnchor.INSIDE7
|| anchor == ItemLabelAnchor.INSIDE8
|| anchor == ItemLabelAnchor.INSIDE9
|| anchor == ItemLabelAnchor.INSIDE10
|| anchor == ItemLabelAnchor.INSIDE11
|| anchor == ItemLabelAnchor.INSIDE12;
}
示例4: StackedBarRenderer
/**
* Creates a new renderer with no tool tip generator and no URL generator.
* <P>
* 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.
*/
public StackedBarRenderer() {
super();
// 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);
}
示例5: StackedXYBarRenderer
/**
* 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);
}
示例6: StackedBarRenderer
/**
* Creates a new renderer.
*
* @param renderAsPercentages a flag that controls whether the data values
* are rendered as percentages.
*/
public StackedBarRenderer(boolean renderAsPercentages) {
super();
this.renderAsPercentages = renderAsPercentages;
// 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);
}
示例7: StackedXYBarRenderer
/**
* 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);
}
示例8: StackedBarRenderer
/**
* Creates a new renderer.
*
* @param renderAsPercentages a flag that controls whether the data values
* are rendered as percentages.
*/
public StackedBarRenderer(boolean renderAsPercentages) {
super();
this.renderAsPercentages = renderAsPercentages;
// 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);
}
示例9: StackedXYBarRenderer
/**
* 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);
setDefaultPositiveItemLabelPosition(p);
setDefaultNegativeItemLabelPosition(p);
setPositiveItemLabelPositionFallback(null);
setNegativeItemLabelPositionFallback(null);
}
示例10: StackedBarRenderer
/**
* Creates a new renderer.
*
* @param renderAsPercentages a flag that controls whether the data values
* are rendered as percentages.
*/
public StackedBarRenderer(boolean renderAsPercentages) {
super();
this.renderAsPercentages = renderAsPercentages;
// 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);
setDefaultPositiveItemLabelPosition(p);
setDefaultNegativeItemLabelPosition(p);
setPositiveItemLabelPositionFallback(null);
setNegativeItemLabelPositionFallback(null);
}
示例11: createChart
private JFreeChart createChart(IntervalCategoryDataset paramIntervalCategoryDataset) {
JFreeChart localJFreeChart = ChartFactory.createGanttChart(this.chartTitle, this.domainAxisLabel, this.rangeAxisLabel, paramIntervalCategoryDataset, true, true, false);
CategoryPlot localCategoryPlot = (CategoryPlot) localJFreeChart.getPlot();
GanttRenderer localGanttRenderer = (GanttRenderer) localCategoryPlot.getRenderer();
ChartUtil.hideLegend(localCategoryPlot);
StandardCategoryItemLabelGenerator localStandardCategoryItemLabelGenerator = new StandardCategoryItemLabelGenerator();
localGanttRenderer.setBaseItemLabelGenerator(localStandardCategoryItemLabelGenerator);
localGanttRenderer.setBaseItemLabelsVisible(true);
ItemLabelPosition localItemLabelPosition = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER);
localGanttRenderer.setBasePositiveItemLabelPosition(localItemLabelPosition);
ChartUtil.setNiceSeriesColors(paramIntervalCategoryDataset, localGanttRenderer);
return localJFreeChart;
}
示例12: createWaterfallChart
/**
* Creates a waterfall chart. The chart object returned by this method
* uses a {@link CategoryPlot} instance as the plot, with a
* {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
* range axis, and a {@link WaterfallBarRenderer} as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param valueAxisLabel the label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A waterfall chart.
*/
public static JFreeChart createWaterfallChart(String title,
String categoryAxisLabel, String valueAxisLabel,
CategoryDataset dataset, boolean legend) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
categoryAxis.setCategoryMargin(0.0);
ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
WaterfallBarRenderer renderer = new WaterfallBarRenderer();
ItemLabelPosition position = new ItemLabelPosition(
ItemLabelAnchor.CENTER, TextAnchor.CENTER,
TextAnchor.CENTER, 0.0);
renderer.setBasePositiveItemLabelPosition(position);
renderer.setBaseNegativeItemLabelPosition(position);
StandardCategoryToolTipGenerator generator
= new StandardCategoryToolTipGenerator();
renderer.setBaseToolTipGenerator(generator);
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.clearRangeMarkers();
Marker baseline = new ValueMarker(0.0);
baseline.setPaint(Color.black);
plot.addRangeMarker(baseline, Layer.FOREGROUND);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例13: createChart
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return a sample chart.
*/
protected JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart(
chartTitle, // chart title
domainLabel, // domain axis label
rangeLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL, // the plot orientation
!legendPanelOn, // include legend
true,
false
);
chart.setBackgroundPaint(Color.lightGray);
// get a reference to the plot for further customisation...
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setNoDataMessage("NO DATA!");
CategoryItemRenderer renderer = new CustomBarRenderer(
new Paint[] {Color.red, Color.blue, Color.green,
Color.yellow, Color.orange, Color.cyan,
Color.magenta, Color.blue}
);
renderer.setBaseItemLabelGenerator(
new StandardCategoryItemLabelGenerator()
);
renderer.setBaseItemLabelsVisible(true);
ItemLabelPosition p = new ItemLabelPosition(
ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0
);
renderer.setBasePositiveItemLabelPosition(p);
plot.setRenderer(renderer);
CategoryMarker marker = new CategoryMarker("Category 3");
marker.setLabel("Special");
marker.setPaint(new Color(0xDD, 0xFF, 0xDD, 0x80));
marker.setAlpha(0.5f);
marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT);
plot.addDomainMarker(marker, Layer.BACKGROUND);
// change the margin at the top of the range axis...
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setLowerMargin(0.15);
rangeAxis.setUpperMargin(0.15);
BarRenderer seriesRenderer = (BarRenderer) plot.getRenderer();
seriesRenderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
setCategorySummary(dataset);
return chart;
}
示例14: calculateLabelAnchorPoint
private Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor, Rectangle2D bar, PlotOrientation orientation) {
Point2D result = null;
double offset = getItemLabelAnchorOffset();
double x0 = bar.getX() - offset;
double x1 = bar.getX();
double x2 = bar.getX() + offset;
double x3 = bar.getCenterX();
double x4 = bar.getMaxX() - offset;
double x5 = bar.getMaxX();
double x6 = bar.getMaxX() + offset;
double y0 = bar.getMaxY() + offset;
double y1 = bar.getMaxY();
double y2 = bar.getMaxY() - offset;
double y3 = bar.getCenterY();
double y4 = bar.getMinY() + offset;
double y5 = bar.getMinY();
double y6 = bar.getMinY() - offset;
if (anchor == ItemLabelAnchor.CENTER) {
result = new Point2D.Double(x3, y3);
} else if (anchor == ItemLabelAnchor.INSIDE1) {
result = new Point2D.Double(x4, y4);
} else if (anchor == ItemLabelAnchor.INSIDE2) {
result = new Point2D.Double(x4, y4);
} else if (anchor == ItemLabelAnchor.INSIDE3) {
result = new Point2D.Double(x4, y3);
} else if (anchor == ItemLabelAnchor.INSIDE4) {
result = new Point2D.Double(x4, y2);
} else if (anchor == ItemLabelAnchor.INSIDE5) {
result = new Point2D.Double(x4, y2);
} else if (anchor == ItemLabelAnchor.INSIDE6) {
result = new Point2D.Double(x3, y2);
} else if (anchor == ItemLabelAnchor.INSIDE7) {
result = new Point2D.Double(x2, y2);
} else if (anchor == ItemLabelAnchor.INSIDE8) {
result = new Point2D.Double(x2, y2);
} else if (anchor == ItemLabelAnchor.INSIDE9) {
result = new Point2D.Double(x2, y3);
} else if (anchor == ItemLabelAnchor.INSIDE10) {
result = new Point2D.Double(x2, y4);
} else if (anchor == ItemLabelAnchor.INSIDE11) {
result = new Point2D.Double(x2, y4);
} else if (anchor == ItemLabelAnchor.INSIDE12) {
result = new Point2D.Double(x3, y4);
} else if (anchor == ItemLabelAnchor.OUTSIDE1) {
result = new Point2D.Double(x5, y6);
} else if (anchor == ItemLabelAnchor.OUTSIDE2) {
result = new Point2D.Double(x6, y5);
} else if (anchor == ItemLabelAnchor.OUTSIDE3) {
result = new Point2D.Double(x6, y3);
} else if (anchor == ItemLabelAnchor.OUTSIDE4) {
result = new Point2D.Double(x6, y1);
} else if (anchor == ItemLabelAnchor.OUTSIDE5) {
result = new Point2D.Double(x5, y0);
} else if (anchor == ItemLabelAnchor.OUTSIDE6) {
result = new Point2D.Double(x3, y0);
} else if (anchor == ItemLabelAnchor.OUTSIDE7) {
result = new Point2D.Double(x1, y0);
} else if (anchor == ItemLabelAnchor.OUTSIDE8) {
result = new Point2D.Double(x0, y1);
} else if (anchor == ItemLabelAnchor.OUTSIDE9) {
result = new Point2D.Double(x0, y3);
} else if (anchor == ItemLabelAnchor.OUTSIDE10) {
result = new Point2D.Double(x0, y5);
} else if (anchor == ItemLabelAnchor.OUTSIDE11) {
result = new Point2D.Double(x1, y6);
} else if (anchor == ItemLabelAnchor.OUTSIDE12) {
result = new Point2D.Double(x3, y6);
}
return result;
}