本文整理汇总了Java中org.jfree.data.xy.XYZDataset类的典型用法代码示例。如果您正苦于以下问题:Java XYZDataset类的具体用法?Java XYZDataset怎么用?Java XYZDataset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XYZDataset类属于org.jfree.data.xy包,在下文中一共展示了XYZDataset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPaint
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Get the paint for a given series and item from a dataset.
*
* @param dataset the dataset..
* @param series the series index.
* @param item the item index.
*
* @return The paint.
*/
protected Paint getPaint(XYDataset dataset, int series, int item) {
Paint p;
if (dataset instanceof XYZDataset) {
double z = ((XYZDataset) dataset).getZValue(series, item);
p = this.paintScale.getPaint(z);
}
else {
if (this.useFillPaint) {
p = getItemFillPaint(series, item);
}
else {
p = getItemPaint(series, item);
}
}
return p;
}
示例2: iterateZBounds
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Iterates over the data items of the xyz dataset to find
* the z-dimension bounds.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param includeInterval include the z-interval (if the dataset has a
* z-interval.
*
* @return The range (possibly <code>null</code>).
*/
public static Range iterateZBounds(XYZDataset dataset,
boolean includeInterval) {
double minimum = Double.POSITIVE_INFINITY;
double maximum = Double.NEGATIVE_INFINITY;
int seriesCount = dataset.getSeriesCount();
for (int series = 0; series < seriesCount; series++) {
int itemCount = dataset.getItemCount(series);
for (int item = 0; item < itemCount; item++) {
double value = dataset.getZValue(series, item);
if (!Double.isNaN(value)) {
minimum = Math.min(minimum, value);
maximum = Math.max(maximum, value);
}
}
}
if (minimum == Double.POSITIVE_INFINITY) {
return null;
}
else {
return new Range(minimum, maximum);
}
}
示例3: getPaint
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Get the paint for a given series and item from a dataset.
*
* @param dataset the dataset.
* @param series the series index.
* @param item the item index.
*
* @return The paint.
*/
protected Paint getPaint(XYDataset dataset, int series, int item) {
Paint p;
if (dataset instanceof XYZDataset) {
double z = ((XYZDataset) dataset).getZValue(series, item);
p = this.paintScale.getPaint(z);
} else {
if (this.useFillPaint) {
p = getItemFillPaint(series, item);
}
else {
p = getItemPaint(series, item);
}
}
return p;
}
示例4: iterateZBounds
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Iterates over the data items of the xyz dataset to find
* the z-dimension bounds.
*
* @param dataset the dataset ({@code null} not permitted).
* @param includeInterval include the z-interval (if the dataset has a
* z-interval.
*
* @return The range (possibly {@code null}).
*/
public static Range iterateZBounds(XYZDataset dataset,
boolean includeInterval) {
double minimum = Double.POSITIVE_INFINITY;
double maximum = Double.NEGATIVE_INFINITY;
int seriesCount = dataset.getSeriesCount();
for (int series = 0; series < seriesCount; series++) {
int itemCount = dataset.getItemCount(series);
for (int item = 0; item < itemCount; item++) {
double value = dataset.getZValue(series, item);
if (!Double.isNaN(value)) {
minimum = Math.min(minimum, value);
maximum = Math.max(maximum, value);
}
}
}
if (minimum == Double.POSITIVE_INFINITY) {
return null;
}
else {
return new Range(minimum, maximum);
}
}
示例5: createXyzDataset
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
private XYZDataset createXyzDataset()
{
if (sampleXyzDataset == null)
{
DefaultXYZDataset dataset = new DefaultXYZDataset();
dataset.addSeries(
"First",
new double[][]{
{2.1, 2.3, 2.3, 2.2, 2.2, 1.8, 1.8, 1.9, 2.3, 3.8},
{14.1, 11.1, 10.0, 8.8, 8.7, 8.4, 5.4, 4.1, 4.1, 25},
{2.4, 2.7, 2.7, 2.2, 2.2, 2.2, 2.1, 2.2, 1.6, 4}
}
);
sampleXyzDataset = dataset;
}
return sampleXyzDataset;
}
示例6: doChart
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* create chart using data from the dataTable
*/
public void doChart(){
if(dataTable.isEditing())
dataTable.getCellEditor().stopCellEditing();
if (! hasExample ) {
showMessageDialog(DATA_MISSING_MESSAGE);
resetChart();
return;
}
isDemo = false;
XYZDataset dataset = createDataset(isDemo);
JFreeChart chart = createChart(dataset);
chartPanel = new ChartPanel(chart, isDemo);
setChart();
//updateStatus("Chart has been updated, click GRAPH to view it.");
}
示例7: getPaint
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Get the paint for a given series and item from a dataset.
*
* @param dataset the dataset..
* @param series the series index.
* @param item the item index.
*
* @return The paint.
*/
protected Paint getPaint(XYDataset dataset, int series, int item) {
Paint p = null;
if (dataset instanceof XYZDataset) {
double z = ((XYZDataset) dataset).getZValue(series, item);
p = this.paintScale.getPaint(z);
}
else {
if (this.useFillPaint) {
p = getItemFillPaint(series, item);
}
else {
p = getItemPaint(series, item);
}
}
return p;
}
示例8: createBubbleChart
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Creates a bubble chart with default settings. The chart is composed of
* an {@link XYPlot}, with a {@link NumberAxis} for the domain axis,
* a {@link NumberAxis} for the range axis, and an {@link XYBubbleRenderer}
* to draw the data items.
*
* @param title the chart title (<code>null</code> permitted).
* @param xAxisLabel a label for the X-axis (<code>null</code> permitted).
* @param yAxisLabel a label for the Y-axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A bubble chart.
*/
public static JFreeChart createBubbleChart(String title, String xAxisLabel,
String yAxisLabel, XYZDataset dataset, boolean legend) {
NumberAxis xAxis = new NumberAxis(xAxisLabel);
xAxis.setAutoRangeIncludesZero(false);
NumberAxis yAxis = new NumberAxis(yAxisLabel);
yAxis.setAutoRangeIncludesZero(false);
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
XYItemRenderer renderer = new XYBubbleRenderer(
XYBubbleRenderer.SCALE_ON_RANGE_AXIS);
renderer.setBaseToolTipGenerator(new StandardXYZToolTipGenerator());
plot.setRenderer(renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例9: getPaint
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Get the paint for a given series and item from a dataset.
*
* @param dataset the dataset..
* @param series the series index.
* @param item the item index.
* @param selected is the data item selected?
*
* @return The paint.
*
* @since 1.2.0
*/
protected Paint getPaint(XYDataset dataset, int series, int item,
boolean selected) {
Paint p = null;
if (dataset instanceof XYZDataset) {
double z = ((XYZDataset) dataset).getZValue(series, item);
p = this.paintScale.getPaint(z);
}
else {
if (this.useFillPaint) {
p = getItemFillPaint(series, item, selected);
}
else {
p = getItemPaint(series, item, selected);
}
}
return p;
}
示例10: createBubbleChart
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Creates a bubble chart with default settings.
*
* @param title the chart title (<code>null</code> permitted).
* @param xAxisLabel a label for the X-axis (<code>null</code> permitted).
* @param yAxisLabel a label for the Y-axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation (horizontal or vertical) (<code>null</code> NOT
* permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return a bubble chart.
*/
public static JFreeChart createBubbleChart(String title,
String xAxisLabel,
String yAxisLabel,
XYZDataset dataset,
PlotOrientation orientation,
boolean legend,
boolean tooltips,
boolean urls) {
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
NumberAxis xAxis = new NumberAxis(xAxisLabel);
xAxis.setAutoRangeIncludesZero(false);
NumberAxis yAxis = new NumberAxis(yAxisLabel);
yAxis.setAutoRangeIncludesZero(false);
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
XYItemRenderer renderer = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_RANGE_AXIS);
if (tooltips) {
renderer.setToolTipGenerator(new StandardXYZToolTipGenerator());
}
if (urls) {
renderer.setURLGenerator(new StandardXYZURLGenerator());
}
plot.setRenderer(renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
示例11: createItemArray
import org.jfree.data.xy.XYZDataset; //导入依赖的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(XYZDataset dataset, int series, int item) {
Object[] result = new Object[4];
result[0] = dataset.getSeriesName(series);
Number x = dataset.getX(series, item);
DateFormat xf = getXDateFormat();
if (xf != null) {
result[1] = xf.format(x);
}
else {
result[1] = getXFormat().format(x);
}
Number y = dataset.getY(series, item);
DateFormat yf = getYDateFormat();
if (yf != null) {
result[2] = yf.format(y);
}
else {
result[2] = getYFormat().format(y);
}
Number z = dataset.getZ(series, item);
if (this.zDateFormat != null) {
result[3] = this.zDateFormat.format(z);
}
else {
result[3] = this.zFormat.format(z);
}
return result;
}
示例12: createBubbleChart
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Creates a bubble chart with default settings. The chart is composed of
* an {@link XYPlot}, with a {@link NumberAxis} for the domain axis,
* a {@link NumberAxis} for the range axis, and an {@link XYBubbleRenderer}
* to draw the data items.
*
* @param title the chart title (<code>null</code> permitted).
* @param xAxisLabel a label for the X-axis (<code>null</code> permitted).
* @param yAxisLabel a label for the Y-axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the orientation (horizontal or vertical)
* (<code>null</code> NOT permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A bubble chart.
*/
public static JFreeChart createBubbleChart(String title,
String xAxisLabel,
String yAxisLabel,
XYZDataset dataset,
PlotOrientation orientation,
boolean legend,
boolean tooltips,
boolean urls) {
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
NumberAxis xAxis = new NumberAxis(xAxisLabel);
xAxis.setAutoRangeIncludesZero(false);
NumberAxis yAxis = new NumberAxis(yAxisLabel);
yAxis.setAutoRangeIncludesZero(false);
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
XYItemRenderer renderer = new XYBubbleRenderer(
XYBubbleRenderer.SCALE_ON_RANGE_AXIS);
if (tooltips) {
renderer.setBaseToolTipGenerator(new StandardXYZToolTipGenerator());
}
if (urls) {
renderer.setURLGenerator(new StandardXYZURLGenerator());
}
plot.setRenderer(renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
return chart;
}
示例13: drawItem
import org.jfree.data.xy.XYZDataset; //导入依赖的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);
}
示例14: generateLabelString
import org.jfree.data.xy.XYZDataset; //导入依赖的package包/类
/**
* Generates a label string for an item in the dataset.
*
* @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 label (possibly <code>null</code>).
*/
public String generateLabelString(XYDataset dataset, int series, int item) {
String result = null;
Object[] items = null;
if (dataset instanceof XYZDataset) {
items = createItemArray((XYZDataset) dataset, series, item);
}
else {
items = createItemArray(dataset, series, item);
}
result = MessageFormat.format(getFormatString(), items);
return result;
}
示例15: createItemArray
import org.jfree.data.xy.XYZDataset; //导入依赖的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(XYZDataset dataset,
int series, int item) {
Object[] result = new Object[4];
result[0] = dataset.getSeriesKey(series).toString();
Number x = dataset.getX(series, item);
DateFormat xf = getXDateFormat();
if (xf != null) {
result[1] = xf.format(x);
}
else {
result[1] = getXFormat().format(x);
}
Number y = dataset.getY(series, item);
DateFormat yf = getYDateFormat();
if (yf != null) {
result[2] = yf.format(y);
}
else {
result[2] = getYFormat().format(y);
}
Number z = dataset.getZ(series, item);
if (this.zDateFormat != null) {
result[3] = this.zDateFormat.format(z);
}
else {
result[3] = this.zFormat.format(z);
}
return result;
}