Switching between different charts

This recipe will show you how to create a dashboard with the option of switching between two charts.

Getting ready

Open a new SAP BusinessObjects Dashboards file and drag two different chart components (for example, a Line Chart and a Pie Chart component) into the empty canvas. Drag the Label Based Menu component found in Selectors into the canvas as well.

How to do it...

  1. Click on the Line Chart component and go to the Behavior tab of its properties pane. At the bottom of the pane, you will see a section called Dynamic Visibility.
  2. Bind the Status field to spreadsheet cell B1.
  3. Put value 1 in the Key field:
    How to do it...
  4. Click on the Pie Chart component and go to the Behavior tab.
  5. Here also, bind the Status field to cell B1.
  6. In the Key field, fill in the value 2:
    How to do it...
  7. Go to the spreadsheet and type Status: in cell A1 and put value 1 in cell B1:
    How to do it...
  8. Now click on the Label Based Menu component and go to the General tab of its properties pane.
  9. To set the Labels, click on the button on the extreme right-hand side, as shown in the following screenshot:
    How to do it...
  10. Enter two labels: Trend and Division. Make sure that Trend has the first position and Division has the second position. You can change the positions by using the little arrows on the bottom left-hand side of the window. In addition, by default there are five entries. To remove the other three entries, just click on the X icons to the right.
    How to do it...
  11. In the Data Insertion area, set Insertion Type to Position.
  12. Bind the Destination field to spreadsheet cell B1:
    How to do it...
  13. Click on the Preview button to run the dashboard. You will only see the label-based component. Click on Trend or Division and the appropriate chart will appear. Now leave preview mode.
  14. To display an initial chart (shown before the first selection), deselect the Clear Destination When No Selected Item option in the General tab of the properties of the Label Based Menu component.
  15. Place both charts on top of each other. Use the options in the Format menu for precise alignment and sizing:
    How to do it...
  16. Try your dashboard!
    How to do it...

How it works...

In this recipe, we used one of the selector components in combination with the Dynamic Visibility functionality to switch between the two charts. Each chart has a unique key assigned: value 1 for the line chart and value 2 for the pie chart. By making a selection in the Label Based Menu selector, either the value 1 or value 2 was inserted into spreadsheet cell B1. The Dynamic Visibility setup in this recipe implies that if cell B1 has value 1, Line Chart will be shown. If cell B1 has value 2, the Pie Chart will be shown.

Thus, a component is hidden when any other value than its key is entered in the status cell.

There's more...

This recipe used two chart components with Dynamic Visibility settings. But, the Dynamic Visibility functionality is embedded in all other components too, except for the Source Data component and the History component. You can even use Dynamic Visibility with grouped components to dynamically show or hide a group of components!

When you set up Dynamic Visibility you are not restricted to using only numerical values; you can use any value you want as a Dynamic Visibility key for a component. If you do this, make sure you also change the Insertion Type of your selector component into Label. The labels should always match the key exactly.

Note

Label keys are case sensitive!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset