Java Code Examples for org.jfree.chart.plot.XYPlot#setDomainGridlineStroke()

The following examples show how to use org.jfree.chart.plot.XYPlot#setDomainGridlineStroke() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EyeCandySixtiesChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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();
	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;
}
 
Example 2
Source File: SimpleChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void handleXYPlotSettings(XYPlot p, JRChartPlot jrPlot)
	{
		PlotSettings plotSettings = getPlotSettings();
		XYItemRenderer xyItemRenderer = p.getRenderer();
		Paint[] paintSequence = getPaintSequence(plotSettings, jrPlot);	
		if (paintSequence != null)
		{
			for (int i = 0; i < paintSequence.length; i++)
			{
				xyItemRenderer.setSeriesPaint(i, paintSequence[i]);
			}
		}
		Paint[] outlinePaintSequence = getOutlinePaintSequence(plotSettings);	
		if (outlinePaintSequence != null)
		{
			for (int i = 0; i < outlinePaintSequence.length; i++)
			{
				xyItemRenderer.setSeriesOutlinePaint(i, outlinePaintSequence[i]);
			}
		}
		Stroke[] strokeSequence = getStrokeSequence(plotSettings);
		if (strokeSequence != null)
		{
			for (int i = 0; i < strokeSequence.length; i++)
			{
				xyItemRenderer.setSeriesStroke(i, strokeSequence[i]);
			}
		}
		Stroke[] outlineStrokeSequence = getOutlineStrokeSequence(plotSettings);
		if (outlineStrokeSequence != null)
		{
			for (int i = 0; i < outlineStrokeSequence.length; i++)
			{
				xyItemRenderer.setSeriesOutlineStroke(i, outlineStrokeSequence[i]);
			}
		}
		
		Boolean domainGridlineVisible = plotSettings.getDomainGridlineVisible();
		if (domainGridlineVisible == null || domainGridlineVisible)
		{
			PaintProvider domainGridlinePaint = plotSettings.getDomainGridlinePaint();
			if (domainGridlinePaint != null)
			{
				p.setDomainGridlinePaint(domainGridlinePaint.getPaint());
			}
			Stroke domainGridlineStroke = plotSettings.getDomainGridlineStroke();
			if (domainGridlineStroke != null)
			{
				p.setDomainGridlineStroke(domainGridlineStroke);
			}
			
		}
		Boolean rangeGridlineVisible = plotSettings.getRangeGridlineVisible();
		if (rangeGridlineVisible == null || rangeGridlineVisible)
		{
			PaintProvider rangeGridlinePaint = plotSettings.getRangeGridlinePaint();
			if (rangeGridlinePaint != null)
			{
				p.setRangeGridlinePaint(rangeGridlinePaint.getPaint());
			}
			Stroke rangeGridlineStroke = plotSettings.getRangeGridlineStroke();
			if (rangeGridlineStroke != null)
			{
				p.setRangeGridlineStroke(rangeGridlineStroke);
			}
		}
		
//		p.setRangeZeroBaselineVisible(true);
		
	}
 
Example 3
Source File: ScatterPlot.java    From Benchmark with GNU General Public License v2.0 4 votes vote down vote up
public void initializePlot( XYPlot xyplot ) {
    NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis();
    NumberAxis domainAxis = (NumberAxis) xyplot.getDomainAxis();

    rangeAxis.setRange(-9.99, 109.99);
    rangeAxis.setNumberFormatOverride(pctFormat);
    rangeAxis.setTickLabelPaint(Color.decode("#666666"));
    rangeAxis.setMinorTickCount(5);
    rangeAxis.setTickUnit(new NumberTickUnit(10));
    rangeAxis.setAxisLineVisible(true);
    rangeAxis.setMinorTickMarksVisible(true);
    rangeAxis.setTickMarksVisible(true);
    rangeAxis.setLowerMargin(10);
    rangeAxis.setUpperMargin(10);
    
    domainAxis.setRange(-5, 175);
    domainAxis.setNumberFormatOverride(pctFormat);
    domainAxis.setTickLabelPaint(Color.decode("#666666"));
    domainAxis.setMinorTickCount(5);
    domainAxis.setTickUnit(new NumberTickUnit(10));
    domainAxis.setAxisLineVisible(true);
    domainAxis.setTickMarksVisible(true);
    domainAxis.setMinorTickMarksVisible(true);
    domainAxis.setLowerMargin(10);
    domainAxis.setUpperMargin(10);
    
    xyplot.setRangeGridlineStroke(new BasicStroke());
    xyplot.setRangeGridlinePaint(Color.lightGray);
    xyplot.setRangeMinorGridlinePaint(Color.decode("#DDDDDD"));
    xyplot.setRangeMinorGridlinesVisible(true);
    xyplot.setOutlineVisible(true);
    xyplot.setDomainGridlineStroke(new BasicStroke());
    xyplot.setDomainGridlinePaint(Color.lightGray);
    xyplot.setDomainMinorGridlinePaint(Color.decode("#DDDDDD"));
    xyplot.setDomainMinorGridlinesVisible(true);
    xyplot.getRenderer().setSeriesPaint(0, Color.decode("#4572a7"));

    chart.setTextAntiAlias(true);
    chart.setAntiAlias(true);
    chart.removeLegend();
    chart.setPadding(new RectangleInsets(20, 20, 20, 20));
    
    Point2D legendLocation = new Point2D.Double( 101, -10 );
    makeRect(xyplot, legendLocation, 120, 74, Color.WHITE );
   
    Point2D triangleLocation = new Point2D.Double( 101, -10 );
    Color grey = new Color(0.1f,0.1f,0.1f,0.1f);
    makeTriangle(xyplot, triangleLocation, grey );
    
    makeGuessingLine( xyplot );
}