本文整理汇总了Java中org.jfree.chart.labels.ItemLabelAnchor类的典型用法代码示例。如果您正苦于以下问题:Java ItemLabelAnchor类的具体用法?Java ItemLabelAnchor怎么用?Java ItemLabelAnchor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemLabelAnchor类属于org.jfree.chart.labels包,在下文中一共展示了ItemLabelAnchor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setLineRender
import org.jfree.chart.labels.ItemLabelAnchor; //导入依赖的package包/类
public static void setLineRender(CategoryPlot plot, boolean isShowDataLabels, boolean isShapesVisible) {
plot.setNoDataMessage(NO_DATA_MSG);
plot.setInsets(new RectangleInsets(10, 10, 0, 10), false);
LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setStroke(new BasicStroke(1.5F));
if (isShowDataLabels) {
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING,
NumberFormat.getInstance()));
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));
}
renderer.setBaseShapesVisible(isShapesVisible);
setXAixs(plot);
setYAixs(plot);
}
示例2: isInternalAnchor
import org.jfree.chart.labels.ItemLabelAnchor; //导入依赖的package包/类
/**
* 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: BarRenderer3D
import org.jfree.chart.labels.ItemLabelAnchor; //导入依赖的package包/类
/**
* Constructs a new renderer with the specified '3D effect'.
*
* @param xOffset the x-offset for the 3D effect.
* @param yOffset the y-offset for the 3D effect.
*/
public BarRenderer3D(double xOffset, double yOffset) {
super();
this.xOffset = xOffset;
this.yOffset = yOffset;
this.wallPaint = DEFAULT_WALL_PAINT;
// set the default item label positions
ItemLabelPosition p1 = new ItemLabelPosition(
ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER
);
setPositiveItemLabelPosition(p1);
ItemLabelPosition p2 = new ItemLabelPosition(
ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER
);
setNegativeItemLabelPosition(p2);
}
示例4: BarRenderer3D
import org.jfree.chart.labels.ItemLabelAnchor; //导入依赖的package包/类
/**
* Constructs a new renderer with the specified '3D effect'.
*
* @param xOffset the x-offset for the 3D effect.
* @param yOffset the y-offset for the 3D effect.
*/
public BarRenderer3D(double xOffset, double yOffset) {
super();
this.xOffset = xOffset;
this.yOffset = yOffset;
this.wallPaint = DEFAULT_WALL_PAINT;
// set the default item label positions
ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12,
TextAnchor.TOP_CENTER);
setPositiveItemLabelPosition(p1);
ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12,
TextAnchor.TOP_CENTER);
setNegativeItemLabelPosition(p2);
}
示例5: isInternalAnchor
import org.jfree.chart.labels.ItemLabelAnchor; //导入依赖的package包/类
/**
* 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;
}
示例6: BarRenderer3D
import org.jfree.chart.labels.ItemLabelAnchor; //导入依赖的package包/类
/**
* Constructs a new renderer with the specified '3D effect'.
*
* @param xOffset the x-offset for the 3D effect.
* @param yOffset the y-offset for the 3D effect.
*/
public BarRenderer3D(double xOffset, double yOffset) {
super();
this.xOffset = xOffset;
this.yOffset = yOffset;
this.wallPaint = DEFAULT_WALL_PAINT;
// set the default item label positions
ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12,
TextAnchor.TOP_CENTER);
setBasePositiveItemLabelPosition(p1);
ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12,
TextAnchor.TOP_CENTER);
setBaseNegativeItemLabelPosition(p2);
}
示例7: isInternalAnchor
import org.jfree.chart.labels.ItemLabelAnchor; //导入依赖的package包/类
/**
* 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;
}
示例8: createBarChart
import org.jfree.chart.labels.ItemLabelAnchor; //导入依赖的package包/类
/**
* Creates a bar 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 BarRenderer} 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 bar chart.
*/
public static JFreeChart createBarChart(String title,
String categoryAxisLabel, String valueAxisLabel,
CategoryDataset dataset, boolean legend) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
BarRenderer renderer = new BarRenderer();
ItemLabelPosition position1 = new ItemLabelPosition(
ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
renderer.setBasePositiveItemLabelPosition(position1);
ItemLabelPosition position2 = new ItemLabelPosition(
ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
renderer.setBaseNegativeItemLabelPosition(position2);
renderer.setBaseToolTipGenerator(
new StandardCategoryToolTipGenerator());
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例9: customizeRenderer
import org.jfree.chart.labels.ItemLabelAnchor; //导入依赖的package包/类
/** Customize renderer. */
private void customizeRenderer(CategoryPlot plot) {
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setMaximumBarWidth(0.5);
renderer.setSeriesPaint(0, Color.BLACK);
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelPaint(Color.white);
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(
ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER,
0.0));
renderer.setBarPainter(new StandardBarPainter());
renderer.setShadowVisible(false);
}