本文整理汇总了Java中org.jfree.data.KeyedValues类的典型用法代码示例。如果您正苦于以下问题:Java KeyedValues类的具体用法?Java KeyedValues怎么用?Java KeyedValues使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KeyedValues类属于org.jfree.data包,在下文中一共展示了KeyedValues类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCategoryDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a {@link CategoryDataset} by copying the data from the supplied {@link KeyedValues}
* instance.
*
* @param rowKey the row key (<code>null</code> not permitted).
* @param rowData the row data (<code>null</code> not permitted).
*
* @return A dataset.
*/
public static CategoryDataset createCategoryDataset(String rowKey,
KeyedValues rowData) {
if (rowKey == null) {
throw new IllegalArgumentException("Null 'rowKey' argument.");
}
if (rowData == null) {
throw new IllegalArgumentException("Null 'rowData' argument.");
}
DefaultCategoryDataset result = new DefaultCategoryDataset();
for (int i = 0; i < rowData.getItemCount(); i++) {
result.addValue(rowData.getValue(i), rowKey, rowData.getKey(i));
}
return result;
}
示例2: createCategoryDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a {@link CategoryDataset} by copying the data from the supplied
* {@link KeyedValues} instance.
*
* @param rowKey the row key (<code>null</code> not permitted).
* @param rowData the row data (<code>null</code> not permitted).
*
* @return A dataset.
*/
public static CategoryDataset createCategoryDataset(Comparable rowKey,
KeyedValues rowData) {
if (rowKey == null) {
throw new IllegalArgumentException("Null 'rowKey' argument.");
}
if (rowData == null) {
throw new IllegalArgumentException("Null 'rowData' argument.");
}
DefaultCategoryDataset result = new DefaultCategoryDataset();
for (int i = 0; i < rowData.getItemCount(); i++) {
result.addValue(rowData.getValue(i), rowKey, rowData.getKey(i));
}
return result;
}
示例3: writeKeyedValues
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Writes the data in JSON format to the supplied writer.
* <br><br>
* Note that this method can be used with instances of {@link PieDataset}.
*
* @param data the data ({@code null} not permitted).
* @param writer the writer ({@code null} not permitted).
*
* @throws IOException if there is an I/O problem.
*/
public static void writeKeyedValues(KeyedValues data, Writer writer)
throws IOException {
Args.nullNotPermitted(data, "data");
Args.nullNotPermitted(writer, "writer");
writer.write("[");
boolean first = true;
Iterator iterator = data.getKeys().iterator();
while (iterator.hasNext()) {
Comparable key = (Comparable) iterator.next();
if (!first) {
writer.write(", ");
} else {
first = false;
}
writer.write("[");
writer.write(JSONValue.toJSONString(key.toString()));
writer.write(", ");
writer.write(JSONValue.toJSONString(data.getValue(key)));
writer.write("]");
}
writer.write("]");
}
示例4: createCategoryDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a {@link CategoryDataset} by copying the data from the supplied
* {@link KeyedValues} instance.
*
* @param rowKey the row key (<code>null</code> not permitted).
* @param rowData the row data (<code>null</code> not permitted).
*
* @return A dataset.
*/
public static CategoryDataset createCategoryDataset(Comparable rowKey,
KeyedValues rowData) {
if (rowKey == null) {
throw new IllegalArgumentException("Null 'rowKey' argument.");
}
if (rowData == null) {
throw new IllegalArgumentException("Null 'rowData' argument.");
}
DefaultCategoryDataset result = new DefaultCategoryDataset();
for (int i = 0; i < rowData.getItemCount(); i++) {
result.addValue(rowData.getValue(i), rowKey, rowData.getKey(i));
}
return result;
}
示例5: DefaultPieDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a new dataset that uses the data from a {@link KeyedValues} instance.
*
* @param data the data.
*/
public DefaultPieDataset(final KeyedValues data) {
this.data = new DefaultKeyedValues();
for (int i = 0; i < data.getItemCount(); i++) {
this.data.addValue(data.getKey(i), data.getValue(i));
}
}
示例6: drawLeftLabels
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Draws the left labels.
*
* @param leftKeys the keys.
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param linkArea the link area.
* @param maxLabelWidth the maximum label width.
* @param state the state.
*/
protected void drawLeftLabels(KeyedValues leftKeys, Graphics2D g2,
Rectangle2D plotArea, Rectangle2D linkArea,
float maxLabelWidth, PiePlotState state) {
PieLabelDistributor distributor1 = new PieLabelDistributor(
leftKeys.getItemCount()
);
double lGap = plotArea.getWidth() * this.labelGap;
double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;
for (int i = 0; i < leftKeys.getItemCount(); i++) {
String label = this.labelGenerator.generateSectionLabel(
this.dataset, leftKeys.getKey(i));
if (label != null) {
TextBlock block = TextUtilities.createTextBlock(label,
this.labelFont, this.labelPaint, maxLabelWidth,
new G2TextMeasurer(g2));
TextBox labelBox = new TextBox(block);
labelBox.setBackgroundPaint(this.labelBackgroundPaint);
labelBox.setOutlinePaint(this.labelOutlinePaint);
labelBox.setOutlineStroke(this.labelOutlineStroke);
labelBox.setShadowPaint(this.labelShadowPaint);
double theta = Math.toRadians(
leftKeys.getValue(i).doubleValue());
double baseY = state.getPieCenterY() - Math.sin(theta)
* verticalLinkRadius;
double hh = labelBox.getHeight(g2);
distributor1.addPieLabelRecord(new PieLabelRecord(
leftKeys.getKey(i), theta, baseY, labelBox, hh,
lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9
+ getExplodePercent(this.dataset.getIndex(
leftKeys.getKey(i)))));
}
}
distributor1.distributeLabels(plotArea.getMinY(), plotArea.getHeight());
for (int i = 0; i < distributor1.getItemCount(); i++) {
drawLeftLabel(g2, state, distributor1.getPieLabelRecord(i));
}
}
示例7: DefaultPieDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a new dataset by copying data from a {@link KeyedValues}
* instance.
*
* @param data the data (<code>null</code> not permitted).
*/
public DefaultPieDataset(KeyedValues data) {
if (data == null) {
throw new IllegalArgumentException("Null 'data' argument.");
}
this.data = new DefaultKeyedValues();
for (int i = 0; i < data.getItemCount(); i++) {
this.data.addValue(data.getKey(i), data.getValue(i));
}
}
示例8: DefaultPieDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a new dataset by copying data from a {@link KeyedValues}
* instance.
*
* @param data the data (<code>null</code> not permitted).
*/
public DefaultPieDataset(KeyedValues data) {
ParamChecks.nullNotPermitted(data, "data");
this.data = new DefaultKeyedValues();
for (int i = 0; i < data.getItemCount(); i++) {
this.data.addValue(data.getKey(i), data.getValue(i));
}
}
示例9: createCategoryDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a {@link CategoryDataset} by copying the data from the supplied
* {@link KeyedValues} instance.
*
* @param rowKey the row key (<code>null</code> not permitted).
* @param rowData the row data (<code>null</code> not permitted).
*
* @return A dataset.
*/
public static CategoryDataset createCategoryDataset(Comparable rowKey,
KeyedValues rowData) {
ParamChecks.nullNotPermitted(rowKey, "rowKey");
ParamChecks.nullNotPermitted(rowData, "rowData");
DefaultCategoryDataset result = new DefaultCategoryDataset();
for (int i = 0; i < rowData.getItemCount(); i++) {
result.addValue(rowData.getValue(i), rowKey, rowData.getKey(i));
}
return result;
}
示例10: DefaultPieDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a new dataset by copying data from a {@link KeyedValues}
* instance.
*
* @param data the data ({@code null} not permitted).
*/
public DefaultPieDataset(KeyedValues data) {
Args.nullNotPermitted(data, "data");
this.data = new DefaultKeyedValues();
for (int i = 0; i < data.getItemCount(); i++) {
this.data.addValue(data.getKey(i), data.getValue(i));
}
}
示例11: createCategoryDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a {@link CategoryDataset} by copying the data from the supplied
* {@link KeyedValues} instance.
*
* @param rowKey the row key ({@code null} not permitted).
* @param rowData the row data ({@code null} not permitted).
*
* @return A dataset.
*/
public static CategoryDataset createCategoryDataset(Comparable rowKey,
KeyedValues rowData) {
Args.nullNotPermitted(rowKey, "rowKey");
Args.nullNotPermitted(rowData, "rowData");
DefaultCategoryDataset result = new DefaultCategoryDataset();
for (int i = 0; i < rowData.getItemCount(); i++) {
result.addValue(rowData.getValue(i), rowKey, rowData.getKey(i));
}
return result;
}
示例12: DefaultPieDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a new dataset by copying data from a {@link KeyedValues}
* instance.
*
* @param data the data (<code>null</code> not permitted).
*/
public DefaultPieDataset(KeyedValues data) {
if (data == null) {
throw new IllegalArgumentException("Null 'data' argument.");
}
this.data = new DefaultKeyedValues();
for (int i = 0; i < data.getItemCount(); i++) {
this.data.addValue(data.getKey(i), data.getValue(i));
}
}
示例13: DefaultPieDataset
import org.jfree.data.KeyedValues; //导入依赖的package包/类
/**
* Creates a new dataset by copying data from a {@link KeyedValues}
* instance.
*
* @param data the data (<code>null</code> not permitted).
*/
public DefaultPieDataset(KeyedValues data) {
if (data == null) {
throw new IllegalArgumentException("Null 'data' argument.");
}
this.data = new KeyedObjects();
for (int i = 0; i < data.getItemCount(); i++) {
SelectableValue dataItem = new SelectableValue(data.getValue(i));
this.data.addObject(data.getKey(i), dataItem);
}
}