本文整理汇总了Java中org.jfree.data.statistics.StatisticalCategoryDataset类的典型用法代码示例。如果您正苦于以下问题:Java StatisticalCategoryDataset类的具体用法?Java StatisticalCategoryDataset怎么用?Java StatisticalCategoryDataset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StatisticalCategoryDataset类属于org.jfree.data.statistics包,在下文中一共展示了StatisticalCategoryDataset类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawItem
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
/**
* Draws the bar with its standard deviation line range for a single (series, category) data item.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the data area.
* @param plot the plot.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param data the data.
* @param row the row index (zero-based).
* @param column the column index (zero-based).
* @param pass the pass index.
*/
@Override
public void drawItem(final Graphics2D g2, final CategoryItemRendererState state, final Rectangle2D dataArea, final CategoryPlot plot, final CategoryAxis domainAxis, final ValueAxis rangeAxis, final CategoryDataset data, final int row, final int column, final int pass) {
// defensive check
if (!(data instanceof StatisticalCategoryDataset)) {
throw new IllegalArgumentException("Requires StatisticalCategoryDataset.");
}
final StatisticalCategoryDataset statData = (StatisticalCategoryDataset) data;
final PlotOrientation orientation = plot.getOrientation();
if (orientation == PlotOrientation.HORIZONTAL) {
drawHorizontalItem(g2, state, dataArea, plot, domainAxis, rangeAxis, statData, row, column);
} else if (orientation == PlotOrientation.VERTICAL) {
drawVerticalItem(g2, state, dataArea, plot, domainAxis, rangeAxis, statData, row, column);
}
}
示例2: drawItem
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
/**
* Draws the bar with its standard deviation line range for a single (series, category) data
* item.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the data area.
* @param plot the plot.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param data the data.
* @param row the row index (zero-based).
* @param column the column index (zero-based).
*/
public void drawItem(Graphics2D g2,
CategoryItemRendererState state,
Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset data,
int row,
int column) {
// defensive check
if (!(data instanceof StatisticalCategoryDataset)) {
throw new IllegalArgumentException("StatisticalBarRenderer.drawCategoryItem()"
+ " : the data should be of type StatisticalCategoryDataset only.");
}
StatisticalCategoryDataset statData = (StatisticalCategoryDataset) data;
PlotOrientation orientation = plot.getOrientation();
if (orientation == PlotOrientation.HORIZONTAL) {
drawHorizontalItem(g2, state, dataArea, plot, domainAxis, rangeAxis, statData,
row, column);
}
else if (orientation == PlotOrientation.VERTICAL) {
drawVerticalItem(g2, state, dataArea, plot, domainAxis, rangeAxis, statData,
row, column);
}
}
示例3: drawItem
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
/**
* Draws the bar with its standard deviation line range for a single
* (series, category) data item.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the data area.
* @param plot the plot.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param data the data.
* @param row the row index (zero-based).
* @param column the column index (zero-based).
* @param pass the pass index.
*/
public void drawItem(Graphics2D g2,
CategoryItemRendererState state,
Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset data,
int row,
int column,
int pass) {
// defensive check
if (!(data instanceof StatisticalCategoryDataset)) {
throw new IllegalArgumentException(
"Requires StatisticalCategoryDataset.");
}
StatisticalCategoryDataset statData = (StatisticalCategoryDataset) data;
PlotOrientation orientation = plot.getOrientation();
if (orientation == PlotOrientation.HORIZONTAL) {
drawHorizontalItem(g2, state, dataArea, plot, domainAxis,
rangeAxis, statData, row, column);
}
else if (orientation == PlotOrientation.VERTICAL) {
drawVerticalItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
statData, row, column);
}
}
示例4: drawItem
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
/**
* Draws the bar with its standard deviation line range for a single
* (series, category) data item.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the data area.
* @param plot the plot.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param data the data.
* @param row the row index (zero-based).
* @param column the column index (zero-based).
* @param pass the pass index.
*/
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
ValueAxis rangeAxis, CategoryDataset data, int row, int column,
int pass) {
int visibleRow = state.getVisibleSeriesIndex(row);
if (visibleRow < 0) {
return;
}
// defensive check
if (!(data instanceof StatisticalCategoryDataset)) {
throw new IllegalArgumentException(
"Requires StatisticalCategoryDataset.");
}
StatisticalCategoryDataset statData = (StatisticalCategoryDataset) data;
PlotOrientation orientation = plot.getOrientation();
if (orientation == PlotOrientation.HORIZONTAL) {
drawHorizontalItem(g2, state, dataArea, plot, domainAxis,
rangeAxis, statData, visibleRow, row, column);
}
else if (orientation == PlotOrientation.VERTICAL) {
drawVerticalItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
statData, visibleRow, row, column);
}
}
示例5: drawItem
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
/**
* Draws the bar with its standard deviation line range for a single
* (series, category) data item.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the data area.
* @param plot the plot.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param data the data.
* @param row the row index (zero-based).
* @param column the column index (zero-based).
* @param pass the pass index.
*/
public void drawItem(Graphics2D g2,
CategoryItemRendererState state,
Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset data,
int row,
int column,
int pass) {
// defensive check
if (!(data instanceof StatisticalCategoryDataset)) {
throw new IllegalArgumentException(
"Requires StatisticalCategoryDataset.");
}
StatisticalCategoryDataset statData = (StatisticalCategoryDataset) data;
PlotOrientation orientation = plot.getOrientation();
if (orientation == PlotOrientation.HORIZONTAL) {
drawHorizontalItem(g2, state, dataArea, plot, domainAxis,
rangeAxis, statData, row, column);
}
else if (orientation == PlotOrientation.VERTICAL) {
drawVerticalItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
statData, row, column);
}
}
示例6: drawItem
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
/**
* Draws the bar with its standard deviation line range for a single
* (series, category) data item.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the data area.
* @param plot the plot.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param data the data.
* @param row the row index (zero-based).
* @param column the column index (zero-based).
* @param pass the pass index.
*/
public void drawItem(Graphics2D g2,
CategoryItemRendererState state,
Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset data,
int row,
int column,
int pass) {
int visibleRow = state.getVisibleSeriesIndex(row);
if (visibleRow < 0) {
return;
}
// defensive check
if (!(data instanceof StatisticalCategoryDataset)) {
throw new IllegalArgumentException(
"Requires StatisticalCategoryDataset.");
}
StatisticalCategoryDataset statData = (StatisticalCategoryDataset) data;
PlotOrientation orientation = plot.getOrientation();
if (orientation == PlotOrientation.HORIZONTAL) {
drawHorizontalItem(g2, state, dataArea, plot, domainAxis,
rangeAxis, statData, visibleRow, row, column);
}
else if (orientation == PlotOrientation.VERTICAL) {
drawVerticalItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
statData, visibleRow, row, column);
}
}
示例7: drawItem
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
/**
* Draws the bar with its standard deviation line range for a single
* (series, category) data item.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the data area.
* @param plot the plot.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param dataset the dataset.
* @param row the row index (zero-based).
* @param column the column index (zero-based).
* @param selected is the item selected?
* @param pass the pass index.
*/
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
boolean selected, int pass) {
int visibleRow = state.getVisibleSeriesIndex(row);
if (visibleRow < 0) {
return;
}
// defensive check
if (!(dataset instanceof StatisticalCategoryDataset)) {
throw new IllegalArgumentException(
"Requires StatisticalCategoryDataset.");
}
StatisticalCategoryDataset statDataset
= (StatisticalCategoryDataset) dataset;
PlotOrientation orientation = plot.getOrientation();
if (orientation == PlotOrientation.HORIZONTAL) {
drawHorizontalItem(g2, state, dataArea, plot, domainAxis,
rangeAxis, statDataset, visibleRow, row, column, selected);
}
else if (orientation == PlotOrientation.VERTICAL) {
drawVerticalItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
statDataset, visibleRow, row, column, selected);
}
}
示例8: findPreviousIndex
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
private Integer findPreviousIndex(StatisticalCategoryDataset statDataset, int row, int column) {
for(int i = column - 1; i >=0;i--) {
if(statDataset.getValue(row, i) != null) {
return i;
}
}
return null;
}
示例9: getCsv
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
@Override
protected String getCsv(final JFreeContext ctx) {
final StatisticalCategoryDataset dataset = (StatisticalCategoryDataset)ctx.dataset();
return Csv.write(new CsvWriter() {
@Override
public void write(CsvListWriter csv) throws IOException {
@SuppressWarnings("unchecked")
List<String> columnKeys = dataset.getColumnKeys();
@SuppressWarnings("unchecked")
List<String> rowKeys = dataset.getRowKeys();
final List<String> heading = ImmutableList.<String> builder()
.add(format("%s %s %s", ctx.type(), ctx.region(),
rowKeys.get(0)))
.add("Mean")
.add("Std Dev")
.build();
csv.write(heading);
for (String col : columnKeys) {
List<String> line = newLinkedList();
line.add(col);
if(dataset.getMeanValue(rowKeys.get(0), col) != null) {
line.add(format("%.3f",
dataset.getMeanValue(rowKeys.get(0), col).doubleValue()));
line.add(format("%.3f",
dataset.getStdDevValue(rowKeys.get(0), col).doubleValue()));
}
csv.write(line);
}
}});
}
示例10: _drawItem
import org.jfree.data.statistics.StatisticalCategoryDataset; //导入依赖的package包/类
private void _drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea,
CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset,
int row, int column, int pass) {
StatisticalCategoryDataset statDataset = (StatisticalCategoryDataset) dataset;
int visibleRow = state.getVisibleSeriesIndex(row);
int visibleRowCount = state.getVisibleSeriesCount();
PlotOrientation orientation = plot.getOrientation();
// current data point...
double x1;
if (getUseSeriesOffset()) {
x1 = domainAxis.getCategorySeriesMiddle(column,
dataset.getColumnCount(),
visibleRow, visibleRowCount,
getItemMargin(), dataArea, plot.getDomainAxisEdge());
}
else {
x1 = domainAxis.getCategoryMiddle(column, getColumnCount(),
dataArea, plot.getDomainAxisEdge());
}
Number meanValue = statDataset.getMeanValue(row, column);
if (meanValue == null) {
return;
}
double y1 = rangeAxis.valueToJava2D(meanValue.doubleValue(), dataArea,
plot.getRangeAxisEdge());
if (pass == 0 && getItemLineVisible(row, column)) {
if (column != 0) {
Number previousValue = statDataset.getValue(row, column - 1);
if(previousValue != null) {
// ignore this case here because the call to super.drawItem(...) took care if it.
return;
} else {
// previous data point...
Integer pIdx = findPreviousIndex(statDataset, row, column);
if(pIdx == null) {
return;
}
previousValue = statDataset.getValue(row, pIdx.intValue());
double previous = previousValue.doubleValue();
double x0;
if (getUseSeriesOffset()) {
x0 = domainAxis.getCategorySeriesMiddle(
pIdx.intValue(), dataset.getColumnCount(),
visibleRow, visibleRowCount,
getItemMargin(), dataArea,
plot.getDomainAxisEdge());
}
else {
x0 = domainAxis.getCategoryMiddle(pIdx.intValue(),
getColumnCount(), dataArea,
plot.getDomainAxisEdge());
}
double y0 = rangeAxis.valueToJava2D(previous, dataArea,
plot.getRangeAxisEdge());
Line2D line = null;
if (orientation == PlotOrientation.HORIZONTAL) {
line = new Line2D.Double(y0, x0, y1, x1);
}
else if (orientation == PlotOrientation.VERTICAL) {
line = new Line2D.Double(x0, y0, x1, y1);
}
g2.setPaint(getItemPaint(row, column));
g2.setStroke(getItemStroke(row, column));
g2.draw(line);
}
}
}
}