本文整理匯總了Java中org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setSeriesFillPaint方法的典型用法代碼示例。如果您正苦於以下問題:Java XYLineAndShapeRenderer.setSeriesFillPaint方法的具體用法?Java XYLineAndShapeRenderer.setSeriesFillPaint怎麽用?Java XYLineAndShapeRenderer.setSeriesFillPaint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
的用法示例。
在下文中一共展示了XYLineAndShapeRenderer.setSeriesFillPaint方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createScatterChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入方法依賴的package包/類
@Override
protected JFreeChart createScatterChart() throws JRException
{
JFreeChart jfreeChart = super.createScatterChart();
XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
xyPlot.setRangeGridlinePaint(SCATTER_GRIDLINE_COLOR);
xyPlot.setRangeGridlineStroke(new BasicStroke(0.75f));
xyPlot.setDomainGridlinesVisible(true);
xyPlot.setDomainGridlinePaint(SCATTER_GRIDLINE_COLOR);
xyPlot.setDomainGridlineStroke(new BasicStroke(0.75f));
xyPlot.setRangeZeroBaselinePaint(ChartThemesConstants.GRAY_PAINT_134);
XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer)xyPlot.getRenderer();
lineRenderer.setUseFillPaint(true);
JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
boolean isShowLines = scatterPlot.getShowLines() == null ? false : scatterPlot.getShowLines().booleanValue();
lineRenderer.setBaseLinesVisible(isShowLines);
XYDataset xyDataset = xyPlot.getDataset();
if (xyDataset != null)
{
for (int i = 0; i < xyDataset.getSeriesCount(); i++)
{
lineRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
lineRenderer.setSeriesFillPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
lineRenderer.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(i));
//lineRenderer.setSeriesShape(i, new Ellipse2D.Double(-3, -3, 6, 6));
}
}
return jfreeChart;
}
示例2: configureXYLineAndShapeRenderer
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入方法依賴的package包/類
private static void configureXYLineAndShapeRenderer(XYLineAndShapeRenderer renderer, ValueSource valueSource,
PlotInstance plotInstance) {
renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
SeriesFormat seriesFormat = valueSource.getSeriesFormat();
DimensionConfig domainConfig = valueSource.getDomainConfig();
DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.COLOR);
DimensionConfig shapeDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.SHAPE);
ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
int seriesCount = valueSourceData.getSeriesDataForAllGroupCells().groupCellCount();
// Loop all series and set series format.
// Format based on dimension configs will be set later on in initFormatDelegate().
for (int seriesIdx = 0; seriesIdx < seriesCount; ++seriesIdx) {
// configure linestyle
if (seriesFormat.getLineStyle() == LineStyle.NONE) {
renderer.setSeriesLinesVisible(seriesIdx, false);
} else {
renderer.setSeriesLinesVisible(seriesIdx, true);
renderer.setSeriesStroke(seriesIdx, seriesFormat.getStroke(), false);
}
// configure series shape if necessary
if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, shapeDimensionConfig)) {
if (seriesFormat.getItemShape() != ItemShape.NONE) {
renderer.setSeriesShapesVisible(seriesIdx, true);
renderer.setSeriesShape(seriesIdx, seriesFormat.getItemShape().getShape());
} else {
renderer.setSeriesShapesVisible(seriesIdx, false);
}
}
// configure series color if necessary
if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, colorDimensionConfig)) {
Color itemColor = seriesFormat.getItemColor();
renderer.setSeriesPaint(seriesIdx, itemColor);
renderer.setSeriesFillPaint(seriesIdx, itemColor);
}
renderer.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT);
renderer.setUseOutlinePaint(true);
}
}
示例3: 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;
}