本文整理汇总了Java中org.jfree.data.category.CategoryDataset.getColumnKey方法的典型用法代码示例。如果您正苦于以下问题:Java CategoryDataset.getColumnKey方法的具体用法?Java CategoryDataset.getColumnKey怎么用?Java CategoryDataset.getColumnKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.category.CategoryDataset
的用法示例。
在下文中一共展示了CategoryDataset.getColumnKey方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateURL
import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
* Generates a URL for a particular item within a series.
*
* @param dataset the dataset.
* @param series the series index (zero-based).
* @param category the category index (zero-based).
*
* @return The generated URL.
*/
public String generateURL(CategoryDataset dataset, int series, int category) {
String url = this.prefix;
Comparable seriesKey = dataset.getRowKey(series);
Comparable categoryKey = dataset.getColumnKey(category);
boolean firstParameter = url.indexOf("?") == -1;
url += firstParameter ? "?" : "&";
// try {
url += this.seriesParameterName + "="
+ URLEncoder.encode(seriesKey.toString());
// + URLEncoder.encode(seriesKey.toString(), "UTF-8"); Not supported in JDK 1.2.2
// }
// catch (UnsupportedEncodingException uee) {
// url += this.seriesParameterName + "=" + seriesKey.toString();
// }
// try {
url += "&" + this.categoryParameterName + "="
+ URLEncoder.encode(categoryKey.toString());
//+ URLEncoder.encode(categoryKey.toString(), "UTF-8"); not supported in JDK 1.2.2
// }
// catch (UnsupportedEncodingException uee) {
// url += "&" + this.categoryParameterName + "=" + categoryKey.toString();
// }
return url;
}
示例2: addItemEntity
import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
* Adds an entity with the specified hotspot.
*
* @param entities the entity collection.
* @param dataset the dataset.
* @param row the row index.
* @param column the column index.
* @param hotspot the hotspot.
*/
protected void addItemEntity(EntityCollection entities,
CategoryDataset dataset, int row, int column,
Shape hotspot) {
String tip = null;
CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
if (tipster != null) {
tip = tipster.generateToolTip(dataset, row, column);
}
String url = null;
CategoryURLGenerator urlster = getItemURLGenerator(row, column);
if (urlster != null) {
url = urlster.generateURL(dataset, row, column);
}
CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
dataset, row, dataset.getColumnKey(column), column);
entities.add(entity);
}
示例3: getCategoriesForAxis
import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
* Returns a list of the categories that should be displayed for the
* specified axis.
*
* @param axis the axis (<code>null</code> not permitted)
*
* @return The categories.
*
* @since 1.0.3
*/
public List getCategoriesForAxis(CategoryAxis axis) {
List result = new ArrayList();
int axisIndex = this.domainAxes.indexOf(axis);
List datasets = datasetsMappedToDomainAxis(axisIndex);
Iterator iterator = datasets.iterator();
while (iterator.hasNext()) {
CategoryDataset dataset = (CategoryDataset) iterator.next();
// add the unique categories from this dataset
for (int i = 0; i < dataset.getColumnCount(); i++) {
Comparable category = dataset.getColumnKey(i);
if (!result.contains(category)) {
result.add(category);
}
}
}
return result;
}
示例4: createPieDatasetForRow
import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
* Creates a pie dataset from a table dataset by taking all the values
* for a single row.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param row the row (zero-based index).
*
* @return A pie dataset.
*/
public static PieDataset createPieDatasetForRow(CategoryDataset dataset, int row) {
DefaultPieDataset result = new DefaultPieDataset();
int columnCount = dataset.getColumnCount();
for (int current = 0; current < columnCount; current++) {
Comparable columnKey = dataset.getColumnKey(current);
result.setValue(columnKey, dataset.getValue(row, current));
}
return result;
}
示例5: generateURL
import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
* Generates a URL for a particular item within a series.
*
* @param dataset the dataset.
* @param series the series index (zero-based).
* @param category the category index (zero-based).
*
* @return The generated URL.
*/
public String generateURL(CategoryDataset dataset, int series,
int category) {
String url = this.prefix;
Comparable seriesKey = dataset.getRowKey(series);
Comparable categoryKey = dataset.getColumnKey(category);
boolean firstParameter = url.indexOf("?") == -1;
url += firstParameter ? "?" : "&";
// try {
url += this.seriesParameterName + "="
+ URLEncoder.encode(seriesKey.toString());
// + URLEncoder.encode(seriesKey.toString(), "UTF-8");
// Not supported in JDK 1.2.2
// }
// catch (UnsupportedEncodingException uee) {
// url += this.seriesParameterName + "=" + seriesKey.toString();
// }
// try {
url += "&" + this.categoryParameterName + "="
+ URLEncoder.encode(categoryKey.toString());
//+ URLEncoder.encode(categoryKey.toString(), "UTF-8");
// not supported in JDK 1.2.2
// }
// catch (UnsupportedEncodingException uee) {
// url += "&" + this.categoryParameterName + "="
// + categoryKey.toString();
// }
return url;
}
示例6: createPieDatasetForRow
import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
* Creates a pie dataset from a table dataset by taking all the values
* for a single row.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param row the row (zero-based index).
*
* @return A pie dataset.
*/
public static PieDataset createPieDatasetForRow(CategoryDataset dataset,
int row) {
DefaultPieDataset result = new DefaultPieDataset();
int columnCount = dataset.getColumnCount();
for (int current = 0; current < columnCount; current++) {
Comparable columnKey = dataset.getColumnKey(current);
result.setValue(columnKey, dataset.getValue(row, current));
}
return result;
}
示例7: drawItem
import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
* Draws the visual representation of one data item from the chart (in
* fact, this method does nothing until it reaches the last item for each
* category, at which point it draws all the items for that category).
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the plot area.
* @param plot the plot.
* @param domainAxis the domain (category) axis.
* @param rangeAxis the range (value) axis.
* @param dataset 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 dataset,
int row,
int column,
int pass) {
// wait till we are at the last item for the row then draw the
// whole stack at once
if (row < dataset.getRowCount() - 1) {
return;
}
Comparable category = dataset.getColumnKey(column);
List values = createStackedValueList(dataset,
dataset.getColumnKey(column), getBase(),
this.renderAsPercentages);
Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX(),
dataArea.getY() + getYOffset(),
dataArea.getWidth() - getXOffset(),
dataArea.getHeight() - getYOffset());
PlotOrientation orientation = plot.getOrientation();
// handle rendering separately for the two plot orientations...
if (orientation == PlotOrientation.HORIZONTAL) {
drawStackHorizontal(values, category, g2, state, adjusted, plot,
domainAxis, rangeAxis, dataset);
}
else {
drawStackVertical(values, category, g2, state, adjusted, plot,
domainAxis, rangeAxis, dataset);
}
}
示例8: generateLabel
import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
* Generates the label for an item in a dataset. Note: in the current dataset implementation,
* each row is a series, and each column contains values for a particular category.
*
* @param dataset
* the dataset (<code>null</code> not permitted).
* @param row
* the row index (zero-based).
* @param column
* the column index (zero-based).
*
* @return The label (possibly <code>null</code>).
*/
@Override
public String generateLabel(CategoryDataset dataset, int row, int column) {
String key = (String) dataset.getColumnKey(column);
return itemLabels.get(key);
}