當前位置: 首頁>>代碼示例>>Java>>正文


Java CategoryDataset.getColumnIndex方法代碼示例

本文整理匯總了Java中org.jfree.data.category.CategoryDataset.getColumnIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java CategoryDataset.getColumnIndex方法的具體用法?Java CategoryDataset.getColumnIndex怎麽用?Java CategoryDataset.getColumnIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.data.category.CategoryDataset的用法示例。


在下文中一共展示了CategoryDataset.getColumnIndex方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: draw

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 */
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea,
                 CategoryAxis domainAxis, ValueAxis rangeAxis) {

    CategoryDataset dataset = plot.getDataset();
    int catIndex = dataset.getColumnIndex(this.category);
    int catCount = dataset.getColumnCount();

    float anchorX = 0.0f;
    float anchorY = 0.0f;
    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
            plot.getDomainAxisLocation(), orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
            plot.getRangeAxisLocation(), orientation);
    
    if (orientation == PlotOrientation.HORIZONTAL) {
        anchorY = (float) domainAxis.getCategoryJava2DCoordinate(
                this.categoryAnchor, catIndex, catCount, dataArea, 
                domainEdge);
        anchorX = (float) rangeAxis.valueToJava2D(this.value, dataArea, 
                rangeEdge);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorX = (float) domainAxis.getCategoryJava2DCoordinate(
                this.categoryAnchor, catIndex, catCount, dataArea, 
                domainEdge);
        anchorY = (float) rangeAxis.valueToJava2D(this.value, dataArea, 
                rangeEdge);
    }
    g2.setFont(getFont());
    g2.setPaint(getPaint());
    TextUtilities.drawRotatedString(getText(), g2, anchorX, anchorY,
            getTextAnchor(), getRotationAngle(), getRotationAnchor());

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:45,代碼來源:CategoryTextAnnotation.java

