Scripting

The graphomate charts extension fully supports the scripting language of Designer. Therefore it is possible to control graphomate charts interactively at runtime. For example, it is possible to set new data, change the title or scales. Furthermore, it is possible to use drilldown functions of the extension and create interactive dashboards.

Example: Dynamic filtering of a Data Source with a dropdown box

In order to use a dynamic filter on a dimension of a Data Source, we first need to fill a dropdown box with all valid values to enable the user to choose from the data later on.
We use getMemberList on the canvas-event On Startup to retrieve a list of all members of the dimension 0D_NWI_ACOD of the selected Data Source. Autocomplete shows all parameters of getMemberList.

We can then fill the dropdown box with the retrieved list using setItem.

var memberList = DS_1.getMemberList("0D_NWI_ACOD", MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 10); DROPDOWN_1.setItems(memberList);

The dropdown box will be filled with the members of Dimension 0D_NWI_ACOD on application start.

If a user selects an element from the list, we can adapt the filter of the Data Source by using the following script that is put on the events On Element Clicked:

var selectedMemberKey = DROPDOWN_1.getSelectedValue();
DS_1.setFilter("0D_NWI_ACOD", selectedMemberKey);

Example: Save User Highlights by bookmarks

At runtime, you can set so-called User Highlights to selected values (see Interactivity at runtime). To save this state of the dashboard, we need two buttons.

  1. Saving the bookmark and
  2. Loading the bookmark.


To save the id of the bookmark, for simplicity we use a text field (in the example TEXT_2), in which the id is written. This step can also hide visually using a variable for the id.

The following skript is assigned to the save button in order to save the actual state of the dashboard to variable named id. The variable is then being backed-up into a text box:

var id = Bookmark.saveBookmark("Bookmark");
TEXT_2.setText(id);
 

The next script is assigned to the load button in order to read the id from the text box and restore this bookmark state:

var id = TEXT_2.getText();
Bookmark.loadBookmark(id);

You find more explanations and examples for the scripting language in our Scripting Documentation.