本文整理匯總了Java中org.jfree.chart.labels.StandardCategoryItemLabelGenerator類的典型用法代碼示例。如果您正苦於以下問題:Java StandardCategoryItemLabelGenerator類的具體用法?Java StandardCategoryItemLabelGenerator怎麽用?Java StandardCategoryItemLabelGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StandardCategoryItemLabelGenerator類屬於org.jfree.chart.labels包,在下文中一共展示了StandardCategoryItemLabelGenerator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setLineRender
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
public static void setLineRender(CategoryPlot plot, boolean isShowDataLabels, boolean isShapesVisible) {
plot.setNoDataMessage(NO_DATA_MSG);
plot.setInsets(new RectangleInsets(10, 10, 0, 10), false);
LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setStroke(new BasicStroke(1.5F));
if (isShowDataLabels) {
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING,
NumberFormat.getInstance()));
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));
}
renderer.setBaseShapesVisible(isShapesVisible);
setXAixs(plot);
setYAixs(plot);
}
示例2: testGenerateLabel
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/**
* Some checks for the generalLabel() method.
*/
public void testGenerateLabel() {
StandardCategoryItemLabelGenerator g
= new StandardCategoryItemLabelGenerator("{2}",
new DecimalFormat("0.000"));
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(1.0, "R0", "C0");
dataset.addValue(2.0, "R0", "C1");
dataset.addValue(3.0, "R1", "C0");
dataset.addValue(null, "R1", "C1");
String s = g.generateLabel(dataset, 0, 0);
assertEquals("1.000", s);
// try a null value
s = g.generateLabel(dataset, 1, 1);
assertEquals("-", s);
}
示例3: testCloning1
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/**
* Confirm that cloning works.
*/
@Test
public void testCloning1() throws CloneNotSupportedException {
AbstractCategoryItemRenderer r1 = new BarRenderer();
r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
AbstractCategoryItemRenderer r2 = (BarRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
r1 = new BarRenderer();
r1.setSeriesItemLabelGenerator(0,
new StandardCategoryItemLabelGenerator());
r2 = (BarRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
r1 = new BarRenderer();
r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
r2 = (BarRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
}
示例4: testCloning1
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/**
* Confirm that cloning works.
*/
@Test
public void testCloning1() throws CloneNotSupportedException {
AbstractCategoryItemRenderer r1 = new BarRenderer();
AbstractCategoryItemRenderer r2 = (BarRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
r1 = new BarRenderer();
r1.setSeriesItemLabelGenerator(0,
new StandardCategoryItemLabelGenerator());
r2 = (BarRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
r1 = new BarRenderer();
r1.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator());
r2 = (BarRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
}
示例5: testCloning
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/**
* Confirm that cloning works.
*/
public void testCloning() {
BarRenderer r1 = new BarRenderer();
r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
r1.setBarPainter(new GradientBarPainter(0.11, 0.22, 0.33));
BarRenderer r2 = null;
try {
r2 = (BarRenderer) r1.clone();
}
catch (CloneNotSupportedException e) {
e.printStackTrace();
}
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
}
示例6: testGenerateLabel
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/**
* Some checks for the generalLabel() method.
*/
public void testGenerateLabel() {
StandardCategoryItemLabelGenerator g
= new StandardCategoryItemLabelGenerator("{2}",
new DecimalFormat("0.000"));
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(1.0, "R0", "C0");
dataset.addValue(2.0, "R0", "C1");
dataset.addValue(3.0, "R1", "C0");
dataset.addValue(null, "R1", "C1");
String s = g.generateLabel(dataset, 0, 0);
assertTrue(s.startsWith("1"));
assertTrue(s.endsWith("000"));
// try a null value
s = g.generateLabel(dataset, 1, 1);
assertEquals("-", s);
}
示例7: customizeRenderer
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/** Customize renderer. */
private void customizeRenderer(CategoryPlot plot) {
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setMaximumBarWidth(0.5);
renderer.setSeriesPaint(0, Color.BLACK);
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelPaint(Color.white);
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(
ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER,
0.0));
renderer.setBarPainter(new StandardBarPainter());
renderer.setShadowVisible(false);
}
示例8: createChart
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
private JFreeChart createChart(CategoryDataset categorydataset) {
JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("Stacked Bar Chart 3D Demo 2 ",
"Category ", "Value ", categorydataset, PlotOrientation.VERTICAL, true, true, false);
CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
StackedBarRenderer3D stackedbarrenderer3d = (StackedBarRenderer3D) categoryplot.getRenderer();
stackedbarrenderer3d.setRenderAsPercentages(true);
stackedbarrenderer3d.setDrawBarOutline(false);
stackedbarrenderer3d.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{3} ", NumberFormat
.getIntegerInstance(), new DecimalFormat("0.0% ")));
stackedbarrenderer3d.setItemLabelsVisible(true);
stackedbarrenderer3d.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,
TextAnchor.CENTER));
stackedbarrenderer3d.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,
TextAnchor.CENTER));
return jfreechart;
}
示例9: setBarRenderer
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
public static void setBarRenderer(CategoryPlot plot, boolean isShowDataLabels) {
plot.setNoDataMessage(NO_DATA_MSG);
plot.setInsets(new RectangleInsets(10, 10, 5, 10));
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
renderer.setMaximumBarWidth(0.075);
if (isShowDataLabels) {
renderer.setBaseItemLabelsVisible(true);
}
setXAixs(plot);
setYAixs(plot);
}
示例10: setStackBarRender
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
public static void setStackBarRender(CategoryPlot plot) {
plot.setNoDataMessage(NO_DATA_MSG);
plot.setInsets(new RectangleInsets(10, 10, 5, 10));
StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
plot.setRenderer(renderer);
setXAixs(plot);
setYAixs(plot);
}
示例11: createBarChart
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
private static JFreeChart createBarChart(String title,String category,String value, CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title
category, // domain axis label
value, // range axis label
dataset, // data
PlotOrientation.VERTICAL, // 圖標方向
true, // 是否顯示legend
true, // 是否顯示tooltips
false // 是否顯示URLs
);
CategoryPlot plot = chart.getCategoryPlot();//設置圖的高級屬性
plot.setBackgroundPaint(ChartColor.WHITE);
NumberAxis na= (NumberAxis)plot.getRangeAxis();
// na.setAutoTickUnitSelection(false);//設置小數點位數
na.setNumberFormatOverride(df);
// NumberTickUnit nt=new NumberTickUnit(1.22);
// na.setTickUnit(nt);
// plot.setRangeAxis(na);
BarRenderer3D renderer = new BarRenderer3D();//3D屬性修改
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
renderer.setBaseItemLabelsVisible(true);
renderer.setItemLabelAnchorOffset(10);
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER));
renderer.setSeriesPaint(0,new Color(34,139,34));
renderer.setSeriesPaint(1,new Color(154,205,50));
renderer.setSeriesPaint(2,new Color(0,255,0));
renderer.setSeriesPaint(3,new Color(127,255,212));
plot.setRenderer(renderer);//將修改後的屬性值保存到圖中
return chart;
}
示例12: testEquals1481087
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/**
* A test for bug 1481087.
*/
public void testEquals1481087() {
StandardCategoryItemLabelGenerator g1
= new StandardCategoryItemLabelGenerator("{0}",
new DecimalFormat("0.00"));
StandardCategoryToolTipGenerator g2
= new StandardCategoryToolTipGenerator("{0}",
new DecimalFormat("0.00"));
assertFalse(g1.equals(g2));
}
示例13: testEquals1481087
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/**
* A test for bug 1481087.
*/
public void testEquals1481087() {
StandardCategoryToolTipGenerator g1
= new StandardCategoryToolTipGenerator("{0}",
new DecimalFormat("0.00"));
StandardCategoryItemLabelGenerator g2
= new StandardCategoryItemLabelGenerator("{0}",
new DecimalFormat("0.00"));
assertFalse(g1.equals(g2));
}
示例14: SpiderWebPlot
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/**
* Creates a new spider web plot with the given dataset.
*
* @param dataset the dataset.
* @param extract controls how data is extracted ({@link TableOrder#BY_ROW}
* or {@link TableOrder#BY_COLUMN}).
*/
public SpiderWebPlot(CategoryDataset dataset, TableOrder extract) {
super();
if (extract == null) {
throw new IllegalArgumentException("Null 'extract' argument.");
}
this.dataset = dataset;
if (dataset != null) {
dataset.addChangeListener(this);
}
this.dataExtractOrder = extract;
this.headPercent = DEFAULT_HEAD;
this.axisLabelGap = DEFAULT_AXIS_LABEL_GAP;
this.axisLinePaint = Color.black;
this.axisLineStroke = new BasicStroke(1.0f);
this.interiorGap = DEFAULT_INTERIOR_GAP;
this.startAngle = DEFAULT_START_ANGLE;
this.direction = Rotation.CLOCKWISE;
this.maxValue = DEFAULT_MAX_VALUE;
this.seriesPaint = null;
this.seriesPaintList = new PaintList();
this.baseSeriesPaint = null;
this.seriesOutlinePaint = null;
this.seriesOutlinePaintList = new PaintList();
this.baseSeriesOutlinePaint = DEFAULT_OUTLINE_PAINT;
this.seriesOutlineStroke = null;
this.seriesOutlineStrokeList = new StrokeList();
this.baseSeriesOutlineStroke = DEFAULT_OUTLINE_STROKE;
this.labelFont = DEFAULT_LABEL_FONT;
this.labelPaint = DEFAULT_LABEL_PAINT;
this.labelGenerator = new StandardCategoryItemLabelGenerator();
this.legendItemShape = DEFAULT_LEGEND_ITEM_CIRCLE;
}
示例15: testCloning
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; //導入依賴的package包/類
/**
* Confirm that cloning works.
*/
@Test
public void testCloning() throws CloneNotSupportedException {
BarRenderer r1 = new BarRenderer();
r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
r1.setBarPainter(new GradientBarPainter(0.11, 0.22, 0.33));
BarRenderer r2 = (BarRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
}