本文整理汇总了Java中org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setAutoPopulateSeriesStroke方法的典型用法代码示例。如果您正苦于以下问题:Java XYLineAndShapeRenderer.setAutoPopulateSeriesStroke方法的具体用法?Java XYLineAndShapeRenderer.setAutoPopulateSeriesStroke怎么用?Java XYLineAndShapeRenderer.setAutoPopulateSeriesStroke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
的用法示例。
在下文中一共展示了XYLineAndShapeRenderer.setAutoPopulateSeriesStroke方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Creates a chart.
*
* @param dataset a dataset.
*
* @return A chart.
*/
private static JFreeChart createChart(XYDataset dataset) {
JFreeChart chart = ChartFactory.createTimeSeriesChart(
"International Coffee Organisation : Coffee Prices", // title
null, // x-axis label
"US cents/lb", // y-axis label
dataset);
String fontName = "Palatino";
chart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));
chart.addSubtitle(new TextTitle("Source: http://www.ico.org/historical/2010-19/PDF/HIST-PRICES.pdf", new Font(fontName, Font.PLAIN, 14)));
XYPlot plot = (XYPlot) chart.getPlot();
plot.setDomainPannable(true);
plot.setRangePannable(false);
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(true);
plot.getDomainAxis().setLowerMargin(0.0);
plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
chart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
chart.getLegend().setFrame(BlockBorder.NONE);
chart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
XYItemRenderer r = plot.getRenderer();
if (r instanceof XYLineAndShapeRenderer) {
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
renderer.setDefaultShapesVisible(false);
renderer.setDrawSeriesLineAsPath(true);
// set the default stroke for all series
renderer.setAutoPopulateSeriesStroke(false);
renderer.setDefaultStroke(new BasicStroke(3.0f,
BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL), false);
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, new Color(24, 123, 58));
renderer.setSeriesPaint(2, new Color(149, 201, 136));
renderer.setSeriesPaint(3, new Color(1, 62, 29));
renderer.setSeriesPaint(4, new Color(81, 176, 86));
renderer.setSeriesPaint(5, new Color(0, 55, 122));
renderer.setSeriesPaint(6, new Color(0, 92, 165));
renderer.setDefaultLegendTextFont(new Font(fontName, Font.PLAIN, 14));
}
return chart;
}
示例2: createChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Creates a chart.
*
* @param dataset a dataset.
*
* @return A chart.
*/
private static JFreeChart createChart(XYDataset dataset) {
JFreeChart chart = ChartFactory.createTimeSeriesChart(
"International Coffee Organisation : Coffee Prices", // title
null, // x-axis label
"US cents/lb", // y-axis label
dataset);
String fontName = "Palatino";
chart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));
chart.addSubtitle(new TextTitle("Source: http://www.ico.org/historical/2010-19/PDF/HIST-PRICES.pdf",
new Font(fontName, Font.PLAIN, 14)));
XYPlot plot = (XYPlot) chart.getPlot();
plot.setDomainPannable(true);
plot.setRangePannable(true);
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(true);
plot.getDomainAxis().setLowerMargin(0.0);
plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
chart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
chart.getLegend().setFrame(BlockBorder.NONE);
chart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
XYItemRenderer r = plot.getRenderer();
if (r instanceof XYLineAndShapeRenderer) {
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
renderer.setDefaultShapesVisible(false);
renderer.setDrawSeriesLineAsPath(true);
// set the default stroke for all series
renderer.setAutoPopulateSeriesStroke(false);
renderer.setDefaultStroke(new BasicStroke(3.0f));
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, new Color(24, 123, 58));
renderer.setSeriesPaint(2, new Color(149, 201, 136));
renderer.setSeriesPaint(3, new Color(1, 62, 29));
renderer.setSeriesPaint(4, new Color(81, 176, 86));
renderer.setSeriesPaint(5, new Color(0, 55, 122));
renderer.setSeriesPaint(6, new Color(0, 92, 165));
}
return chart;
}
示例3: createChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Creates a chart.
*
* @param dataset a dataset.
*
* @return A chart.
*/
private static JFreeChart createChart(XYDataset dataset) {
JFreeChart chart = ChartFactory.createTimeSeriesChart(
"International Coffee Organisation : Coffee Prices", // title
null, // x-axis label
"US cents/lb", // y-axis label
dataset);
String fontName = "Palatino";
chart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));
chart.addSubtitle(new TextTitle("Source: http://www.ico.org/historical/2010-19/PDF/HIST-PRICES.pdf",
new Font(fontName, Font.PLAIN, 14)));
XYPlot plot = (XYPlot) chart.getPlot();
plot.setDomainPannable(true);
plot.setRangePannable(true);
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(true);
plot.getDomainAxis().setLowerMargin(0.0);
plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
chart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
chart.getLegend().setFrame(BlockBorder.NONE);
chart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
XYItemRenderer r = plot.getRenderer();
if (r instanceof XYLineAndShapeRenderer) {
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
renderer.setBaseShapesVisible(false);
renderer.setDrawSeriesLineAsPath(true);
// set the default stroke for all series
renderer.setAutoPopulateSeriesStroke(false);
renderer.setBaseStroke(new BasicStroke(3.0f, BasicStroke.CAP_ROUND,
BasicStroke.JOIN_BEVEL), false);
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, new Color(24, 123, 58));
renderer.setSeriesPaint(2, new Color(149, 201, 136));
renderer.setSeriesPaint(3, new Color(1, 62, 29));
renderer.setSeriesPaint(4, new Color(81, 176, 86));
renderer.setSeriesPaint(5, new Color(0, 55, 122));
renderer.setSeriesPaint(6, new Color(0, 92, 165));
}
return chart;
}