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

The following examples show how to use org.jfree.chart.plot.XYPlot#setRangeZeroBaselineVisible() . 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: BeltDateTimeColumnStatisticsModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Creates the histogram chart.
 */
private JFreeChart createHistogramChart(final Table table) {
	JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(table),
			PlotOrientation.VERTICAL, false, false, false);
	setDefaultChartFonts(chart);
	chart.setBackgroundPaint(null);
	chart.setBackgroundImageAlpha(0.0f);

	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setRangeGridlinesVisible(false);
	plot.setDomainGridlinesVisible(false);
	plot.setOutlineVisible(false);
	plot.setRangeZeroBaselineVisible(false);
	plot.setDomainZeroBaselineVisible(false);
	plot.getDomainAxis().setTickLabelsVisible(false);
	plot.setBackgroundPaint(COLOR_INVISIBLE);
	plot.setBackgroundImageAlpha(0.0f);

	XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
	renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.DATE_TIME));
	renderer.setBarPainter(new StandardXYBarPainter());
	renderer.setDrawBarOutline(true);
	renderer.setShadowVisible(false);

	return chart;
}
 
Example 2
Source File: BeltNumericalColumnStatisticsModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Creates the histogram chart.
 */
private JFreeChart createHistogramChart(Table table) {
	JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(table),
			PlotOrientation.VERTICAL, false, false, false);
	AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
	chart.setBackgroundPaint(null);
	chart.setBackgroundImageAlpha(0.0f);

	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setRangeGridlinesVisible(false);
	plot.setDomainGridlinesVisible(false);
	plot.setOutlineVisible(false);
	plot.setRangeZeroBaselineVisible(false);
	plot.setDomainZeroBaselineVisible(false);
	plot.setBackgroundPaint(COLOR_INVISIBLE);
	plot.setBackgroundImageAlpha(0.0f);

	XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
	renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NUMERICAL));
	renderer.setBarPainter(new StandardXYBarPainter());
	renderer.setDrawBarOutline(true);
	renderer.setShadowVisible(false);

	return chart;
}
 
Example 3
Source File: BeltTimeColumnStatisticsModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Creates the histogram chart.
 */
private JFreeChart createHistogramChart(final Table table) {
	JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(table),
			PlotOrientation.VERTICAL, false, false, false);
	setDefaultChartFonts(chart);
	chart.setBackgroundPaint(null);
	chart.setBackgroundImageAlpha(0.0f);

	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setRangeGridlinesVisible(false);
	plot.setDomainGridlinesVisible(false);
	plot.setOutlineVisible(false);
	plot.setRangeZeroBaselineVisible(false);
	plot.setDomainZeroBaselineVisible(false);
	plot.getDomainAxis().setTickLabelsVisible(false);
	plot.setBackgroundPaint(COLOR_INVISIBLE);
	plot.setBackgroundImageAlpha(0.0f);

	XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
	renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.DATE_TIME));
	renderer.setBarPainter(new StandardXYBarPainter());
	renderer.setDrawBarOutline(true);
	renderer.setShadowVisible(false);

	return chart;
}
 
Example 4
Source File: DateTimeAttributeStatisticsModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Creates the histogram chart.
 *
 * @param exampleSet
 * @return
 */
private JFreeChart createHistogramChart(final ExampleSet exampleSet) {
	JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
			PlotOrientation.VERTICAL, false, false, false);
	AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
	chart.setBackgroundPaint(null);
	chart.setBackgroundImageAlpha(0.0f);

	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setRangeGridlinesVisible(false);
	plot.setDomainGridlinesVisible(false);
	plot.setOutlineVisible(false);
	plot.setRangeZeroBaselineVisible(false);
	plot.setDomainZeroBaselineVisible(false);
	plot.getDomainAxis().setTickLabelsVisible(false);
	plot.setBackgroundPaint(COLOR_INVISIBLE);
	plot.setBackgroundImageAlpha(0.0f);

	XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
	renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.DATE_TIME));
	renderer.setBarPainter(new StandardXYBarPainter());
	renderer.setDrawBarOutline(true);
	renderer.setShadowVisible(false);

	return chart;
}
 
Example 5
Source File: NumericalAttributeStatisticsModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Creates the histogram chart.
 *
 * @param exampleSet
 * @return
 */
