Java Code Examples for org.jfree.chart.renderer.category.BarRenderer#setShadowVisible()
The following examples show how to use
org.jfree.chart.renderer.category.BarRenderer#setShadowVisible() .
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: ChartRendererFactory.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
private static void configureBarRenderer(BarRenderer renderer, ValueSource valueSource, PlotInstance plotInstance) { StandardBarPainter barPainter = new StandardBarPainter(); renderer.setBarPainter(barPainter); renderer.setGradientPaintTransformer(null); ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource); int seriesCount = valueSourceData.getSeriesCount(); DimensionConfig domainConfig = valueSource.getDomainConfig(); DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig( PlotDimension.COLOR); SeriesFormat seriesFormat = valueSource.getSeriesFormat(); // 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 series paint if necessary if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, colorDimensionConfig)) { renderer.setSeriesPaint(seriesIdx, seriesFormat.getAreaFillPaint()); } // configure general style of the bars renderer.setShadowVisible(false); renderer.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT); } renderer.setDrawBarOutline(true); }
Example 2
Source File: NominalAttributeStatisticsModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * 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 3
Source File: BeltNominalColumnStatisticsModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * 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 4
Source File: ChartFormatter.java From nmonvisualizer with Apache License 2.0 | 5 votes |
void formatRenderer(BarRenderer renderer) { renderer.setShadowVisible(false); renderer.setDrawBarOutline(false); renderer.setBarPainter(new GradientPainters.GradientBarPainter()); renderer.setBaseOutlineStroke(OUTLINE_STROKE); renderer.setBaseOutlinePaint(OUTLINE_COLOR); }
Example 5
Source File: DefaultChartService.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Returns a bar renderer. */ private BarRenderer getBarRenderer() { BarRenderer renderer = new BarRenderer(); renderer.setMaximumBarWidth( 0.07 ); for ( int i = 0; i < COLORS.length; i++ ) { renderer.setSeriesPaint( i, COLORS[i] ); renderer.setShadowVisible( false ); } return renderer; }
Example 6
Source File: ChartImageGenerator.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Returns a bar renderer. */ private BarRenderer getBarRenderer() { BarRenderer renderer = new BarRenderer(); renderer.setMaximumBarWidth( 0.07 ); for ( int i = 0; i < COLORS.length; i++ ) { renderer.setSeriesPaint( i, COLORS[i] ); renderer.setShadowVisible( false ); } return renderer; }
Example 7
Source File: BarChartExpression.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
protected void configureChart( final JFreeChart chart ) { final CategoryPlot cpl = chart.getCategoryPlot(); final CategoryItemRenderer renderer = cpl.getRenderer(); final BarRenderer br = (BarRenderer) renderer; if ( isAutoRange() ) { br.setIncludeBaseInRange( false ); } super.configureChart( chart ); br.setDrawBarOutline( isChartSectionOutline() ); if ( maxBarWidth != null ) { br.setMaximumBarWidth( maxBarWidth.doubleValue() ); } if ( itemMargin != null ) { br.setItemMargin( itemMargin.doubleValue() ); } if ( ( isStacked() ) && stackedBarRenderPercentages && ( br instanceof StackedBarRenderer ) ) { final StackedBarRenderer sbr = (StackedBarRenderer) br; sbr.setRenderAsPercentages( true ); } br.setShadowVisible( shadowVisible ); if ( shadowColor != null ) { br.setShadowPaint( shadowColor ); } br.setShadowXOffset( shadowXOffset ); br.setShadowYOffset( shadowYOffset ); }
Example 8
Source File: ChartWriterFactory.java From entity-system-benchmarks with Apache License 2.0 | 5 votes |
private static void notSoUglyPlease(JFreeChart chart) { String fontName = "Lucida Sans"; StandardChartTheme theme = (StandardChartTheme)org.jfree.chart.StandardChartTheme.createJFreeTheme(); theme.setTitlePaint( Color.decode("#4572a7") ); theme.setExtraLargeFont(new Font(fontName, Font.BOLD, 14)); //title theme.setLargeFont(new Font(fontName, Font.BOLD, 15)); //axis-title theme.setRegularFont(new Font(fontName, Font.PLAIN, 11)); theme.setRangeGridlinePaint(Color.decode("#C0C0C0")); theme.setPlotBackgroundPaint(Color.white); theme.setChartBackgroundPaint(Color.white); theme.setGridBandPaint(Color.red); theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); theme.setBarPainter(new StandardBarPainter()); theme.setAxisLabelPaint(Color.decode("#666666")); theme.apply(chart); chart.getCategoryPlot().setOutlineVisible(false); chart.getCategoryPlot().getRangeAxis().setAxisLineVisible(false); chart.getCategoryPlot().getRangeAxis().setTickMarksVisible(false); chart.getCategoryPlot().setRangeGridlineStroke(new BasicStroke()); chart.getCategoryPlot().getRangeAxis().setTickLabelPaint(Color.decode("#666666")); chart.getCategoryPlot().getDomainAxis().setTickLabelPaint(Color.decode("#666666")); chart.setTextAntiAlias(true); chart.setAntiAlias(true); BarRenderer rend = (BarRenderer) chart.getCategoryPlot().getRenderer(); rend.setShadowVisible(true); rend.setShadowXOffset(2); rend.setShadowYOffset(0); rend.setShadowPaint(Color.decode("#C0C0C0")); rend.setMaximumBarWidth(0.1); }
Example 9
Source File: MonitoringPage.java From webanno with Apache License 2.0 | 4 votes |
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; }
Example 10
Source File: StandardChartTheme.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }
Example 11
Source File: StandardChartTheme.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }
Example 12
Source File: SymmetryInSCOPSuperfamilies.java From symmetry with GNU Lesser General Public License v2.1 | 4 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart("Symmetry in SCOP superfamilies", "SCOP Class", "% symmetry", dataset, PlotOrientation.VERTICAL,true,true,true); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLowerBound(0); rangeAxis.setUpperBound(1); //rangeAxis.setStandardTickUnits(NumberAxis.); // disable bar outlines... BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(true); // set up gradient paints for series... // GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, // 0.0f, 0.0f, new Color(0, 0, 64)); // GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, // 0.0f, 0.0f, new Color(0, 64, 0)); // GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, // 0.0f, 0.0f, new Color(64, 0, 0)); //renderer.setSeriesPaint(0, gp0); //renderer.setSeriesPaint(1, gp1); //renderer.setSeriesPaint(2, gp2); renderer.setShadowVisible(false); // rotate legend // CategoryAxis domainAxis = plot.getDomainAxis(); // domainAxis.setCategoryLabelPositions( // CategoryLabelPositions.createUpRotationLabelPositions( // Math.PI / 6.0)); return chart; }
Example 13
Source File: StandardChartTheme.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { if (renderer == null) { throw new IllegalArgumentException("Null 'renderer' argument."); } if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }
Example 14
Source File: BarRendererTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Test that the equals() method distinguishes all fields. */ public void testEquals() { BarRenderer r1 = new BarRenderer(); BarRenderer r2 = new BarRenderer(); assertTrue(r1.equals(r2)); assertTrue(r2.equals(r1)); // base value r1.setBase(0.123); assertFalse(r1.equals(r2)); r2.setBase(0.123); assertTrue(r1.equals(r2)); // itemMargin r1.setItemMargin(0.22); assertFalse(r1.equals(r2)); r2.setItemMargin(0.22); assertTrue(r1.equals(r2)); // drawBarOutline r1.setDrawBarOutline(!r1.isDrawBarOutline()); assertFalse(r1.equals(r2)); r2.setDrawBarOutline(!r2.isDrawBarOutline()); assertTrue(r1.equals(r2)); // maximumBarWidth r1.setMaximumBarWidth(0.11); assertFalse(r1.equals(r2)); r2.setMaximumBarWidth(0.11); assertTrue(r1.equals(r2)); // minimumBarLength r1.setMinimumBarLength(0.04); assertFalse(r1.equals(r2)); r2.setMinimumBarLength(0.04); assertTrue(r1.equals(r2)); // gradientPaintTransformer r1.setGradientPaintTransformer(new StandardGradientPaintTransformer( GradientPaintTransformType.CENTER_VERTICAL)); assertFalse(r1.equals(r2)); r2.setGradientPaintTransformer(new StandardGradientPaintTransformer( GradientPaintTransformType.CENTER_VERTICAL)); assertTrue(r1.equals(r2)); // positiveItemLabelPositionFallback r1.setPositiveItemLabelPositionFallback(new ItemLabelPosition( ItemLabelAnchor.INSIDE1, TextAnchor.CENTER)); assertFalse(r1.equals(r2)); r2.setPositiveItemLabelPositionFallback(new ItemLabelPosition( ItemLabelAnchor.INSIDE1, TextAnchor.CENTER)); assertTrue(r1.equals(r2)); // negativeItemLabelPositionFallback r1.setNegativeItemLabelPositionFallback(new ItemLabelPosition( ItemLabelAnchor.INSIDE1, TextAnchor.CENTER)); assertFalse(r1.equals(r2)); r2.setNegativeItemLabelPositionFallback(new ItemLabelPosition( ItemLabelAnchor.INSIDE1, TextAnchor.CENTER)); assertTrue(r1.equals(r2)); // barPainter r1.setBarPainter(new GradientBarPainter(0.1, 0.2, 0.3)); assertFalse(r1.equals(r2)); r2.setBarPainter(new GradientBarPainter(0.1, 0.2, 0.3)); assertTrue(r1.equals(r2)); // shadowsVisible r1.setShadowVisible(false); assertFalse(r1.equals(r2)); r2.setShadowVisible(false); assertTrue(r1.equals(r2)); r1.setShadowPaint(Color.red); assertFalse(r1.equals(r2)); r2.setShadowPaint(Color.red); assertTrue(r1.equals(r2)); // shadowXOffset r1.setShadowXOffset(3.3); assertFalse(r1.equals(r2)); r2.setShadowXOffset(3.3); assertTrue(r1.equals(r2)); // shadowYOffset r1.setShadowYOffset(3.3); assertFalse(r1.equals(r2)); r2.setShadowYOffset(3.3); assertTrue(r1.equals(r2)); }
Example 15
Source File: StandardChartTheme.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }
Example 16
Source File: StandardChartTheme.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }
Example 17
Source File: StandardChartTheme.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }
Example 18
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ protected JFreeChart createGanttChart() throws JRException { //FIXMECHART legend/tooltip/url should come from plot? ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createGanttChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBarPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRBarPlot)getPlot()).getValueAxisLabelExpression()), (GanttCategoryDataset)getDataset(), isShowLegend(), true, //FIXMECHART tooltip: I guess BarPlot is not the best for gantt false ); configureChart(jfreeChart, getPlot()); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); //plot.setNoDataMessage("No data to display"); JRBarPlot barPlot = (JRBarPlot)getPlot(); boolean isShowTickMarks = barPlot.getShowTickMarks() == null ? true : barPlot.getShowTickMarks(); boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels(); boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels(); //FIXMETHEME these are useless if the theme settings apply after regardless of these; check all categoryPlot.getDomainAxis().setTickMarksVisible(isShowTickMarks); categoryPlot.getDomainAxis().setTickLabelsVisible(isShowTickLabels); // Handle the axis formating for the category axis configureAxis( categoryPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(), barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(), barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(), barPlot.getCategoryAxisVerticalTickLabels(), barPlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), (Comparable<?>)evaluateExpression(barPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(barPlot.getDomainAxisMaxValueExpression()) ); ((DateAxis)categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks); ((DateAxis)categoryPlot.getRangeAxis()).setTickLabelsVisible(isShowTickLabels); // Handle the axis formating for the value axis configureAxis( categoryPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(), barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(), barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(), barPlot.getValueAxisVerticalTickLabels(), barPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), (Comparable<?>)evaluateExpression(barPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(barPlot.getRangeAxisMaxValueExpression()) ); BarRenderer categoryRenderer = (BarRenderer)categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); categoryRenderer.setBaseItemLabelsVisible(isShowLabels); categoryRenderer.setShadowVisible(false); return jfreeChart; }
Example 19
Source File: GenericChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ protected JFreeChart createGanttChart() throws JRException { //FIXMECHART legend/tooltip/url should come from plot? ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createGanttChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBarPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRBarPlot)getPlot()).getValueAxisLabelExpression()), (GanttCategoryDataset)getDataset(), isShowLegend(), true, //FIXMECHART tooltip: I guess BarPlot is not the best for gantt false ); configureChart(jfreeChart, getPlot()); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); //plot.setNoDataMessage("No data to display"); JRBarPlot barPlot = (JRBarPlot)getPlot(); boolean isShowTickMarks = barPlot.getShowTickMarks() == null ? true : barPlot.getShowTickMarks(); boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels(); boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels(); categoryPlot.getDomainAxis().setTickMarksVisible(isShowTickMarks); categoryPlot.getDomainAxis().setTickLabelsVisible(isShowTickLabels); // Handle the axis formating for the category axis configureAxis( categoryPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(), barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(), barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(), barPlot.getCategoryAxisVerticalTickLabels(), barPlot.getOwnCategoryAxisLineColor(), false, null, null ); ((DateAxis)categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks); ((DateAxis)categoryPlot.getRangeAxis()).setTickLabelsVisible(isShowTickLabels); // Handle the axis formating for the value axis configureAxis( categoryPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(), barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(), barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(), barPlot.getValueAxisVerticalTickLabels(), barPlot.getOwnValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(barPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(barPlot.getRangeAxisMaxValueExpression())); BarRenderer categoryRenderer = (BarRenderer)categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); categoryRenderer.setBaseItemLabelsVisible(isShowLabels); categoryRenderer.setShadowVisible(false); return jfreeChart; }
Example 20
Source File: StandardChartTheme.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } }