当前位置: 首页>>代码示例>>Java>>正文


Java XYLineAndShapeRenderer.setSeriesFillPaint方法代码示例

本文整理汇总了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;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:32,代码来源:EyeCandySixtiesChartTheme.java

示例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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:45,代码来源:ChartRendererFactory.java

示例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;
    }
 
开发者ID:glameyzhou,项目名称:scaffold,代码行数:56,代码来源:JFreeChartFactory.java


注:本文中的org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setSeriesFillPaint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。