private JFreeChart createHistogramChart(ExampleSet exampleSet) {
	JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
			PlotOrientation.VERTICAL, false, false, false);
	AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
	chart.setBackgroundPaint(null);
	chart.setBackgroundImageAlpha(0.0f);

	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setRangeGridlinesVisible(false);
	plot.setDomainGridlinesVisible(false);
	plot.setOutlineVisible(false);
	plot.setRangeZeroBaselineVisible(false);
	plot.setDomainZeroBaselineVisible(false);
	plot.setBackgroundPaint(COLOR_INVISIBLE);
	plot.setBackgroundImageAlpha(0.0f);

	XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
	renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NUMERICAL));
	renderer.setBarPainter(new StandardXYBarPainter());
	renderer.setDrawBarOutline(true);
	renderer.setShadowVisible(false);

	return chart;
}
 
Example 6
Source File: ChartManager.java    From jamel with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates and returns a new plot with the specified dataset, axes and
 * renderer.
 * 
 * @param dataset
 *            the dataset (<code>null</code> permitted).
 * @param xAxis
 *            the x axis (<code>null</code> permitted).
 * @param yAxis
 *            the y axis (<code>null</code> permitted).
 * @param renderer
 *            the renderer (<code>null</code> permitted).
 * @return a new plot.
 */
private static XYPlot createXYPlot(XYDataset dataset, NumberAxis xAxis, NumberAxis yAxis, XYItemRenderer renderer) {
	final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
	plot.setOrientation(PlotOrientation.VERTICAL);
	plot.setDomainGridlinesVisible(false);
	plot.setDomainMinorGridlinesVisible(false);
	plot.setRangeGridlinesVisible(false);
	plot.setRangeMinorGridlinesVisible(false);
	plot.setRangeCrosshairVisible(false);
	plot.setDomainCrosshairVisible(false);
	plot.setBackgroundPaint(Color.white);
	// plot.getRangeAxis().setLabelFont(axisLabelFont);
	// plot.getDomainAxis().setLabelFont(axisLabelFont);
	plot.setDomainZeroBaselineVisible(true);
	plot.setRangeZeroBaselineVisible(true);
	return plot;
}
 
Example 7
Source File: ChartFactory.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a histogram chart.  This chart is constructed with an
 * {@link XYPlot} using an {@link XYBarRenderer}.  The domain and range
 * axes are {@link NumberAxis} instances.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  the x axis label (<code>null</code> permitted).
 * @param yAxisLabel  the y axis label (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param orientation  the orientation (horizontal or vertical)
 *                     (<code>null</code> NOT permitted).
 * @param legend  create a legend?
 * @param tooltips  display tooltips?
 * @param urls  generate URLs?
 *
 * @return The chart.
 */
public static JFreeChart createHistogram(String title,
        String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset,
        PlotOrientation orientation, boolean legend, boolean tooltips,
        boolean urls) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);

    XYItemRenderer renderer = new XYBarRenderer();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
Example 8
Source File: ChartFactory.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a histogram chart.  This chart is constructed with an
 * {@link XYPlot} using an {@link XYBarRenderer}.  The domain and range
 * axes are {@link NumberAxis} instances.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  the x axis label (<code>null</code> permitted).
 * @param yAxisLabel  the y axis label (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param orientation  the orientation (horizontal or vertical)
 *                     (<code>null</code> NOT permitted).
 * @param legend  create a legend?
 * @param tooltips  display tooltips?
 * @param urls  generate URLs?
 *
 * @return The chart.
 */
public static JFreeChart createHistogram(String title,
        String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset,
        PlotOrientation orientation, boolean legend, boolean tooltips,
        boolean urls) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);

    XYItemRenderer renderer = new XYBarRenderer();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
Example 9
Source File: ChartFactory.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a histogram chart.  This chart is constructed with an
 * {@link XYPlot} using an {@link XYBarRenderer}.  The domain and range
 * axes are {@link NumberAxis} instances.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  the x axis label (<code>null</code> permitted).
 * @param yAxisLabel  the y axis label (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param orientation  the orientation (horizontal or vertical)
 *                     (<code>null</code> NOT permitted).
 * @param legend  create a legend?
 * @param tooltips  display tooltips?
 * @param urls  generate URLs?
 *
 * @return The chart.
 */
public static JFreeChart createHistogram(String title,
        String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset,
        PlotOrientation orientation, boolean legend, boolean tooltips,
        boolean urls) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);

    XYItemRenderer renderer = new XYBarRenderer();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
