本文整理汇总了Java中org.jfree.data.general.PieDataset.getItemCount方法的典型用法代码示例。如果您正苦于以下问题:Java PieDataset.getItemCount方法的具体用法?Java PieDataset.getItemCount怎么用?Java PieDataset.getItemCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.general.PieDataset
的用法示例。
在下文中一共展示了PieDataset.getItemCount方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: equals
import org.jfree.data.general.PieDataset; //导入方法依赖的package包/类
/**
* Tests this dataset for equality with an arbitrary object, returning
* <code>true</code> if <code>obj</code> is a dataset containing the same
* keys and values in the same order as this dataset.
*
* @param obj the object to test (<code>null</code> permitted).
*
* @return A boolean.
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof PieDataset)) {
return false;
}
PieDataset that = (PieDataset) obj;
int count = getItemCount();
if (that.getItemCount() != count) {
return false;
}
for (int i = 0; i < count; i++) {
Comparable k1 = getKey(i);
Comparable k2 = that.getKey(i);
if (!k1.equals(k2)) {
return false;
}
Number v1 = getValue(i);
Number v2 = that.getValue(i);
if (v1 == null) {
if (v2 != null) {
return false;
}
}
else {
if (!v1.equals(v2)) {
return false;
}
}
}
return true;
}
示例2: equals
import org.jfree.data.general.PieDataset; //导入方法依赖的package包/类
/**
* Tests this dataset for equality with an arbitrary object, returning
* <code>true</code> if <code>obj</code> is a dataset containing the same
* keys and values in the same order as this dataset.
*
* @param obj the object to test (<code>null</code> permitted).
*
* @return A boolean.
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof PieDataset)) {
return false;
}
PieDataset that = (PieDataset) obj;
int count = getItemCount();
if (that.getItemCount() != count) {
return false;
}
for (int i = 0; i < count; i++) {
Comparable k1 = getKey(i);
Comparable k2 = that.getKey(i);
if (!k1.equals(k2)) {
return false;
}
Number v1 = getValue(i);
Number v2 = that.getValue(i);
if (v1 == null) {
if (v2 != null) {
return false;
}
}
else {
if (!v1.equals(v2)) {
return false;
}
}
}
return true;
}
示例3: equals
import org.jfree.data.general.PieDataset; //导入方法依赖的package包/类
/**
* Tests this dataset for equality with an arbitrary object, returning
* {@code true} if {@code obj} is a dataset containing the same
* keys and values in the same order as this dataset.
*
* @param obj the object to test ({@code null} permitted).
*
* @return A boolean.
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof PieDataset)) {
return false;
}
PieDataset that = (PieDataset) obj;
int count = getItemCount();
if (that.getItemCount() != count) {
return false;
}
for (int i = 0; i < count; i++) {
Comparable k1 = getKey(i);
Comparable k2 = that.getKey(i);
if (!k1.equals(k2)) {
return false;
}
Number v1 = getValue(i);
Number v2 = that.getValue(i);
if (v1 == null) {
if (v2 != null) {
return false;
}
}
else {
if (!v1.equals(v2)) {
return false;
}
}
}
return true;
}
示例4: createPieChart
import org.jfree.data.general.PieDataset; //导入方法依赖的package包/类
@Override
protected JFreeChart createPieChart() throws JRException
{
JFreeChart jfreeChart = super.createPieChart();
PiePlot piePlot = (PiePlot)jfreeChart.getPlot();
JRPiePlot jrPiePlot = (JRPiePlot)getPlot();
boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels().booleanValue();
if (isShowLabels && piePlot.getLabelGenerator() != null)
{
piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
}
piePlot.setShadowXOffset(5);
piePlot.setShadowYOffset(10);
piePlot.setShadowPaint(new GradientPaint(0, getChart().getHeight() / 2, new Color(41, 120, 162), 0, getChart().getHeight(), Color.white));
PieDataset pieDataset = piePlot.getDataset();
if (pieDataset != null)
{
for (int i = 0; i < pieDataset.getItemCount(); i++)
{
piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
//makes pie colors darker
//piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
}
}
piePlot.setCircular(true);
return jfreeChart;
}
示例5: createPie3DChart
import org.jfree.data.general.PieDataset; //导入方法依赖的package包/类
@Override
protected JFreeChart createPie3DChart() throws JRException
{
JFreeChart jfreeChart = super.createPie3DChart();
PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
JRPie3DPlot jrPiePlot = (JRPie3DPlot)getPlot();
boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels().booleanValue();
if (isShowLabels && piePlot3D.getLabelGenerator() != null)
{
piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
}
piePlot3D.setDarkerSides(true);
piePlot3D.setDepthFactor(0.1);
// does not work for 3D
// piePlot3D.setShadowXOffset(5);
// piePlot3D.setShadowYOffset(10);
// piePlot3D.setShadowPaint(new GradientPaint(
// 0,
// getChart().getHeight() / 2,
// new Color(41, 120, 162),
// 0,
// getChart().getHeight(),
// Color.white)
// );
PieDataset pieDataset = piePlot3D.getDataset();
if (pieDataset != null)
{
for (int i = 0; i < pieDataset.getItemCount(); i++)
{
piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
}
}
piePlot3D.setCircular(true);
return jfreeChart;
}
示例6: createPieChart
import org.jfree.data.general.PieDataset; //导入方法依赖的package包/类
@Override
protected JFreeChart createPieChart() throws JRException
{
JFreeChart jfreeChart = super.createPieChart();
PiePlot piePlot = (PiePlot)jfreeChart.getPlot();
JRPiePlot jrPiePlot = (JRPiePlot)getPlot();
boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels().booleanValue();
if(isShowLabels && piePlot.getLabelGenerator() != null)
{
piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
}
piePlot.setShadowXOffset(0);
piePlot.setShadowYOffset(0);
PieDataset pieDataset = piePlot.getDataset();
if(pieDataset != null)
{
for(int i = 0; i < pieDataset.getItemCount(); i++)
{
piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
//makes pie colors darker
//piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
}
}
piePlot.setCircular(true);
return jfreeChart;
}
示例7: createPie3DChart
import org.jfree.data.general.PieDataset; //导入方法依赖的package包/类
@Override
protected JFreeChart createPie3DChart() throws JRException
{
JFreeChart jfreeChart = super.createPie3DChart();
PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
JRPie3DPlot jrPiePlot = (JRPie3DPlot)getPlot();
boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels().booleanValue();
if(isShowLabels && piePlot3D.getLabelGenerator() != null)
{
piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
}
piePlot3D.setDarkerSides(true);
piePlot3D.setDepthFactor(0.07);
//does not work for 3D
// piePlot3D.setShadowXOffset(5);
// piePlot3D.setShadowYOffset(10);
// piePlot3D.setShadowPaint(new GradientPaint(
// 0,
// getChart().getHeight() / 2,
// new Color(41, 120, 162),
// 0,
// getChart().getHeight(),
// Color.white)
// );
PieDataset pieDataset = piePlot3D.getDataset();
if(pieDataset != null)
{
for(int i = 0; i < pieDataset.getItemCount(); i++)
{
piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
}
}
piePlot3D.setCircular(true);
return jfreeChart;
}
示例8: serialize
import org.jfree.data.general.PieDataset; //导入方法依赖的package包/类
/**
* Example JSON output:
*
* <p>
* {
* "title" : "Graph Title",
* "description" : "Graph Description"
* "series": {
* type: 'pie',
* name: 'Browser share',
* data: [
* ['Firefox', 45.0],
* ['IE', 26.8],
* ['Safari', 8.5],
* ['Opera', 6.2],
* ['Others', 0.7]
* ]
* }
* }
* </p>
*/
@Override
public void serialize(JFreePieChart chart, JsonGenerator generator, SerializerProvider provider) throws IOException, JsonGenerationException {
generator.writeStartObject();
generator.writeStringField("title", chart.getTitle());
generator.writeStringField("subtitle", chart.getParagraphTitle());
generator.writeStringField("description", chart.getGraphDescription());
generator.writeFieldName("series");
generator.writeStartObject();
generator.writeStringField("type", "pie");
generator.writeStringField("name", chart.getTitle());
generator.writeFieldName("data");
generator.writeStartArray();
PieDataset dataset = ((PiePlot) chart.getJFreeChart().getPlot()).getDataset();
for (int i = 0; i < dataset.getItemCount(); i++) {
generator.writeStartArray();
generator.writeString(dataset.getKey(i).toString());
generator.writeNumber(dataset.getValue(i).doubleValue());
generator.writeEndArray();
}
generator.writeEndArray();
generator.writeEndObject();
generator.writeEndObject();
}