本文整理汇总了Java中org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setShapesFilled方法的典型用法代码示例。如果您正苦于以下问题:Java XYLineAndShapeRenderer.setShapesFilled方法的具体用法?Java XYLineAndShapeRenderer.setShapesFilled怎么用?Java XYLineAndShapeRenderer.setShapesFilled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
的用法示例。
在下文中一共展示了XYLineAndShapeRenderer.setShapesFilled方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Grafico
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public Grafico(String frametitle, String charttitle, String xlabel, String ylabel, XYSeriesCollection dataset){
JFreeChart chart = ChartFactory.createXYLineChart(charttitle, xlabel, ylabel, dataset, PlotOrientation.VERTICAL, true, true, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
renderer.setShapesVisible(true);
renderer.setShapesFilled(true);
setXyplot(plot);
setChart(chart);
ChartFrame frame= new ChartFrame(frametitle,chart);
frame.pack();
frame.setVisible(true);
}
示例2: getRenderer0
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private XYLineAndShapeRenderer getRenderer0() {
// TODO Auto-generated method stub
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setShapesVisible(false);
renderer.setShapesFilled(false);
renderer.setPaint(Color.gray);
return renderer;
}
示例3: getRenderer1
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private XYLineAndShapeRenderer getRenderer1() {
// TODO Auto-generated method stub
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setPaint(Color.decode(hex_str[4]));
renderer.setShapesVisible(true);
renderer.setShapesFilled(true);
renderer.setShape(shape);
return renderer;
}
示例4: getRenderer2
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private XYLineAndShapeRenderer getRenderer2() {
// TODO Auto-generated method stub
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setStroke(new BasicStroke(stroke));
renderer.setPaint(Color.DARK_GRAY);
renderer.setShapesVisible(false);
renderer.setShapesFilled(false);
return renderer;
}
示例5: getRenderer3
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private XYLineAndShapeRenderer getRenderer3() {
// TODO Auto-generated method stub
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setStroke(new BasicStroke(stroke));
renderer.setPaint(Color.DARK_GRAY);
renderer.setShapesVisible(false);
renderer.setShapesFilled(false);
return renderer;
}
示例6: getRenderer4
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private XYItemRenderer getRenderer4() {
// TODO Auto-generated method stub
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setStroke(new BasicStroke(stroke/4));
Color c = Color.decode(hex_str[0]);
renderer.setPaint(c);
renderer.setShapesVisible(false);
renderer.setShapesFilled(false);
return renderer;
}
示例7: getRenderer5
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private XYLineAndShapeRenderer getRenderer5() {
// TODO Auto-generated method stub
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setStroke(new BasicStroke(3));
renderer.setPaint(Color.DARK_GRAY);
renderer.setShapesVisible(false);
renderer.setShapesFilled(false);
return renderer;
}
示例8: testEquals
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Problem that the equals(...) method distinguishes all fields.
*/
public void testEquals() {
XYLineAndShapeRenderer r1 = new XYLineAndShapeRenderer();
XYLineAndShapeRenderer r2 = new XYLineAndShapeRenderer();
assertEquals(r1, r2);
assertEquals(r2, r1);
r1.setLinesVisible(true);
assertFalse(r1.equals(r2));
r2.setLinesVisible(true);
assertTrue(r1.equals(r2));
r1.setSeriesLinesVisible(3, true);
assertFalse(r1.equals(r2));
r2.setSeriesLinesVisible(3, true);
assertTrue(r1.equals(r2));
r1.setDefaultLinesVisible(false);
assertFalse(r1.equals(r2));
r2.setDefaultLinesVisible(false);
assertTrue(r1.equals(r2));
r1.setShapesVisible(true);
assertFalse(r1.equals(r2));
r2.setShapesVisible(true);
assertTrue(r1.equals(r2));
r1.setSeriesShapesVisible(3, true);
assertFalse(r1.equals(r2));
r2.setSeriesShapesVisible(3, true);
assertTrue(r1.equals(r2));
r1.setDefaultShapesVisible(false);
assertFalse(r1.equals(r2));
r2.setDefaultShapesVisible(false);
assertTrue(r1.equals(r2));
r1.setShapesFilled(true);
assertFalse(r1.equals(r2));
r2.setShapesFilled(true);
assertTrue(r1.equals(r2));
r1.setSeriesShapesFilled(3, true);
assertFalse(r1.equals(r2));
r2.setSeriesShapesFilled(3, true);
assertTrue(r1.equals(r2));
r1.setDefaultShapesFilled(false);
assertFalse(r1.equals(r2));
r2.setDefaultShapesFilled(false);
assertTrue(r1.equals(r2));
r1.setDrawOutlines(true);
assertFalse(r1.equals(r2));
r2.setDrawOutlines(true);
assertTrue(r1.equals(r2));
r1.setUseOutlinePaint(true);
assertFalse(r1.equals(r2));
r2.setUseOutlinePaint(true);
assertTrue(r1.equals(r2));
}
示例9: testEquals
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
XYLineAndShapeRenderer r1 = new XYLineAndShapeRenderer();
XYLineAndShapeRenderer r2 = new XYLineAndShapeRenderer();
assertEquals(r1, r2);
assertEquals(r2, r1);
r1.setLinesVisible(true);
assertFalse(r1.equals(r2));
r2.setLinesVisible(true);
assertTrue(r1.equals(r2));
r1.setSeriesLinesVisible(3, true);
assertFalse(r1.equals(r2));
r2.setSeriesLinesVisible(3, true);
assertTrue(r1.equals(r2));
r1.setBaseLinesVisible(false);
assertFalse(r1.equals(r2));
r2.setBaseLinesVisible(false);
assertTrue(r1.equals(r2));
r1.setLegendLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0));
assertFalse(r1.equals(r2));
r2.setLegendLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0));
assertTrue(r1.equals(r2));
r1.setShapesVisible(true);
assertFalse(r1.equals(r2));
r2.setShapesVisible(true);
assertTrue(r1.equals(r2));
r1.setSeriesShapesVisible(3, true);
assertFalse(r1.equals(r2));
r2.setSeriesShapesVisible(3, true);
assertTrue(r1.equals(r2));
r1.setBaseShapesVisible(false);
assertFalse(r1.equals(r2));
r2.setBaseShapesVisible(false);
assertTrue(r1.equals(r2));
r1.setShapesFilled(true);
assertFalse(r1.equals(r2));
r2.setShapesFilled(true);
assertTrue(r1.equals(r2));
r1.setSeriesShapesFilled(3, true);
assertFalse(r1.equals(r2));
r2.setSeriesShapesFilled(3, true);
assertTrue(r1.equals(r2));
r1.setBaseShapesFilled(false);
assertFalse(r1.equals(r2));
r2.setBaseShapesFilled(false);
assertTrue(r1.equals(r2));
r1.setDrawOutlines(!r1.getDrawOutlines());
assertFalse(r1.equals(r2));
r2.setDrawOutlines(r1.getDrawOutlines());
assertTrue(r1.equals(r2));
r1.setUseOutlinePaint(true);
assertFalse(r1.equals(r2));
r2.setUseOutlinePaint(true);
assertTrue(r1.equals(r2));
r1.setUseFillPaint(true);
assertFalse(r1.equals(r2));
r2.setUseFillPaint(true);
assertTrue(r1.equals(r2));
r1.setDrawSeriesLineAsPath(true);
assertFalse(r1.equals(r2));
r2.setDrawSeriesLineAsPath(true);
assertTrue(r1.equals(r2));
}
示例10: GraphGenerator
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public GraphGenerator(final String title, AthenaFeatures athenaFeatures, String feature) {
super(title);
this.feature = feature;
final XYDataset dataset = createDatasetFromFeatureData(athenaFeatures, feature);
final JFreeChart chart = createChart(dataset);
chart.setTitle("");
LegendTitle legend = (LegendTitle) chart.getLegend();
chart.removeLegend();
Font nwfont = new Font("Arial",1,12);
legend.setItemFont(nwfont);
legend.setPosition(RectangleEdge.TOP);
// legend.setWidth(200);
legend.setItemLabelPadding(new RectangleInsets(3, 3, 3, 3));
legend.setHeight(10);
// legend.setPadding(new RectangleInsets(10, 10, 10, 10));
XYTitleAnnotation ta = new XYTitleAnnotation(0.99, 0.98, legend, RectangleAnchor.TOP_RIGHT);
ta.setMaxWidth(0.95);
// chart.addLegend(legend);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainZeroBaselinePaint(Color.gray);
plot.setDomainGridlinePaint(Color.gray);
plot.setDomainGridlineStroke(new BasicStroke(0.7f));
plot.setRangeGridlinePaint(Color.gray);
plot.setRangeGridlineStroke(new BasicStroke(0.7f));
plot.setDomainMinorGridlinePaint(Color.black);
plot.addAnnotation(ta);
final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesPaint(0, Color.black);
renderer.setSeriesShape(0, ShapeUtilities.createDiamond(5));
renderer.setSeriesPaint(1, Color.red);
renderer.setSeriesShape(1, ShapeUtilities.createUpTriangle(5));
renderer.setSeriesPaint(2, Color.blue);
Shape shape = new Ellipse2D.Double(-5.0,-5.0,10,10);
renderer.setSeriesShape(2, shape);
renderer.setShapesFilled(false);
// renderer.setSeriesShapesVisible(1, false);
//apply theme
// StandardChartTheme.createJFreeTheme().apply(chart);
plot.setRenderer(renderer);
NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
yAxis.setLabel(feature + " (K)");
yAxis.setAxisLineVisible(false);
yAxis.setTickUnit(new NumberTickUnit(50000));
yAxis.setNumberFormatOverride(new ByteFormat());
yAxis.setRange(new Range(0, 160000));
plot.getRenderer().setBaseItemLabelsVisible(true);
DateAxis xAxis = (DateAxis) plot.getDomainAxis();
xAxis.setAxisLineVisible(false);
xAxis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss"));
xAxis.setTickUnit(new DateTickUnit(DateTickUnit.MINUTE, 3));
xAxis.setLabelFont(new Font("Arial",1,12));
final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(631, 381));
chartPanel.setMouseZoomable(true, true);
setContentPane(chartPanel);
try {
ChartUtilities.saveChartAsPNG(new File("result.png"), chart, 631, 381);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例11: createLineChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public static JFreeChart createLineChart(String chartTitle, String chartXdesc, String chartYdesc,
String periodType, int dateInterval, String timeFormat, XYDataset dataSet) {
JFreeChart chart = ChartFactory.createTimeSeriesChart(
chartTitle, chartXdesc, chartYdesc, dataSet, true, false, false
);
StandardChartTheme chartTheme = new StandardChartTheme("CN");
ChartFactory.setChartTheme(chartTheme);
//设置标题
chart.setTitle(new TextTitle(chartTitle, new Font(/*"黑体"*/fontsName, Font.ITALIC, 22)));
LegendTitle legend = chart.getLegend();
legend.setItemFont(new Font(fontsName, Font.BOLD, 12)); // 设置图例的字体,防止中文乱z码
XYPlot xyplot = chart.getXYPlot();
// xyplot.setBackgroundPaint(new Color(250, 250,250));
xyplot.setBackgroundPaint(Color.white);
// xyplot.setForegroundAlpha(0.65F); // 设置前景色透明度
xyplot.setForegroundAlpha(1.0F); // 设置前景色透明度
// 设置横虚线可见
xyplot.setRangeGridlinesVisible(true);
// 虚线色彩
xyplot.setRangeGridlinePaint(Color.gray);
xyplot.getRangeAxis().setLabelFont(new Font(fontsName, Font.BOLD, 12)); // Y轴设置字体,防止中文乱码
xyplot.getDomainAxis().setLabelFont(new Font(fontsName, Font.BOLD, 12)); // X轴设置字体,防止中文乱码
//边框 不显示
xyplot.setOutlineVisible(false);
//获得 renderer 注意这里是XYLineAndShapeRenderer !!
XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
xylineandshaperenderer.setShapesVisible(true); //数据点可见
xylineandshaperenderer.setShapesFilled(true); //数据点被填充即不是空心点
xylineandshaperenderer.setSeriesFillPaint(0, Color.GREEN); //数据点填充为红色
xylineandshaperenderer.setSeriesPaint(0, Color.GREEN); //折线为绿色
xylineandshaperenderer.setUseFillPaint(true); //应用
////设置Y轴间隔
NumberAxis numAxis = (NumberAxis) xyplot.getRangeAxis();
numAxis.setTickUnit(new NumberTickUnit(1));
//边框是否显示
//设置X轴间隔
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
if (periodType.equalsIgnoreCase("MONTH")) {
dateaxis.setTickUnit(new DateTickUnit(DateTickUnitType.MONTH, dateInterval));
} else if (periodType.equalsIgnoreCase("DAY")) {
dateaxis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, dateInterval));
} else if (periodType.equalsIgnoreCase("HOUR")) {
dateaxis.setTickUnit(new DateTickUnit(DateTickUnitType.HOUR, dateInterval));
}
dateaxis.setDateFormatOverride(new SimpleDateFormat(timeFormat));
return chart;
}