Example 10
Source File: ChartFactory.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a histogram chart.  This chart is constructed with an
 * {@link XYPlot} using an {@link XYBarRenderer}.  The domain and range
 * axes are {@link NumberAxis} instances.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  the x axis label (<code>null</code> permitted).
 * @param yAxisLabel  the y axis label (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param orientation  the orientation (horizontal or vertical)
 *                     (<code>null</code> NOT permitted).
 * @param legend  create a legend?
 * @param tooltips  display tooltips?
 * @param urls  generate URLs?
 *
 * @return The chart.
 */
public static JFreeChart createHistogram(String title,
        String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset,
        PlotOrientation orientation, boolean legend, boolean tooltips,
        boolean urls) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);

    XYItemRenderer renderer = new XYBarRenderer();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
Example 11
Source File: ChartFactory.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a histogram chart.  This chart is constructed with an
 * {@link XYPlot} using an {@link XYBarRenderer}.  The domain and range
 * axes are {@link NumberAxis} instances.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  the x axis label (<code>null</code> permitted).
 * @param yAxisLabel  the y axis label (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param orientation  the orientation (horizontal or vertical)
 *                     (<code>null</code> NOT permitted).
 * @param legend  create a legend?
 * @param tooltips  display tooltips?
 * @param urls  generate URLs?
 *
 * @return The chart.
 */
public static JFreeChart createHistogram(String title,
        String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset,
        PlotOrientation orientation, boolean legend, boolean tooltips,
        boolean urls) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);

    XYItemRenderer renderer = new XYBarRenderer();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
Example 12
Source File: ChartFactory.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a histogram chart.  This chart is constructed with an
 * {@link XYPlot} using an {@link XYBarRenderer}.  The domain and range
 * axes are {@link NumberAxis} instances.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  the x axis label (<code>null</code> permitted).
 * @param yAxisLabel  the y axis label (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param orientation  the orientation (horizontal or vertical)
 *                     (<code>null</code> NOT permitted).
 * @param legend  create a legend?
 * @param tooltips  display tooltips?
 * @param urls  generate URLs?
 *
 * @return The chart.
 */
public static JFreeChart createHistogram(String title,
        String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset,
        PlotOrientation orientation, boolean legend, boolean tooltips,
        boolean urls) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);

    XYItemRenderer renderer = new XYBarRenderer();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
Example 13
Source File: EyeCandySixtiesChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected void configurePlot(Plot plot, JRChartPlot jrPlot)
{
	super.configurePlot(plot, jrPlot);
	if (plot instanceof CategoryPlot)
	{
		CategoryPlot categoryPlot = (CategoryPlot)plot;
		CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
		CategoryDataset categoryDataset = categoryPlot.getDataset();
		if (categoryDataset != null)
		{
			for (int i = 0; i < categoryDataset.getRowCount(); i++)
			{
				categoryRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
			}
		}
		categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
		categoryPlot.setRangeGridlineStroke(new BasicStroke(1f));
		categoryPlot.setDomainGridlinesVisible(false);
		
	}
	else if (plot instanceof XYPlot)
	{
		XYPlot xyPlot = (XYPlot)plot;
		XYDataset xyDataset = xyPlot.getDataset();
		if (xyDataset != null)
		{
			XYItemRenderer xyItemRenderer = xyPlot.getRenderer();
			for (int i = 0; i < xyDataset.getSeriesCount(); i++)
			{
				xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
			}
		}
		xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
		xyPlot.setRangeGridlineStroke(new BasicStroke(1f));
		xyPlot.setDomainGridlinesVisible(false);
		
		xyPlot.setRangeZeroBaselineVisible(true);

	}
}
 
Example 14
Source File: AegeanChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected void configurePlot(Plot plot, JRChartPlot jrPlot)
{

	super.configurePlot(plot, jrPlot);

	if(plot instanceof CategoryPlot)
	{
		CategoryPlot categoryPlot = (CategoryPlot)plot;
		CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
		CategoryDataset categoryDataset = categoryPlot.getDataset();
		if(categoryDataset != null)
		{
			for(int i = 0; i < categoryDataset.getRowCount(); i++)
			{
				categoryRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
			}
		}
		categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
		categoryPlot.setRangeGridlineStroke(new BasicStroke(0.5f));
		categoryPlot.setDomainGridlinesVisible(false);
		categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
	}
	else if(plot instanceof XYPlot)
	{
		XYPlot xyPlot = (XYPlot)plot;
		XYItemRenderer xyItemRenderer = xyPlot.getRenderer();
		XYDataset xyDataset = xyPlot.getDataset();
		if(xyDataset != null)
		{
			for(int i = 0; i < xyDataset.getSeriesCount(); i++)
			{
				xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
			}
		}
		xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
		xyPlot.setRangeGridlineStroke(new BasicStroke(0.5f));
		xyPlot.setDomainGridlinesVisible(false);
		xyPlot.setRangeZeroBaselineVisible(true);
	}
}