09-Customizing Gauges with Images

Paginated Reports eBook Introduction, Resource and Sample Data Downloads

The gauge report items offer a high level of customization, allowing the report designer to create gauge visualizations that satisfy the needs of most business requirements. There are so many properties waiting to be customized that most of us will never need to tweak them all.

We can customize gauges all the way down to the pointers and dials. An interesting option is to set the BackFrame to a custom image, whether embedded or external. This also provides an opportunity to maintain a consistent layout across your reports, especially when displaying them in dashboards.

This recipe shows how you can customize your gauge components to resemble those of a hotrod dashboard!

Recipe Ingredients

Product Versions (one of the following):

  • SQL Server Reporting Services 2016 or newer
  • Report Builder 2016 or newer

What You’ll Need

  • A good-quality PNG or GIF image at 96 DPI of a custom frame for your gauge
  • A gauge item to apply the image back frame

Difficulty Level: 200

Contributed by Robert Bruckner

Report Summary

For the purposes of this exercise, you will not delve into the details of binding the gauge to report data; thus, you only walk through the steps to set up the gauge with a customized background. Figure 1 shows the finished gauge customizations.

Figure 1. Gauge with custom background and settings

Designing the report

To design the report, use the following steps:

Begin by embedding the background image you would like to use as the gauge background into the report definition. In the Report Data window (see Figure 2), right-click on the Images node, and select Add Image… from the context menu. Find the file location of your custom gauge frame image and click OK.

Figure 2. Adding an image to the report definition

From the Insert ribbon group, select a new gauge report item and drop insert it into the report body. Select the Radial Gauge type, as shown on Figure 3, and click OK.

Figure 3. Adding a radial gauge

Click inside the body of the gauge report item so the actual radial gauge item is selected and not the panel or another child item of the gauge.

In the Properties window for the selected gauge, expand the BackFrame section and then expand the FrameImage section. Set the Source property to Embedded and the Value property to the name of the custom image you embedded into the report on the first step, as shown in Figure 4.

Note: If you cannot see the Properties window in Report Builder, here’s how to get it back on your designer view. Select the “View” menu option from the Ribbon menu bar. Make sure the “Properties” box is checked.

Figure 4. Setting backframe image for gauge

Adding further design touches

Your frame should now display with the new frame image. Now let’s customize your gauge even further to add the final touches and deliver a slick, hotrod-style gauge! Follow the next few steps (also notice that as you change property values you can see in real-time the changes take effect on the design surface):

Select the gauge center label (currently displaying 35), right-click, and select “Delete label”.

Select the gauge scale, right-click, and choose “Scale Properties.” In the Properties dialog, choose the Layout section and set the following properties:

    • Scale radius: 30
    • Start angle: 50
    • Sweep angle: 260
    • Scale Bar width: 0

Still in the Scale Properties dialog, select the Labels section, check “Show labels at the end of scale”, uncheck the box “Rotate labels with scale.” Change the Placement to “Outside”.

In the Label Font section choose “Trebuchet MS”, bold and 14pt size, with a Black foreground color. This will make the numbers stand out making it easier in the eyes.

In the Major Tick Marks section, uncheck “Hide major tick marks”, set Major tick mark shape to “Rectangle”, set Major tick mark placement to “Cross”, set Width to “1”, set Interval to “10”.

In the Minor Tick Marks section, uncheck Hide minor tick marks, and set Minor tick mark shape to “Triangle”

Click OK to save changes to the gauge scale.

Select the gauge scale bar, right-click, and choose “Pointer Properties.” Change the Pointer type to “Needle”. Change the Needle Style option to “Tapered with tail”, set the Width (percent) to “10”.

Still in the Pointer Properties dialog, choose the Pointer Fill section

    • Fill style: Gradient
    • Color: Red
    • Secondary Color: Orange
    • Gradient Style: Vertical Center

Choose the Cap Options section and change the following properties:

    • Enable Show reflection
    • Cap Style: Rounded with wide indentation
    • Cap width: 25

Finally, change the Cap Fill color to Silver. This ought to give the radial gauge a bold look with numbers that stand out and beautiful red needle pointer akin to those found in automobile dashboards.

Figure 5 shows a before-and-after shot of the gauge item, in which a custom frame was applied as well as your customizations to the pointer size and color, scale radius, number placement, and so on. As you can see, you can create very realistic and appealing gauges that are sure to catch the reader’s eyes.

Figure 5. Before and after comparison of the gauge visualization

Final Thoughts

With a myriad of gauge layout and customization properties and options, the Reporting Services charting and gauging components are the most customizable of any report item. In this recipe, you’ve seen how to access some of these properties to add custom images to gauges and design some eye-catching data visualizations.