本文整理匯總了Java中org.jfree.chart.renderer.category.LineAndShapeRenderer.setBaseShapesFilled方法的典型用法代碼示例。如果您正苦於以下問題:Java LineAndShapeRenderer.setBaseShapesFilled方法的具體用法?Java LineAndShapeRenderer.setBaseShapesFilled怎麽用?Java LineAndShapeRenderer.setBaseShapesFilled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.renderer.category.LineAndShapeRenderer
的用法示例。
在下文中一共展示了LineAndShapeRenderer.setBaseShapesFilled方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: styleChart
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
/**
* TODO Documentation
*
* @param chart
* @return
*/
protected JFreeChart styleChart(JFreeChart chart) {
chart.setBackgroundPaint(Color.white);
LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.RIGHT);
legend.setVisible(false);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.white);
plot.setRangeGridlinePaint(Color.lightGray);
final LineAndShapeRenderer renderer = new LineAndShapeRenderer();
renderer.setSeriesLinesVisible(0,true);
renderer.setSeriesShapesVisible(1, true);
renderer.setBaseLinesVisible(true);
renderer.setBaseShapesFilled(true);
plot.setDomainGridlinesVisible(true);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRenderer(renderer);
// customise the range axis...
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setAutoRangeIncludesZero(false);
rangeAxis.setStandardTickUnits(rangeAxis.getStandardTickUnits());
return chart;
}
示例2: setPlotStyle
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
private void setPlotStyle(JFreeChart chart) throws ChartException {
if (chart == null)
throw new ChartException("chart未正確創建,設置圖表樣式時異常!");
// 獲得線性圖的Plot對象
CategoryPlot localCategoryPlot = (CategoryPlot)chart.getPlot();
localCategoryPlot.setBackgroundAlpha(this.getAlpha());
BasicStroke stroke = new BasicStroke();
localCategoryPlot.setRangeGridlinesVisible(true) ;//數據軸網格是否可見
localCategoryPlot.setRangeGridlinePaint(Color.black) ;//數據軸網格線條顏色
//localCategoryPlot.setRangeGridlineStroke(stroke) ;//數據軸網格線條筆觸
//localCategoryPlot.setDomainGridlinesVisible(true) ;//數據軸網格是否可見
//localCategoryPlot.setDomainGridlinePaint(Color.black) ;//數據軸網格線條顏色
//localCategoryPlot.setDomainGridlineStroke(stroke);
CategoryAxis localCategoryXAxis = (CategoryAxis)localCategoryPlot.getDomainAxis();
NumberAxis localNumberYAxis = (NumberAxis)localCategoryPlot.getRangeAxis();
localCategoryXAxis.setTickLabelFont(new Font("宋體", Font.PLAIN, 12));
localCategoryXAxis.setLabelFont(new Font("宋體", Font.PLAIN, 12));
localNumberYAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
localNumberYAxis.setTickLabelFont(new Font("宋體", Font.PLAIN, 12));
localNumberYAxis.setLabelFont(new Font("宋體", Font.PLAIN, 12));
LineAndShapeRenderer localLineAndShapeRenderer = (LineAndShapeRenderer)localCategoryPlot.getRenderer();
//localLineAndShapeRenderer.setDrawLines(true);// 是否折線的數據點之間用線連
//localLineAndShapeRenderer.setDrawShapes(true);// 是否折線的數據點根據分類使用不同的形狀
localLineAndShapeRenderer.setStroke(new BasicStroke(this.getStrok()));//這個是設置線條的粗細
if("1".equals(this.getDisplayNumber())){
localLineAndShapeRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());//折線上顯示數字
localLineAndShapeRenderer.setBaseItemLabelsVisible(true);
}
localLineAndShapeRenderer.setBaseShapesVisible(true);
localLineAndShapeRenderer.setBaseShapesFilled(true);
localLineAndShapeRenderer.setDrawOutlines(true);
localLineAndShapeRenderer.setUseFillPaint(true);
localLineAndShapeRenderer.setBaseFillPaint(Color.white);
}
示例3: testEquals
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
LineAndShapeRenderer r1 = new LineAndShapeRenderer();
LineAndShapeRenderer r2 = new LineAndShapeRenderer();
assertEquals(r1, r2);
r1.setBaseLinesVisible(!r1.getBaseLinesVisible());
assertFalse(r1.equals(r2));
r2.setBaseLinesVisible(r1.getBaseLinesVisible());
assertTrue(r1.equals(r2));
r1.setSeriesLinesVisible(1, true);
assertFalse(r1.equals(r2));
r2.setSeriesLinesVisible(1, true);
assertTrue(r1.equals(r2));
r1.setLinesVisible(false);
assertFalse(r1.equals(r2));
r2.setLinesVisible(false);
assertTrue(r1.equals(r2));
r1.setBaseShapesVisible(!r1.getBaseShapesVisible());
assertFalse(r1.equals(r2));
r2.setBaseShapesVisible(r1.getBaseShapesVisible());
assertTrue(r1.equals(r2));
r1.setSeriesShapesVisible(1, true);
assertFalse(r1.equals(r2));
r2.setSeriesShapesVisible(1, true);
assertTrue(r1.equals(r2));
r1.setShapesVisible(false);
assertFalse(r1.equals(r2));
r2.setShapesVisible(false);
assertTrue(r1.equals(r2));
r1.setShapesFilled(false);
assertFalse(r1.equals(r2));
r2.setShapesFilled(false);
assertTrue(r1.equals(r2));
r1.setSeriesShapesFilled(1, true);
assertFalse(r1.equals(r2));
r2.setSeriesShapesFilled(1, true);
assertTrue(r1.equals(r2));
r1.setBaseShapesFilled(false);
assertFalse(r1.equals(r2));
r2.setBaseShapesFilled(false);
assertTrue(r1.equals(r2));
r1.setUseOutlinePaint(true);
assertFalse(r1.equals(r2));
r2.setUseOutlinePaint(true);
assertTrue(r1.equals(r2));
}
示例4: createCategoryLineChart
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
private JFreeChart createCategoryLineChart(String title, String xLabel, String yLabel, CategoryDataset dataset) {
// create the chart...
JFreeChart chart = ChartFactory.createLineChart(
title, // chart title
xLabel, // domain axis label
yLabel, // range axis label
dataset, // data
orientation, // orientation
true, // include legend
true, // tooltips
false // urls
);
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.white);
// customise the range axis...
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
// customise the renderer...
LineAndShapeRenderer renderer
= (LineAndShapeRenderer) plot.getRenderer();
// System.out.println("lineCondition "+lineCondition);
if (lineCondition.indexOf("noshape")!=-1)
renderer.setBaseShapesVisible(false);
else renderer.setBaseShapesVisible(true);
if (lineCondition.indexOf("noline")!=-1)
renderer.setBaseLinesVisible(false);
if (lineCondition.indexOf("nofill")!=-1){
renderer.setBaseShapesFilled(false);
renderer.setBaseFillPaint(Color.white);
renderer.setDrawOutlines(true);}
else {
renderer.setBaseShapesFilled(true);
renderer.setUseFillPaint(false);
}
/*renderer.setShapesVisible(true);
renderer.setDrawOutlines(true);
renderer.setUseFillPaint(true);
renderer.setFillPaint(Color.white);*/
// renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
return chart;
}
示例5: testEquals
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
LineAndShapeRenderer r1 = new LineAndShapeRenderer();
LineAndShapeRenderer r2 = new LineAndShapeRenderer();
assertEquals(r1, r2);
r1.setBaseLinesVisible(!r1.getBaseLinesVisible());
assertFalse(r1.equals(r2));
r2.setBaseLinesVisible(r1.getBaseLinesVisible());
assertTrue(r1.equals(r2));
r1.setSeriesLinesVisible(1, true);
assertFalse(r1.equals(r2));
r2.setSeriesLinesVisible(1, true);
assertTrue(r1.equals(r2));
r1.setBaseShapesVisible(!r1.getBaseShapesVisible());
assertFalse(r1.equals(r2));
r2.setBaseShapesVisible(r1.getBaseShapesVisible());
assertTrue(r1.equals(r2));
r1.setSeriesShapesVisible(1, true);
assertFalse(r1.equals(r2));
r2.setSeriesShapesVisible(1, true);
assertTrue(r1.equals(r2));
r1.setSeriesShapesFilled(1, true);
assertFalse(r1.equals(r2));
r2.setSeriesShapesFilled(1, true);
assertTrue(r1.equals(r2));
r1.setBaseShapesFilled(false);
assertFalse(r1.equals(r2));
r2.setBaseShapesFilled(false);
assertTrue(r1.equals(r2));
r1.setUseOutlinePaint(true);
assertFalse(r1.equals(r2));
r2.setUseOutlinePaint(true);
assertTrue(r1.equals(r2));
r1.setUseSeriesOffset(true);
assertFalse(r1.equals(r2));
r2.setUseSeriesOffset(true);
assertTrue(r1.equals(r2));
r1.setItemMargin(0.14);
assertFalse(r1.equals(r2));
r2.setItemMargin(0.14);
assertTrue(r1.equals(r2));
}
示例6: checkIndependence
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
/**
* Checks that the two renderers are equal but independent of one another.
*
* @param r1 renderer 1.
* @param r2 renderer 2.
*
* @return A boolean.
*/
private boolean checkIndependence(LineAndShapeRenderer r1,
LineAndShapeRenderer r2) {
// should be equal...
if (!r1.equals(r2)) {
return false;
}
// and independent...
r1.setBaseLinesVisible(!r1.getBaseLinesVisible());
if (r1.equals(r2)) {
return false;
}
r2.setBaseLinesVisible(r1.getBaseLinesVisible());
if (!r1.equals(r2)) {
return false;
}
r1.setSeriesLinesVisible(1, true);
if (r1.equals(r2)) {
return false;
}
r2.setSeriesLinesVisible(1, true);
if (!r1.equals(r2)) {
return false;
}
r1.setBaseShapesVisible(!r1.getBaseShapesVisible());
if (r1.equals(r2)) {
return false;
}
r2.setBaseShapesVisible(r1.getBaseShapesVisible());
if (!r1.equals(r2)) {
return false;
}
r1.setSeriesShapesVisible(1, true);
if (r1.equals(r2)) {
return false;
}
r2.setSeriesShapesVisible(1, true);
if (!r1.equals(r2)) {
return false;
}
r1.setSeriesShapesFilled(0, false);
r2.setSeriesShapesFilled(0, true);
if (r1.equals(r2)) {
return false;
}
r2.setSeriesShapesFilled(0, false);
if (!r1.equals(r2)) {
return false;
}
r1.setBaseShapesFilled(false);
r2.setBaseShapesFilled(true);
if (r1.equals(r2)) {
return false;
}
r2.setBaseShapesFilled(false);
if (!r1.equals(r2)) {
return false;
}
return true;
}
示例7: formatChart
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
@Override
protected void formatChart() {
super.formatChart();
chart.setTitle(definition.getTitle());
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.getDomainAxis().setLabel(definition.getXAxisLabel());
plot.getRangeAxis().setLabel(definition.getYAxisLabel());
if (definition.usePercentYAxis()) {
setPercentYAxis();
}
for (int i = 0; i < plot.getRendererCount(); i++) {
LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(i);
renderer.setBaseShapesVisible(true);
renderer.setBaseShapesFilled(true);
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{1} {0} - {2}", new DecimalFormat(
"#,##0.00")));
plot.getRangeAxis(i).setLabelFont(LABEL_FONT);
plot.getRangeAxis(i).setTickLabelFont(AXIS_FONT);
}
// position of first line start and last line end
// 1.5% of the chart area within the axis will be blank space on each end
plot.getDomainAxis().setLowerMargin(.015);
plot.getDomainAxis().setUpperMargin(.015);
plot.getDomainAxis().setLabelFont(LABEL_FONT);
plot.getDomainAxis().setTickLabelFont(AXIS_FONT);
// position of first point start and last line end
// 1.5% of the chart area within the axis will be blank space on each end
plot.getDomainAxis().setLowerMargin(.015);
plot.getDomainAxis().setUpperMargin(.015);
// let each interval name have as much room as possible
plot.getDomainAxis().setCategoryMargin(0);
// gray grid lines
plot.setRangeGridlinePaint(GRID_COLOR);
plot.setRangeGridlineStroke(GRID_LINES);
}