本文整理汇总了Java中org.jfree.data.xy.XYDataset.getY方法的典型用法代码示例。如果您正苦于以下问题:Java XYDataset.getY方法的具体用法?Java XYDataset.getY怎么用?Java XYDataset.getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.xy.XYDataset
的用法示例。
在下文中一共展示了XYDataset.getY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPreviousHeight
import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
* Calculates the stacked value of the all series up to, but not including <code>series</code>
* for the specified category, <code>category</code>. It returns 0.0 if <code>series</code>
* is the first series, i.e. 0.
*
* @param data the data.
* @param series the series.
* @param index the index.
*
* @return double returns a cumulative value for all series' values up to
* but excluding <code>series</code> for <code>index</code>.
*/
protected double getPreviousHeight(XYDataset data, int series, int index) {
double result = 0.0;
Number tmp;
for (int i = 0; i < series; i++) {
tmp = data.getY(i, index);
if (tmp != null) {
result += tmp.doubleValue();
}
}
return result;
}
示例2: getStackValues
import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
* Calculates the stacked value of the all series up to, but not including <code>series</code>
* for the specified category, <code>category</code>. It returns 0.0 if <code>series</code>
* is the first series, i.e. 0.
*
* @param dataset the data.
* @param series the series.
* @param index the index.
*
* @return double returns a cumulative value for all series' values up to
* but excluding <code>series</code> for <code>index</code>.
*/
private double[] getStackValues(XYDataset dataset, int series, int index) {
double[] result = new double[2];
for (int i = 0; i < series; i++) {
Number n = dataset.getY(i, index);
if (n != null) {
double v = n.doubleValue();
if (v >= 0.0) {
result[1] += v;
}
else {
result[0] += v;
}
}
}
return result;
}
示例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[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;
}
示例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);
}
}
示例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;
}