A chart in an Dashboard section can be passive (View-only), can activate the chart section when clicked (Hyperlink), or can access drill down options when right-clicked (Active). The pie chart in the Limits Dashboard section is set to Active in the Properties dialog box, which allows direct access to underlying Product Line data.
When the user drills down into underlying data, the chart section’s X-Categories are changed to reflect this action. With JavaScript, the chart can be returned to the top level (Product Line).
The following script executes when the Limits Dashboard section is activated.
This following exercise sets the XCategory of the Limits Chart section to display the top level fact: Product Line. The script is added to the Limits Dashboard section of Sample1mod.bqy. |
To script an Dashboard section to set a chart to a specific fact:
Activate the Limits Dashboard section by clicking the title in the Section frame.
Toggle to Design mode and choose Dashboard , then Scripts to open the Script Editor on the active section.
Declare a variable topDrill and assign the string Product Line.
var topDrill="Product Line";
The variable topDrill now holds the chart fact Product Line.
RemoveAll XCategories from the Limits Chart section.
ActiveDocument.Sections["Limits Chart"].XCategories.RemoveAll();
Add topDrill to the XCategories of the chart section.
ActiveDocument.Sections["Limits Chart"].XCategories.Add(topDrill);
Click OK to save the script and close the Script Editor.
In Run mode, when the user selects Limits Dashboard in the Section frame, or the Interactive Reporting document file automatically activates this section, the chart shows Product Line data.
The same JavaScript can be added to a command button, so the user can choose to return the chart to Product Line at any time.