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


Java XYDataset.getX方法代碼示例

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


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

示例1: createItemArray

import org.jfree.data.xy.XYDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the {@link MessageFormat} class
 * for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return the items (never <code>null</code>).
 */
protected Object[] createItemArray(XYDataset dataset, int series, int item) {
    Object[] result = new Object[8];
    result[0] = dataset.getSeriesName(series);
    Number x = dataset.getX(series, item);
    if (getXDateFormat() != null) {
        result[1] = getXDateFormat().format(new Date(x.longValue()));   
    }
    else {
        result[1] = getXFormat().format(x);
    }
    NumberFormat formatter = getYFormat();
    
    if (dataset instanceof BoxAndWhiskerXYDataset) {
        BoxAndWhiskerXYDataset d = (BoxAndWhiskerXYDataset) dataset;
        result[2] = formatter.format(d.getMeanValue(series, item));
        result[3] = formatter.format(d.getMedianValue(series, item));
        result[4] = formatter.format(d.getMinRegularValue(series, item));
        result[5] = formatter.format(d.getMaxRegularValue(series, item));
        result[6] = formatter.format(d.getQ1Value(series, item));
        result[7] = formatter.format(d.getQ3Value(series, item));
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:34,代碼來源:BoxAndWhiskerXYToolTipGenerator.java

示例2: createItemArray

import org.jfree.data.xy.XYDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the {@link MessageFormat} class
 * for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(XYDataset dataset, int series, int item) {
    Object[] result = new Object[3];
    result[0] = dataset.getSeriesName(series);
    Number x = dataset.getX(series, item);
    if (this.xDateFormat != null) {
        result[1] = this.xDateFormat.format(x);   
    }
    else {
        result[1] = this.xFormat.format(x);
    }
    Number y = dataset.getY(series, item);
    if (this.yDateFormat != null) {
        result[2] = this.yDateFormat.format(y);   
    }
    else {
        result[2] = this.yFormat.format(y);
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:AbstractXYItemLabelGenerator.java

示例3: createItemArray

import org.jfree.data.xy.XYDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the 
 * {@link MessageFormat} class for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(XYDataset dataset, int series, 
                                   int item) {
    Object[] result = new Object[8];
    result[0] = dataset.getSeriesKey(series).toString();
    Number x = dataset.getX(series, item);
    if (getXDateFormat() != null) {
        result[1] = getXDateFormat().format(new Date(x.longValue()));   
    }
    else {
        result[1] = getXFormat().format(x);
    }
    NumberFormat formatter = getYFormat();
    
    if (dataset instanceof BoxAndWhiskerXYDataset) {
        BoxAndWhiskerXYDataset d = (BoxAndWhiskerXYDataset) dataset;
        result[2] = formatter.format(d.getMeanValue(series, item));
        result[3] = formatter.format(d.getMedianValue(series, item));
        result[4] = formatter.format(d.getMinRegularValue(series, item));
        result[5] = formatter.format(d.getMaxRegularValue(series, item));
        result[6] = formatter.format(d.getQ1Value(series, item));
        result[7] = formatter.format(d.getQ3Value(series, item));
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:35,代碼來源:BoxAndWhiskerXYToolTipGenerator.java

示例4: drawItem

import org.jfree.data.xy.XYDataset; //導入方法依賴的package包/類
/**
 * Draws the visual representation of a single data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the area within which the data is being drawn.
 * @param info  collects information about the drawing.
 * @param plot  the plot (can be used to obtain standard color information etc).
 * @param domainAxis  the domain (horizontal) axis.
 * @param rangeAxis  the range (vertical) axis.
 * @param dataset  the dataset.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param crosshairState  crosshair information for the plot (<code>null</code> permitted).
 * @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) {

    // get the data point...
    Number xn = dataset.getX(series, item);
    Number yn = dataset.getY(series, item);
    if (yn != null) {
        double x = xn.doubleValue();
        double y = yn.doubleValue();
        RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
        RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
        double transX = domainAxis.valueToJava2D(x, dataArea, xAxisLocation);
        double transY = rangeAxis.valueToJava2D(y, dataArea, yAxisLocation);

        g2.setPaint(this.getItemPaint(series, item));
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            g2.drawRect((int) transY, (int) transX, 1, 1);
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            g2.drawRect((int) transX, (int) transY, 1, 1);
        }

        updateCrosshairValues(crosshairState, x, y, transX, transY, orientation);
    }

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

示例5: createItemArray

import org.jfree.data.xy.XYDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the 
 * {@link MessageFormat} class for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return An array of three items from the dataset formatted as
 *         <code>String</code> objects (never <code>null</code>).
 */
protected Object[] createItemArray(XYDataset dataset, int series, 
                                   int item) {
    Object[] result = new Object[3];
    result[0] = dataset.getSeriesKey(series).toString();
    
    double x = dataset.getXValue(series, item);
    if (Double.isNaN(x) && dataset.getX(series, item) == null) {
        result[1] = this.nullXString;
    }
    else {
        if (this.xDateFormat != null) {
            result[1] = this.xDateFormat.format(new Date((long) x));   
        }
        else {
            result[1] = this.xFormat.format(x);
        }
    }
    
    double y = dataset.getYValue(series, item);
    if (Double.isNaN(y) && dataset.getY(series, item) == null) {
        result[2] = this.nullYString;
    }
    else {
        if (this.yDateFormat != null) {
            result[2] = this.yDateFormat.format(new Date((long) y));   
        }
        else {
            result[2] = this.yFormat.format(y);
        }
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:44,代碼來源:AbstractXYItemLabelGenerator.java


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