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


Java PlotOrientation.equals方法代码示例

本文整理汇总了Java中org.jfree.chart.plot.PlotOrientation.equals方法的典型用法代码示例。如果您正苦于以下问题:Java PlotOrientation.equals方法的具体用法?Java PlotOrientation.equals怎么用?Java PlotOrientation.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.plot.PlotOrientation的用法示例。


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

示例1: drawItem

import org.jfree.chart.plot.PlotOrientation; //导入方法依赖的package包/类
/**
 * Draws the block representing the specified item.
 * 
 * @param g2  the graphics device.
 * @param state  the state.
 * @param dataArea  the data area.
 * @param info  the plot rendering info.
 * @param plot  the plot.
 * @param domainAxis  the x-axis.
 * @param rangeAxis  the y-axis.
 * @param dataset  the dataset.
 * @param series  the series index.
 * @param item  the item index.
 * @param crosshairState  the crosshair state.
 * @param pass  the pass index.
 */
public void drawItem(Graphics2D g2, XYItemRendererState state, 
        Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, 
        ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, 
        int series, int item, CrosshairState crosshairState, int pass) {
    
    double x = dataset.getXValue(series, item);
    double y = dataset.getYValue(series, item);
    double z = 0.0;
    if (dataset instanceof XYZDataset) {
        z = ((XYZDataset) dataset).getZValue(series, item);
    }
    Paint p = this.paintScale.getPaint(z);
    double xx0 = domainAxis.valueToJava2D(x + this.xOffset, dataArea, 
            plot.getDomainAxisEdge());
    double yy0 = rangeAxis.valueToJava2D(y + this.yOffset, dataArea, 
            plot.getRangeAxisEdge());
    double xx1 = domainAxis.valueToJava2D(x + this.blockWidth 
            + this.xOffset, dataArea, plot.getDomainAxisEdge());
    double yy1 = rangeAxis.valueToJava2D(y + this.blockHeight 
            + this.yOffset, dataArea, plot.getRangeAxisEdge());
    Rectangle2D block;
    PlotOrientation orientation = plot.getOrientation();
    if (orientation.equals(PlotOrientation.HORIZONTAL)) {
        block = new Rectangle2D.Double(Math.min(yy0, yy1), 
                Math.min(xx0, xx1), Math.abs(yy1 - yy0), 
                Math.abs(xx0 - xx1));
    }
    else {
        block = new Rectangle2D.Double(Math.min(xx0, xx1), 
                Math.min(yy0, yy1), Math.abs(xx1 - xx0), 
                Math.abs(yy1 - yy0));            
    }
    g2.setPaint(p);
    g2.fill(block);
    g2.setStroke(new BasicStroke(1.0f));
    g2.draw(block);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:54,代码来源:XYBlockRenderer.java

示例2: drawItem

import org.jfree.chart.plot.PlotOrientation; //导入方法依赖的package包/类
/**
 * Draws the block representing the specified item.
 * 
 * @param g2  the graphics device.
 * @param state  the state.
 * @param dataArea  the data area.
 * @param info  the plot rendering info.
 * @param plot  the plot.
 * @param domainAxis  the x-axis.
 * @param rangeAxis  the y-axis.
 * @param dataset  the dataset.
 * @param series  the series index.
 * @param item  the item index.
 * @param crosshairState  the crosshair state.
 * @param pass  the pass index.
 */
public void drawItem(Graphics2D g2, XYItemRendererState state, 
        Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, 
        ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, 
        int series, int item, CrosshairState crosshairState, int pass) {
    
    double x = dataset.getXValue(series, item);
    double y = dataset.getYValue(series, item);
    double dx = 0.0;
    double dy = 0.0;
    if (dataset instanceof VectorXYDataset) {
        dx = ((VectorXYDataset) dataset).getDeltaXValue(series, item);
        dy = ((VectorXYDataset) dataset).getDeltaYValue(series, item);
    }
    double xx0 = domainAxis.valueToJava2D(x, dataArea, 
            plot.getDomainAxisEdge());
    double yy0 = rangeAxis.valueToJava2D(y, dataArea, 
            plot.getRangeAxisEdge());
    double xx1 = domainAxis.valueToJava2D(x + dx, dataArea, 
            plot.getDomainAxisEdge());
    double yy1 = rangeAxis.valueToJava2D(y + dy, dataArea, 
            plot.getRangeAxisEdge());
    Line2D line;
    PlotOrientation orientation = plot.getOrientation();
    if (orientation.equals(PlotOrientation.HORIZONTAL)) {
        line = new Line2D.Double(yy0, xx0, yy1, xx1);
    }
    else {
        line = new Line2D.Double(xx0, yy0, xx1, yy1);
    }
    g2.setPaint(getItemPaint(series, item));
    g2.setStroke(getItemStroke(series, item));
    g2.draw(line);
    
    // calculate the arrow head and draw it...
    double dxx = (xx1 - xx0);
    double dyy = (yy1 - yy0);
    double bx = xx0 + (1.0 - this.baseLength) * dxx;
    double by = yy0 + (1.0 - this.baseLength) * dyy;
    
    double cx = xx0 + (1.0 - this.headLength) * dxx;
    double cy = yy0 + (1.0 - this.headLength) * dyy;
 
    double angle = 0.0;
    if (dxx != 0.0) {
        angle = Math.PI / 2.0 - Math.atan(dyy / dxx);
    }
    double deltaX = 2.0 * Math.cos(angle);
    double deltaY = 2.0 * Math.sin(angle);
    
    double leftx = cx + deltaX;
    double lefty = cy - deltaY;
    double rightx = cx - deltaX;
    double righty = cy + deltaY;
    
    GeneralPath p = new GeneralPath();
    p.moveTo((float) xx1, (float) yy1);
    p.lineTo((float) rightx, (float) righty);
    p.lineTo((float) bx, (float) by);
    p.lineTo((float) leftx, (float) lefty);
    p.closePath();
    g2.draw(p);
    
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:81,代码来源:VectorRenderer.java


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