Java Code Examples for org.jfree.chart.plot.CategoryPlot#setOutlineVisible()

The following examples show how to use org.jfree.chart.plot.CategoryPlot#setOutlineVisible() . 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: NominalAttributeStatisticsModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Creates the histogram chart.
 * 
 * @return
 */
private JFreeChart createBarChart() {
	JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL,
			false, false, false);
	AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
	chart.setBackgroundPaint(null);
	chart.setBackgroundImageAlpha(0.0f);

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

	BarRenderer renderer = (BarRenderer) plot.getRenderer();
	renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL));
	renderer.setBarPainter(new StandardBarPainter());
	renderer.setDrawBarOutline(true);
	renderer.setShadowVisible(false);

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

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

	BarRenderer renderer = (BarRenderer) plot.getRenderer();
	renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL));
	renderer.setBarPainter(new StandardBarPainter());
	renderer.setDrawBarOutline(true);
	renderer.setShadowVisible(false);

	return chart;
}
 
Example 3
Source File: EyeCandySixtiesChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected JFreeChart createGanttChart() throws JRException
{

	JFreeChart jfreeChart = super.createGanttChart();
	CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
	categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
	categoryPlot.setDomainGridlinesVisible(true);
	categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
	categoryPlot.setDomainGridlineStroke(new BasicStroke(
			0.5f,
			BasicStroke.CAP_BUTT,
			BasicStroke.JOIN_MITER,
			50,
			new float[] {1},
			0
			)
	);

	categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);

	categoryPlot.setRangeGridlinesVisible(true);
	categoryPlot.setRangeGridlineStroke(new BasicStroke(
			0.5f,
			BasicStroke.CAP_BUTT,
			BasicStroke.JOIN_MITER,
			50,
			new float[] {1},
			0
			)
	);

	categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
	categoryPlot.getDomainAxis().setTickLabelsVisible(
			//barPlot.isShowTickLabels()
			true
			);
	CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
	categoryRenderer.setBaseItemLabelsVisible(true);
	BarRenderer barRenderer = (BarRenderer)categoryRenderer;
	barRenderer.setSeriesPaint(0, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(3));
	barRenderer.setSeriesPaint(1, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(0));
	CategoryDataset categoryDataset = categoryPlot.getDataset();
	if (categoryDataset != null)
	{
		for (int i = 0; i < categoryDataset.getRowCount(); i++)
		{
			barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
			barRenderer.setSeriesItemLabelsVisible(i, true);
		}
	}
	categoryPlot.setOutlinePaint(Color.DARK_GRAY);
	categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
	categoryPlot.setOutlineVisible(true);
	return jfreeChart;
}
 
Example 4
Source File: AegeanChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
	protected JFreeChart createGanttChart() throws JRException
	{

		JFreeChart jfreeChart = super.createGanttChart();
		CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
		categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
		categoryPlot.setDomainGridlinesVisible(true);
		categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
		categoryPlot.setDomainGridlineStroke(new BasicStroke(
				0.5f,
				BasicStroke.CAP_BUTT,
				BasicStroke.JOIN_MITER,
				50,
				new float[] {1},
				0
				)
		);

		categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);

		categoryPlot.setRangeGridlinesVisible(true);
		categoryPlot.setRangeGridlineStroke(new BasicStroke(
				0.5f,
				BasicStroke.CAP_BUTT,
				BasicStroke.JOIN_MITER,
				50,
				new float[] {1},
				0
				)
		);

		categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
//		JRBarPlot barPlot = (BarPlot)categoryPlot;
//		categoryPlot.getDomainAxis().setTickLabelsVisible(
//				categoryPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().
//				true
//				);
		CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
		categoryRenderer.setBaseItemLabelsVisible(true);
		BarRenderer barRenderer = (BarRenderer)categoryRenderer;
		@SuppressWarnings("unchecked")
		List<Paint> seriesPaints = (List<Paint>)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);
		barRenderer.setSeriesPaint(0, seriesPaints.get(3));
		barRenderer.setSeriesPaint(1, seriesPaints.get(0));
		CategoryDataset categoryDataset = categoryPlot.getDataset();
		if(categoryDataset != null)
		{
			for(int i = 0; i < categoryDataset.getRowCount(); i++)
			{
				barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
				barRenderer.setSeriesItemLabelsVisible(i, true);
	//			barRenderer.setSeriesPaint(i, GRADIENT_PAINTS[i]);
	//			CategoryMarker categoryMarker = new CategoryMarker(categoryDataset.getColumnKey(i),MARKER_COLOR, new BasicStroke(1f));
	//			categoryMarker.setAlpha(0.5f);
	//			categoryPlot.addDomainMarker(categoryMarker, Layer.BACKGROUND);
			}
		}
		categoryPlot.setOutlinePaint(Color.DARK_GRAY);
		categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
		categoryPlot.setOutlineVisible(true);
		return jfreeChart;
	}
 
Example 5
Source File: MonitoringPage.java    From webanno with Apache License 2.0 4 votes vote down vote up
private JFreeChart createProgressChart(Map<String, Integer> chartValues, int aMaxValue,
        boolean aIsPercentage)
{
    // fill dataset
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    if (aMaxValue > 0) {
        for (String chartValue : chartValues.keySet()) {
            dataset.setValue(chartValues.get(chartValue), "Completion", chartValue);
        }
    }
    
    // create chart
    JFreeChart chart = ChartFactory.createBarChart(null, null, null, dataset,
            PlotOrientation.HORIZONTAL, false, false, false);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setOutlineVisible(false);
    plot.setBackgroundPaint(null);
    plot.setNoDataMessage("No data");
    plot.setInsets(new RectangleInsets(0, 20, 0, 20));
    if (aMaxValue > 0) {
        plot.getRangeAxis().setRange(0.0, aMaxValue);
        ((NumberAxis) plot.getRangeAxis()).setNumberFormatOverride(new DecimalFormat("0"));
        // For documents less than 10, avoid repeating the number of documents such
        // as 0 0 1 1 1 - NumberTickUnit automatically determines the range
        if (!aIsPercentage && aMaxValue <= 10) {
            TickUnits standardUnits = new TickUnits();
            NumberAxis tick = new NumberAxis();
            tick.setTickUnit(new NumberTickUnit(1));
            standardUnits.add(tick.getTickUnit());
            plot.getRangeAxis().setStandardTickUnits(standardUnits);
        }
    }
    else {
        plot.getRangeAxis().setVisible(false);
        plot.getDomainAxis().setVisible(false);
    }

    BarRenderer renderer = new BarRenderer();
    renderer.setBarPainter(new StandardBarPainter());
    renderer.setShadowVisible(false);
    // renderer.setGradientPaintTransformer(new
    // StandardGradientPaintTransformer(
    // GradientPaintTransformType.HORIZONTAL));
    renderer.setSeriesPaint(0, Color.BLUE);
    chart.getCategoryPlot().setRenderer(renderer);

    return chart;
}