Remove shadows in bar chart of pentaho report designer 3.9.1


Problem Statement :

Needless to re-iterate the fact that Charts stay to be the most integral mode of providing analytic view of the Business data. It the most effective way of representation making business decisions easier as they are easier to understand and interpret the data. Pentaho Report Designer has strong capability for charting. The recent version of Report designer,3.9.1, seems to have a change where it creates shadow for each rectangular bar in bar chart. This looks like minor difference in rendering of charts, but kills the professional look. The change in rendering could be addressed to maintain the earlier look.

Scope Of this Article :

This article covers steps to remove shadows from bar chart by adding bean shell at scripting .

Technology :

Pentaho Report Designer 3.9.1

Detail :

The below screenshot shows how the shadow appears in the bar chart, by default. We would learn how to make changes to address this.

inpuc

To address the non-demanded appearance of these shadows, we need to add bean shell under scripting tab in the report Designer while designing the report.

Right click on bar chart and select chart

inpuc

Find scripting tab from the dialogue box.

inpuc

Code Changes:

Under chart Post-Processing Script please add following script

import java.util.Date;
import java.awt.Paint;
import java.awt.Color;
import java.awt.Stroke;
import java.awt.BasicStroke;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
import org.jfree.chart.renderer.category.BarRenderer;

/// get an axis reference…
CategoryPlot myPlot = chart.getCategoryPlot();

//Hide bar shadow
BarRenderer categoryItemRenderer = myPlot.getRenderer();
categoryItemRenderer.setShadowVisible(false);

Select OK.

Output:

Below snapshot is the bar-chart output after implementing bean shell script and the chart is rendered using the script.

inpuc

Summary:

So this simple script helps us to override the default behavior and the shadows disappear. I find the appearance without the shadows much more professional.

Walking Tree promotes Pentaho and we support the corporates as well as the developers to ensure that the business is able to take complete advantage of Pentaho’s wonderful capability. In case you are looking for a professional assistance then do visit our website to get in touch with us.

Reference:

BI developer

Tagged with: , ,
Posted in Data Warehouse & BI, Pentaho
5 comments on “Remove shadows in bar chart of pentaho report designer 3.9.1
  1. suryathanuri says:

    Hi Natalie,

    Please find below properties under general tab and modify accordingly ,

    shadow-Paint= select gray color
    shadow-X-Offset = 0
    shadow-Y-Offset =0

    Above changes will help you to hide shadows in pie chart . Please let us know how this works for you.

    Thanks,
    http://walkingtree.in/

  2. Natalie says:

    Hello all,

    Could you please help me to hide shadow for Pie Carts?

  3. mini says:

    This script helped a lot .thanks

  4. codek says:

    Actually, I found it:

    import org.jfree.chart.plot.XYPlot;
    import org.jfree.chart.axis.CategoryAxis;
    import org.jfree.chart.axis.ValueAxis;
    import org.jfree.chart.renderer.category.CategoryItemRenderer;
    import org.jfree.chart.renderer.xy.XYBarRenderer;

    /// get an axis reference…
    XYPlot myPlot = chart.getXYPlot();

    //Hide bar shadow
    XYBarRenderer categoryItemRenderer = myPlot.getRenderer();
    categoryItemRenderer.setShadowVisible(false);

  5. codek says:

    Any idea what this should look like if this is an XY Chart? i.e. with a TimeSeries collector?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

We Have Moved Our Blog!

We have moved our blog to our company site. Check out https://walkingtree.tech/index.php/blog for all latest blogs.

Sencha Select Partner Sencha Training Partner
Xamarin Authorized Partner
Recent Publication
%d bloggers like this: