Blog

How to add drop shadows to bars

Maybe you have a chart template such as a BarChart or ComboChart that uses the old 3D feature on the bars. Or maybe your chart is a couple years old and doesn’t pop or look as stylish as you’d wish it would. If so the chart may look similar to this BarChart. No worries! In […]

Author:
Date:
August 31, 2015
Category:
Chart Polish, Design Approaches, Developer Products, NetCharts Pro

Maybe you have a chart template such as a BarChart or ComboChart that uses the old 3D feature on the bars. Or maybe your chart is a couple years old and doesn’t pop or look as stylish as you’d wish it would. If so the chart may look similar to this BarChart.

Older looking bar chart before enhancement

No worries! In version 7.0, we have introduced a new shadows feature that will allow you to simulate a much more realistic depth effect to your charts. Adding this new parameter is quite simple and best of all, you don’t need to learn or be fluent in our Chart Definition Language (CDL).

In this blog we will guide you through the simple steps of updating the bars in an old chart to look much better with just a couple changes to your chart template:

  1. The first step is to modify the Bar3DDepth parameter. Locate the Bar3DDepth parameter and set its value to zero. This will remove the old 3D depth effect:

    Bar3DDepth = 0;

    Older looking bar chart before enhancement

  2. Next, let’s remove the bar border line to soften the depth illusion. This is done by adding the BarBorder parameter:

    BarBorder = (NONE, 1, );

    Note: You can of course keep the border line if you like or set it to be a different color using this parameter.

    Older looking bar chart before enhancement

  3. Finally, let’s add the BarDropShadow parameter which adds a shadow behind the bars for more depth.

    BarDropShadow = (x000000_110, 0.01, 0.0090, 0.02);

    If you prefer adding a shadow that is a little darker with a stronger contrast than shown in the image below you can use this parameter:

    BarDropShadow = (x000000_250, 0.01, 0.0090, 0.02);

    Note: The values of this parameter can also be modified further to change the shadow placement to match your preference.

    Updated bar chart after BarDropShadow enhancement

That’s it, you are done. Your chart has now been updated with a new stylish look!

To enhance the styling even further, we recommend also using the BarHighlights parameter to add a simulated light source. Combined with the BarDropShadow described in this blog, adding a BarHighlights parameter will enhance the depth even further. Stay tuned for the next blog in this series that will feature the BarHighlights parameter and show How to add highlights to bars.

See more information on the BarDropShadow parameter in our CDL Reference Guide here:
NetCharts Pro – Visual Mining CDL Reference for v7.2 Products (PDF)
NetCharts Pro – Visual Mining Online CDL Reference Guide for v7.2 Products (HTML)

Our data visualization tool and design studio NetCharts Designer can be used to generate the drop shadows CDL parameter for you and make the styling tweaks even easier. Included in NetCharts Designer are a couple of default BarDropShadow parameter options allowing for quick styling updates.

NetCharts Pro API users can use the netcharts.pro.common.NFDropShadow class and .setBarDropShadow(netcharts.pro.common.NFDropShadow) API to dynamically define the drop shadow. For example:

NFDropShadow dropShadow = new NFDropShadow();
dropShadow.setColor(new Color(0, 0, 0, 110));
dropShadow.setOffsetX(0.01);
dropShadow.setOffsetY(0.009);
dropShadow.setSize(0.02);
chart.setBarDropShadow(dropShadow);

Also see related blog posts:
Good and Not So Good Ideas of chart design – 3D Depth
Good and Not So Good Ideas of chart design – Rows
How to update pre 7.0 chart templates into the new 7.0 look

If you have any questions, feel free to contact us at support@visualmining.com.

Comments are closed.