Radio buttons are typically used to allow a user to select one option from a group of options; for example, to select one type of chart over another. The exercises in this section assume that you have previously inserted an Dashboard section in Sample3.bqy and renamed it Controls. These exercises show you how to embed a chart and add radio buttons for user-control of the chart type.
The script in this exercise changes the chart type to a line chart. Before changing the chart with the script, verify that RevbyTime is a vertical bar chart. To verify and change the chart type, activate the RevByTime section and choose Format, then Chart Type, then Vertical Bar, and then return to the Controls section.
To associate a script with a radio button:
Elements pane, drag a radio button control to the Content pane and use the Properties dialog box to specify its title as Line.
(See Changing a Control Object Title for detailed instructions.)
With the Line object’s selection handles visible, choose Dashboard, then Scripts or press [F8].
Use the Object browser to locate and expand the RevByTime section of ActiveDocument.
Expand the RevbyTime Properties folder, then double-click ChartType.
Interactive Reporting automatically enters the first part of the script in the Scripting frame. Property ChartType as BqChartType is displayed in the Description frame. BqChartType is a constant whose values is displayed in the Constants collection of the Object browser.
To select the applicable BqChartType, use the Object browser to scroll down to Constants and expand it, then expand the BqChartType collection.
In the Script Editor, type and equals sign (=) immediately after ChartType.
Interactive Reporting adds the rest of the script to the Scripting frame.
Toggle to Run mode and click the Line radio button.
The chart changes to a Line chart.
Create a second radio button with the title Vertical Bar by toggling to Design mode and working through the preceding exercise.
Add a script to this radio button to change the chart type to vertical bar (bqChartTypeVerticalBar).