示例2: draw

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 */
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea,
                 CategoryAxis domainAxis, ValueAxis rangeAxis) {

    CategoryDataset dataset = plot.getDataset();
    int catIndex = dataset.getColumnIndex(this.category);
    int catCount = dataset.getColumnCount();

    float anchorX = 0.0f;
    float anchorY = 0.0f;
    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(plot.getDomainAxisLocation(), 
                                                              orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(plot.getRangeAxisLocation(), 
                                                            orientation);
    
    if (orientation == PlotOrientation.HORIZONTAL) {
        anchorY = (float) domainAxis.getCategoryJava2DCoordinate(
            this.categoryAnchor, catIndex, catCount, dataArea, domainEdge
        );
        anchorX = (float) rangeAxis.valueToJava2D(this.value, dataArea, rangeEdge);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorX = (float) domainAxis.getCategoryJava2DCoordinate(
            this.categoryAnchor, catIndex, catCount, dataArea, domainEdge
        );
        anchorY = (float) rangeAxis.valueToJava2D(this.value, dataArea, rangeEdge);
    }
    g2.setFont(getFont());
    g2.setPaint(getPaint());
    RefineryUtilities.drawRotatedString(
        getText(), 
        g2,
        anchorX, 
        anchorY,
        getTextAnchor(),
        getRotationAnchor(),
        getRotationAngle()
    );

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:50,代碼來源:CategoryTextAnnotation.java

示例3: draw

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 */
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis) {

    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
            plot.getDomainAxisLocation(), orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
            plot.getRangeAxisLocation(), orientation);
    CategoryDataset dataset = plot.getDataset();
    int catIndex = dataset.getColumnIndex(getCategory());
    int catCount = dataset.getColumnCount();
    double j2DX = domainAxis.getCategoryMiddle(catIndex, catCount, 
            dataArea, domainEdge);
    double j2DY = rangeAxis.valueToJava2D(getValue(), dataArea, rangeEdge);
    if (orientation == PlotOrientation.HORIZONTAL) {
        double temp = j2DX;
        j2DX = j2DY;
        j2DY = temp;
    }
    double startX = j2DX + Math.cos(this.angle) * this.baseRadius;
    double startY = j2DY + Math.sin(this.angle) * this.baseRadius;

    double endX = j2DX + Math.cos(this.angle) * this.tipRadius;
    double endY = j2DY + Math.sin(this.angle) * this.tipRadius;

    double arrowBaseX = endX + Math.cos(this.angle) * this.arrowLength;
    double arrowBaseY = endY + Math.sin(this.angle) * this.arrowLength;

    double arrowLeftX = arrowBaseX 
        + Math.cos(this.angle + Math.PI / 2.0) * this.arrowWidth;
    double arrowLeftY = arrowBaseY 
        + Math.sin(this.angle + Math.PI / 2.0) * this.arrowWidth;

    double arrowRightX = arrowBaseX 
        - Math.cos(this.angle + Math.PI / 2.0) * this.arrowWidth;
    double arrowRightY = arrowBaseY 
        - Math.sin(this.angle + Math.PI / 2.0) * this.arrowWidth;

    GeneralPath arrow = new GeneralPath();
    arrow.moveTo((float) endX, (float) endY);
    arrow.lineTo((float) arrowLeftX, (float) arrowLeftY);
    arrow.lineTo((float) arrowRightX, (float) arrowRightY);
    arrow.closePath();

    g2.setStroke(this.arrowStroke);
    g2.setPaint(this.arrowPaint);
    Line2D line = new Line2D.Double(startX, startY, endX, endY);
    g2.draw(line);
    g2.fill(arrow);

    // draw the label
    g2.setFont(getFont());
    g2.setPaint(getPaint());
    double labelX = j2DX 
        + Math.cos(this.angle) * (this.baseRadius + this.labelOffset);
    double labelY = j2DY 
        + Math.sin(this.angle) * (this.baseRadius + this.labelOffset);
    /* Rectangle2D hotspot = */ TextUtilities.drawAlignedString(getText(), 
            g2, (float) labelX, (float) labelY, getTextAnchor());
    // TODO: implement the entity for the annotation
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:72,代碼來源:CategoryPointerAnnotation.java

示例4: draw

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 */
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea,
                 CategoryAxis domainAxis, ValueAxis rangeAxis) {

    CategoryDataset dataset = plot.getDataset();
    int catIndex1 = dataset.getColumnIndex(this.category1);
    int catIndex2 = dataset.getColumnIndex(this.category2);
    int catCount = dataset.getColumnCount();

    double lineX1 = 0.0f;
    double lineY1 = 0.0f;
    double lineX2 = 0.0f;
    double lineY2 = 0.0f;
    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
        plot.getDomainAxisLocation(), orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
        plot.getRangeAxisLocation(), orientation);
    
    if (orientation == PlotOrientation.HORIZONTAL) {
        lineY1 = domainAxis.getCategoryJava2DCoordinate(
            CategoryAnchor.MIDDLE, catIndex1, catCount, dataArea, 
            domainEdge);
        lineX1 = rangeAxis.valueToJava2D(this.value1, dataArea, rangeEdge);
        lineY2 = domainAxis.getCategoryJava2DCoordinate(
            CategoryAnchor.MIDDLE, catIndex2, catCount, dataArea, 
            domainEdge);
        lineX2 = rangeAxis.valueToJava2D(this.value2, dataArea, rangeEdge);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        lineX1 = domainAxis.getCategoryJava2DCoordinate(
            CategoryAnchor.MIDDLE, catIndex1, catCount, dataArea, 
            domainEdge);
        lineY1 = rangeAxis.valueToJava2D(this.value1, dataArea, rangeEdge);
        lineX2 = domainAxis.getCategoryJava2DCoordinate(
            CategoryAnchor.MIDDLE, catIndex2, catCount, dataArea, 
            domainEdge);
        lineY2 = rangeAxis.valueToJava2D(this.value2, dataArea, rangeEdge);
    }
    g2.setPaint(this.paint);
    g2.setStroke(this.stroke);
    g2.drawLine((int) lineX1, (int) lineY1, (int) lineX2, (int) lineY2);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:52,代碼來源:CategoryLineAnnotation.java

示例5: createPieDatasetForColumn

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single column.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param columnKey  the column key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForColumn(CategoryDataset dataset,
                                                   Comparable columnKey) {

    int column = dataset.getColumnIndex(columnKey);
    return createPieDatasetForColumn(dataset, column);

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:17,代碼來源:DatasetUtilities.java

示例6: createPieDatasetForColumn

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single column.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param columnKey  the column key.
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForColumn(CategoryDataset dataset,
                                                   Comparable columnKey) {
    int column = dataset.getColumnIndex(columnKey);
    return createPieDatasetForColumn(dataset, column);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:15,代碼來源:DatasetUtilities.java


注:本文中的org.jfree.data.category.CategoryDataset.getColumnIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。