当前位置: 首页>>代码示例>>Java>>正文


Java NumberTick类代码示例

本文整理汇总了Java中org.jfree.chart.axis.NumberTick的典型用法代码示例。如果您正苦于以下问题:Java NumberTick类的具体用法?Java NumberTick怎么用?Java NumberTick使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NumberTick类属于org.jfree.chart.axis包,在下文中一共展示了NumberTick类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: refreshTicks

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Calculates the positions of the tick labels for the axis, storing the
 * results in the tick label list (ready for drawing).
 *
 * @param g2
 *            the graphics device.
 * @param state
 *            the axis state.
 * @param dataArea
 *            the area in which the plot should be drawn.
 * @param edge
 *            the location of the axis.
 *
 * @return A list of ticks.
 *
 */
@Override
public List<NumberTick> refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea,
        RectangleEdge edge) {
    List<NumberTick> result = new java.util.ArrayList<NumberTick>();
    if (RectangleEdge.isTopOrBottom(edge)) {
        result = this.refreshTicksHorizontal(g2, dataArea, edge);
    } else if (RectangleEdge.isLeftOrRight(edge)) {
        result = this.refreshTicksVertical(g2, dataArea, edge);
    }

    int size = result.size();
    NumberTick first = result.get(0);
    NumberTick last = result.get(size - 1);

    NumberTick newFirst = new NumberTick(0, "", first.getTextAnchor(), first.getRotationAnchor(),
        first.getAngle());

    NumberTick newLast = new NumberTick(0, "", last.getTextAnchor(), last.getRotationAnchor(), last
            .getAngle());

    result.set(0, newFirst);
    result.set(size - 1, newLast);
    return result;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:41,代码来源:MatrixChart.java

示例2: drawRadialGridLines

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Draw the radial gridlines - the rings.
 * 
 * @param g2  the drawing surface.
 * @param plot  the plot.
 * @param radialAxis  the radial axis.
 * @param ticks  the ticks.
 * @param dataArea  the data area.
 */
public void drawRadialGridLines(Graphics2D g2, 
                                PolarPlot plot,
                                ValueAxis radialAxis,
                                List ticks,
                                Rectangle2D dataArea) {
    
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    Point center = plot.translateValueThetaRadiusToJava2D(0.0, 0.0, dataArea);
    
    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        Point p = plot.translateValueThetaRadiusToJava2D(
            90.0, tick.getNumber().doubleValue(), dataArea
        );
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:DefaultPolarItemRenderer.java

示例3: refreshTicksHorizontal

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Returns a list of ticks for an axis at the top or bottom of the chart.
 * 
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param edge  the edge.
 * 
 * @return A list of ticks.
 */
protected List refreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, 
        RectangleEdge edge) {
    Range range = getRange();
    List ticks = new ArrayList();
    double start = Math.floor(calculateLog(getLowerBound()));
    double end = Math.ceil(calculateLog(getUpperBound()));
    double current = start;
    while (current <= end) {
        double v = calculateValue(current);
        if (range.contains(v)) {
            ticks.add(new NumberTick(new Double(v), createTickLabel(v), 
                    TextAnchor.TOP_CENTER, TextAnchor.CENTER, 0.0));
        }
        // add minor ticks (for gridlines)
        double next = Math.pow(this.base, current 
                + this.tickUnit.getSize());
        for (int i = 1; i < this.minorTickCount; i++) {
            double minorV = v + i * ((next - v) / this.minorTickCount);
            if (range.contains(minorV)) {
                ticks.add(new NumberTick(new Double(minorV), 
                    "", TextAnchor.TOP_CENTER, TextAnchor.CENTER, 0.0));
            }
        }
        current = current + this.tickUnit.getSize();
    }
    return ticks;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:LogAxis.java

示例4: refreshTicksVertical

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Returns a list of ticks for an axis at the left or right of the chart.
 * 
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param edge  the edge.
 * 
 * @return A list of ticks.
 */
protected List refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea, 
        RectangleEdge edge) {
    Range range = getRange();
    List ticks = new ArrayList();
    double start = Math.floor(calculateLog(getLowerBound()));
    double end = Math.ceil(calculateLog(getUpperBound()));
    double current = start;
    while (current <= end) {
        double v = calculateValue(current);
        if (range.contains(v)) {
            ticks.add(new NumberTick(new Double(v), createTickLabel(v), 
                    TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, 0.0));
        }
        // add minor ticks (for gridlines)
        double next = Math.pow(this.base, current 
                + this.tickUnit.getSize());
        for (int i = 1; i < this.minorTickCount; i++) {
            double minorV = v + i * ((next - v) / this.minorTickCount);
            if (range.contains(minorV)) {
                ticks.add(new NumberTick(new Double(minorV), "", 
                        TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, 0.0));
            }
        }
        current = current + this.tickUnit.getSize();
    }
    return ticks;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:LogAxis.java

示例5: drawRadialGridLines

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Draw the radial gridlines - the rings.
 * 
 * @param g2  the drawing surface.
 * @param plot  the plot.
 * @param radialAxis  the radial axis.
 * @param ticks  the ticks.
 * @param dataArea  the data area.
 */
public void drawRadialGridLines(Graphics2D g2, 
                                PolarPlot plot,
                                ValueAxis radialAxis,
                                List ticks,
                                Rectangle2D dataArea) {
    
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double axisMin = radialAxis.getLowerBound();
    Point center = plot.translateValueThetaRadiusToJava2D(axisMin, axisMin,
            dataArea);
    
    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        Point p = plot.translateValueThetaRadiusToJava2D(90.0, 
                tick.getNumber().doubleValue(), dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:DefaultPolarItemRenderer.java

示例6: drawRadialGridLines

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface (<code>null</code> not permitted).
 * @param plot  the plot (<code>null</code> not permitted).
 * @param radialAxis  the radial axis (<code>null</code> not permitted).
 * @param ticks  the ticks (<code>null</code> not permitted).
 * @param dataArea  the data area.
 */
@Override
public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, 
        ValueAxis radialAxis, List ticks, Rectangle2D dataArea) {

    ParamChecks.nullNotPermitted(radialAxis, "radialAxis");
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double centerValue;
    if (radialAxis.isInverted()) {
        centerValue = radialAxis.getUpperBound();
    } else {
        centerValue = radialAxis.getLowerBound();
    }
    Point center = plot.translateToJava2D(0, centerValue, radialAxis, dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        double angleDegrees = plot.isCounterClockwise() 
                ? plot.getAngleOffset() : -plot.getAngleOffset();
        Point p = plot.translateToJava2D(angleDegrees,
                tick.getNumber().doubleValue(), radialAxis, dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:43,代码来源:DefaultPolarItemRenderer.java

示例7: refreshAngleTicks

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Generates a list of tick values for the angular tick marks.
 *
 * @return A list of {@link NumberTick} instances.
 *
 * @since 1.0.10
 */
protected List refreshAngleTicks() {
    List ticks = new ArrayList();
    for (double currentTickVal = 0.0; currentTickVal < 360.0;
            currentTickVal += this.angleTickUnit.getSize()) {

        TextAnchor ta = calculateTextAnchor(currentTickVal);
        NumberTick tick = new NumberTick(new Double(currentTickVal),
            this.angleTickUnit.valueToString(currentTickVal),
            ta, TextAnchor.CENTER, 0.0);
        ticks.add(tick);
    }
    return ticks;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:21,代码来源:PolarPlot.java

示例8: drawRadialGridLines

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface ({@code null} not permitted).
 * @param plot  the plot ({@code null} not permitted).
 * @param radialAxis  the radial axis ({@code null} not permitted).
 * @param ticks  the ticks ({@code null} not permitted).
 * @param dataArea  the data area.
 */
@Override
public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, 
        ValueAxis radialAxis, List ticks, Rectangle2D dataArea) {

    Args.nullNotPermitted(radialAxis, "radialAxis");
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double centerValue;
    if (radialAxis.isInverted()) {
        centerValue = radialAxis.getUpperBound();
    } else {
        centerValue = radialAxis.getLowerBound();
    }
    Point center = plot.translateToJava2D(0, centerValue, radialAxis, dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        double angleDegrees = plot.isCounterClockwise() 
                ? plot.getAngleOffset() : -plot.getAngleOffset();
        Point p = plot.translateToJava2D(angleDegrees,
                tick.getNumber().doubleValue(), radialAxis, dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:43,代码来源:DefaultPolarItemRenderer.java

示例9: refreshTicksHorizontal

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Returns a list of ticks for an axis at the top or bottom of the chart.
 * 
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param edge  the edge.
 * 
 * @return A list of ticks.
 */
protected List refreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, 
        RectangleEdge edge) {
    Range range = getRange();
    List ticks = new ArrayList();
    double start = Math.floor(calculateLog(getLowerBound()));
    double end = Math.ceil(calculateLog(getUpperBound()));
    double current = start;
    while (current <= end) {

    	double v = calculateValue(current);
        if (range.contains(v)) {
            ticks.add(new NumberTick(new Double(v), createTickLabel(v), 
                    TextAnchor.TOP_CENTER, TextAnchor.CENTER, 0.0));
        }
        // add minor ticks (for gridlines)
        double next = Math.pow(this.base, current 
                + this.tickUnit.getSize());
        for (int i = 1; i < this.minorTickCount; i++) {
            double minorV = v + i * ((next - v) / this.minorTickCount);
            if (range.contains(minorV)) {
                ticks.add(new NumberTick(new Double(minorV), 
                    "", TextAnchor.TOP_CENTER, TextAnchor.CENTER, 0.0));
            }
        }
        current = current + this.tickUnit.getSize();
    }
    return ticks;
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:38,代码来源:PrismLogarithmicAxis.java

示例10: refreshTicksVertical

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Returns a list of ticks for an axis at the left or right of the chart.
 * 
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param edge  the edge.
 * 
 * @return A list of ticks.
 */
protected List refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea, 
        RectangleEdge edge) {
    Range range = getRange();
    List ticks = new ArrayList();
    double start = Math.floor(calculateLog(getLowerBound()));
    double end = Math.ceil(calculateLog(getUpperBound()));
    double current = start;
    
    while (current <= end) {
    	
    	
        double v = calculateValue(current);
        if (range.contains(v)) {
            ticks.add(new NumberTick(new Double(v), createTickLabel(v), 
                    TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, 0.0));
        }
        // add minor ticks (for gridlines)
        double next = Math.pow(this.base, current 
                + this.tickUnit.getSize());
        for (int i = 1; i < this.minorTickCount; i++) {
            double minorV = v + i * ((next - v) / this.minorTickCount);
            if (range.contains(minorV)) {
                ticks.add(new NumberTick(new Double(minorV), "", 
                        TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, 0.0));
            }
        }
        current = current + this.tickUnit.getSize();
    }
    return ticks;
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:40,代码来源:PrismLogarithmicAxis.java

示例11: drawRadialGridLines

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface.
 * @param plot  the plot.
 * @param radialAxis  the radial axis.
 * @param ticks  the ticks.
 * @param dataArea  the data area.
 */
public void drawRadialGridLines(Graphics2D g2,
                                PolarPlot plot,
                                ValueAxis radialAxis,
                                List ticks,
                                Rectangle2D dataArea) {

    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double axisMin = radialAxis.getLowerBound();
    Point center = plot.translateValueThetaRadiusToJava2D(axisMin, axisMin,
            dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        Point p = plot.translateValueThetaRadiusToJava2D(90.0,
                tick.getNumber().doubleValue(), dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:38,代码来源:DefaultPolarItemRenderer.java

示例12: refreshAngleTicks

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
/**
 * Generates a list of tick values for the angular tick marks.
 *
 * @return A list of {@link NumberTick} instances.
 *
 * @since 1.0.10
 */
protected List refreshAngleTicks() {
    List ticks = new ArrayList();
    for (double currentTickVal = 0.0; currentTickVal < 360.0;
            currentTickVal += this.angleTickUnit.getSize()) {
        NumberTick tick = new NumberTick(new Double(currentTickVal),
            this.angleTickUnit.valueToString(currentTickVal),
            TextAnchor.CENTER, TextAnchor.CENTER, 0.0);
        ticks.add(tick);
    }
    return ticks;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:19,代码来源:PolarPlot.java

示例13: addHorizontalTicks

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
private void addHorizontalTicks(RectangleEdge edge, List ticks, double lowerBoundVal, String tickLabel, double tickVal) {
    if (tickVal >= lowerBoundVal - SMALL_LOG_VALUE) {
        //tick value not below lowest data value
        TextAnchor anchor;
        TextAnchor rotationAnchor;
        double angle = 0.0;
        if (isVerticalTickLabels()) {
            anchor = TextAnchor.CENTER_RIGHT;
            rotationAnchor = TextAnchor.CENTER_RIGHT;
            if (edge == RectangleEdge.TOP) {
                angle = Math.PI / 2.0;
            } else {
                angle = -Math.PI / 2.0;
            }
        } else {
            if (edge == RectangleEdge.TOP) {
                anchor = TextAnchor.BOTTOM_CENTER;
                rotationAnchor = TextAnchor.BOTTOM_CENTER;
            } else {
                anchor = TextAnchor.TOP_CENTER;
                rotationAnchor = TextAnchor.TOP_CENTER;
            }
        }

        ticks.add(new NumberTick(new Double(tickVal), tickLabel, anchor, rotationAnchor, angle));
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:28,代码来源:CustomLogarithmicAxis.java

示例14: addVerticalTicks

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
private void addVerticalTicks(RectangleEdge edge, List ticks, double lowerBoundVal, String tickLabel, double tickVal) {
    if (tickVal >= lowerBoundVal - SMALL_LOG_VALUE) {
        //tick value not below lowest data value
        TextAnchor anchor;
        TextAnchor rotationAnchor;
        double angle = 0.0;
        if (isVerticalTickLabels()) {
            if (edge == RectangleEdge.LEFT) {
                anchor = TextAnchor.BOTTOM_CENTER;
                rotationAnchor = TextAnchor.BOTTOM_CENTER;
                angle = -Math.PI / 2.0;
            } else {
                anchor = TextAnchor.BOTTOM_CENTER;
                rotationAnchor = TextAnchor.BOTTOM_CENTER;
                angle = Math.PI / 2.0;
            }
        } else {
            if (edge == RectangleEdge.LEFT) {
                anchor = TextAnchor.CENTER_RIGHT;
                rotationAnchor = TextAnchor.CENTER_RIGHT;
            } else {
                anchor = TextAnchor.CENTER_LEFT;
                rotationAnchor = TextAnchor.CENTER_LEFT;
            }
        }
        //create tick object and add to list:
        ticks.add(new NumberTick(new Double(tickVal), tickLabel, anchor, rotationAnchor, angle));
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:30,代码来源:CustomLogarithmicAxis.java

示例15: testRefreshTicksForNegativeAxisRange

import org.jfree.chart.axis.NumberTick; //导入依赖的package包/类
@Test
public void testRefreshTicksForNegativeAxisRange() throws Exception {
    CustomLogarithmicAxis testAxis = new CustomLogarithmicAxis("testAxis");
    testAxis.setRange(-300, -3);
    List ticks = testAxis.refreshTicks(RectangleEdge.TOP, CustomLogarithmicAxis.HORIZONTAL);
    assertNotNull(ticks);
    assertEquals(19, ticks.size());
    // we expect labels at the power of 10 values only
    assertEquals("", ((NumberTick) ticks.get(0)).getText());
    assertEquals("", ((NumberTick) ticks.get(1)).getText());
    assertEquals("-10", ((NumberTick) ticks.get(7)).getText());
    assertEquals("", ((NumberTick) ticks.get(9)).getText());
    assertEquals("-100", ((NumberTick) ticks.get(16)).getText());
    assertEquals("", ((NumberTick) ticks.get(18)).getText());
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:16,代码来源:CustomLogarithmicAxisTest.java


注:本文中的org.jfree.chart.axis.NumberTick类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。