本文整理汇总了Java中org.jfree.chart.axis.CategoryAnchor类的典型用法代码示例。如果您正苦于以下问题:Java CategoryAnchor类的具体用法?Java CategoryAnchor怎么用?Java CategoryAnchor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CategoryAnchor类属于org.jfree.chart.axis包,在下文中一共展示了CategoryAnchor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
CategoryTextAnnotation a1 = new CategoryTextAnnotation("Test", "Category", 1.0);
CategoryTextAnnotation a2 = new CategoryTextAnnotation("Test", "Category", 1.0);
assertTrue(a1.equals(a2));
// category
a1.setCategory("Category 2");
assertFalse(a1.equals(a2));
a2.setCategory("Category 2");
assertTrue(a1.equals(a2));
// categoryAnchor
a1.setCategoryAnchor(CategoryAnchor.START);
assertFalse(a1.equals(a2));
a2.setCategoryAnchor(CategoryAnchor.START);
assertTrue(a1.equals(a2));
// value
a1.setValue(0.15);
assertFalse(a1.equals(a2));
a2.setValue(0.15);
assertTrue(a1.equals(a2));
}
示例2: drawDomainGridlines
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Draws the domain gridlines for the plot, if they are visible.
*
* @param g2 the graphics device.
* @param dataArea the area inside the axes.
*
* @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
*/
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea) {
if (!isDomainGridlinesVisible()) {
return;
}
CategoryAnchor anchor = getDomainGridlinePosition();
RectangleEdge domainAxisEdge = getDomainAxisEdge();
CategoryDataset dataset = getDataset();
if (dataset == null) {
return;
}
CategoryAxis axis = getDomainAxis();
if (axis != null) {
int columnCount = dataset.getColumnCount();
for (int c = 0; c < columnCount; c++) {
double xx = axis.getCategoryJava2DCoordinate(anchor, c,
columnCount, dataArea, domainAxisEdge);
CategoryItemRenderer renderer1 = getRenderer();
if (renderer1 != null) {
renderer1.drawDomainGridline(g2, this, dataArea, xx);
}
}
}
}
示例3: drawDomainGridlines
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Draws the gridlines for the plot.
*
* @param g2 the graphics device.
* @param dataArea the area inside the axes.
*/
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea) {
// draw the domain grid lines, if any...
if (isDomainGridlinesVisible()) {
CategoryAnchor anchor = getDomainGridlinePosition();
RectangleEdge domainAxisEdge = getDomainAxisEdge();
Stroke gridStroke = getDomainGridlineStroke();
Paint gridPaint = getDomainGridlinePaint();
if ((gridStroke != null) && (gridPaint != null)) {
// iterate over the categories
CategoryDataset data = getDataset();
if (data != null) {
CategoryAxis axis = getDomainAxis();
if (axis != null) {
int columnCount = data.getColumnCount();
for (int c = 0; c < columnCount; c++) {
double xx = axis.getCategoryJava2DCoordinate(
anchor, c, columnCount, dataArea, domainAxisEdge
);
CategoryItemRenderer renderer1 = getRenderer();
if (renderer1 != null) {
renderer1.drawDomainGridline(g2, this, dataArea, xx);
}
}
}
}
}
}
}
示例4: testEquals
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Problem equals method.
*/
public void testEquals() {
assertEquals(CategoryAnchor.START, CategoryAnchor.START);
assertEquals(CategoryAnchor.MIDDLE, CategoryAnchor.MIDDLE);
assertEquals(CategoryAnchor.END, CategoryAnchor.END);
assertFalse(CategoryAnchor.START.equals(CategoryAnchor.END));
assertFalse(CategoryAnchor.MIDDLE.equals(CategoryAnchor.END));
}
示例5: testEquals
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Check that the equals() method distinguishes known instances.
*/
public void testEquals() {
assertEquals(CategoryAnchor.START, CategoryAnchor.START);
assertEquals(CategoryAnchor.MIDDLE, CategoryAnchor.MIDDLE);
assertEquals(CategoryAnchor.END, CategoryAnchor.END);
assertFalse(CategoryAnchor.START.equals(CategoryAnchor.END));
assertFalse(CategoryAnchor.MIDDLE.equals(CategoryAnchor.END));
}
示例6: testHashCode
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
CategoryAnchor a1 = CategoryAnchor.START;
CategoryAnchor a2 = CategoryAnchor.START;
assertTrue(a1.equals(a2));
int h1 = a1.hashCode();
int h2 = a2.hashCode();
assertEquals(h1, h2);
}
示例7: testEquals
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
CategoryTextAnnotation a1 = new CategoryTextAnnotation(
"Test", "Category", 1.0
);
CategoryTextAnnotation a2 = new CategoryTextAnnotation(
"Test", "Category", 1.0
);
assertTrue(a1.equals(a2));
// category
a1.setCategory("Category 2");
assertFalse(a1.equals(a2));
a2.setCategory("Category 2");
assertTrue(a1.equals(a2));
// categoryAnchor
a1.setCategoryAnchor(CategoryAnchor.START);
assertFalse(a1.equals(a2));
a2.setCategoryAnchor(CategoryAnchor.START);
assertTrue(a1.equals(a2));
// value
a1.setValue(0.15);
assertFalse(a1.equals(a2));
a2.setValue(0.15);
assertTrue(a1.equals(a2));
}
示例8: drawDomainGridlines
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Draws the gridlines for the plot.
*
* @param g2 the graphics device.
* @param dataArea the area inside the axes.
*
* @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
*/
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea) {
// draw the domain grid lines, if any...
if (isDomainGridlinesVisible()) {
CategoryAnchor anchor = getDomainGridlinePosition();
RectangleEdge domainAxisEdge = getDomainAxisEdge();
Stroke gridStroke = getDomainGridlineStroke();
Paint gridPaint = getDomainGridlinePaint();
if ((gridStroke != null) && (gridPaint != null)) {
// iterate over the categories
CategoryDataset data = getDataset();
if (data != null) {
CategoryAxis axis = getDomainAxis();
if (axis != null) {
int columnCount = data.getColumnCount();
for (int c = 0; c < columnCount; c++) {
double xx = axis.getCategoryJava2DCoordinate(
anchor, c, columnCount, dataArea,
domainAxisEdge);
CategoryItemRenderer renderer1 = getRenderer();
if (renderer1 != null) {
renderer1.drawDomainGridline(g2, this,
dataArea, xx);
}
}
}
}
}
}
}
示例9: CategoryTextAnnotation
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Creates a new annotation to be displayed at the given location.
*
* @param text the text (<code>null</code> not permitted).
* @param category the category (<code>null</code> not permitted).
* @param value the value.
*/
public CategoryTextAnnotation(String text, Comparable category,
double value) {
super(text);
if (category == null) {
throw new IllegalArgumentException("Null 'category' argument.");
}
this.category = category;
this.value = value;
this.categoryAnchor = CategoryAnchor.MIDDLE;
}
示例10: testEquals
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
@Test
public void testEquals() {
CategoryTextAnnotation a1 = new CategoryTextAnnotation("Test",
"Category", 1.0);
CategoryTextAnnotation a2 = new CategoryTextAnnotation("Test",
"Category", 1.0);
assertTrue(a1.equals(a2));
// category
a1.setCategory("Category 2");
assertFalse(a1.equals(a2));
a2.setCategory("Category 2");
assertTrue(a1.equals(a2));
// categoryAnchor
a1.setCategoryAnchor(CategoryAnchor.START);
assertFalse(a1.equals(a2));
a2.setCategoryAnchor(CategoryAnchor.START);
assertTrue(a1.equals(a2));
// value
a1.setValue(0.15);
assertFalse(a1.equals(a2));
a2.setValue(0.15);
assertTrue(a1.equals(a2));
}
示例11: CategoryTextAnnotation
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Creates a new annotation to be displayed at the given location.
*
* @param text the text (<code>null</code> not permitted).
* @param category the category (<code>null</code> not permitted).
* @param value the value.
*/
public CategoryTextAnnotation(String text, Comparable category,
double value) {
super(text);
ParamChecks.nullNotPermitted(category, "category");
this.category = category;
this.value = value;
this.categoryAnchor = CategoryAnchor.MIDDLE;
}
示例12: CategoryTextAnnotation
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Creates a new annotation to be displayed at the given location.
*
* @param text the text ({@code null} not permitted).
* @param category the category ({@code null} not permitted).
* @param value the value.
*/
public CategoryTextAnnotation(String text, Comparable category,
double value) {
super(text);
Args.nullNotPermitted(category, "category");
this.category = category;
this.value = value;
this.categoryAnchor = CategoryAnchor.MIDDLE;
}
示例13: drawDomainGridlines
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Draws the gridlines for the plot.
*
* @param g2 the graphics device.
* @param dataArea the area inside the axes.
*
* @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
*/
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea) {
// draw the domain grid lines, if any...
if (isDomainGridlinesVisible()) {
CategoryAnchor anchor = getDomainGridlinePosition();
RectangleEdge domainAxisEdge = getDomainAxisEdge();
Stroke gridStroke = getDomainGridlineStroke();
Paint gridPaint = getDomainGridlinePaint();
if ((gridStroke != null) && (gridPaint != null)) {
// iterate over the categories
CategoryDataset data = getDataset();
if (data != null) {
CategoryAxis axis = getDomainAxis();
if (axis != null) {
int columnCount = data.getColumnCount();
for (int c = 0; c < columnCount; c++) {
double xx = axis.getCategoryJava2DCoordinate(
anchor, c, columnCount, dataArea,
domainAxisEdge);
CategoryItemRenderer renderer1 = getRenderer();
if (renderer1 != null) {
renderer1.drawDomainGridline(g2, this,
dataArea, xx);
}
}
}
}
}
}
}
示例14: CategoryTextAnnotation
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Creates a new annotation to be displayed at the given location.
*
* @param text the text (<code>null</code> not permitted).
* @param category the category (<code>null</code> not permitted).
* @param value the value.
*/
public CategoryTextAnnotation(String text, Comparable category,
double value) {
super(text);
if (category == null) {
throw new IllegalArgumentException("Null 'category' argument.");
}
this.category = category;
this.value = value;
this.categoryAnchor = CategoryAnchor.MIDDLE;
}
示例15: testHashCode
import org.jfree.chart.axis.CategoryAnchor; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
CategoryAnchor a1 = CategoryAnchor.START;
CategoryAnchor a2 = CategoryAnchor.START;
assertTrue(a1.equals(a2));
int h1 = a1.hashCode();
int h2 = a2.hashCode();
assertEquals(h1, h2);
}