The gadget generation tool is a step by step wizard that allows you to generate gadgets for your dashboard in a few simple steps. These steps are:
- Enter JDBC data source details
- Enter SQL to fetch data
- Pick UI element for gadget
- Enter gadget details
- Add gadget to dashboard
To explain these steps, let's create a sample gadget out of some summarized data off the KPI Definition sample.
You need to have run the KPI Definition sample to get the sample data used in this page.
Enter JDBC data source details
Enter the necessary details, for your data source. If you are using any other data source other than h2 (mysql, oracle, mssql, etc.) the relevant driver needs to be placed in $BAM_HOME/repository/components/lib and the server should be restarted.
The details entered here are:
- JDBC URL: jdbc:h2:repository/database/samples/BAM_STATS_DB;AUTO_SERVER=TRUE
- Driver Class Name: org.h2.Driver
- User Name: wso2carbon
- Password: wso2carbon
To check whether the details are correct, you can click on "Validate Connection". If the connection is successful you will get a success message and a failure message if the connection cannot be made. Now, click "Next".
Enter SQL to fetch data
In this step, you need to enter the SQL that will fetch the required data for your gadget. You can click the "Preview SQL Results" button, to preview the results returned by the SQL Query.
Here the SQL statement used is : select * from brandSummary. The image below shows the results returned from this query. Now, click "Next".
Pick UI element for gadget
This step allows you to pick the UI element for visualizing your data. Bar graphs and Tables are supported for this release. All options you pick are instantly reflected in the preview area.
The bar graph gives you some configuration options to customize the view of the generated gadget. These are:
- Chart Title - Title of the char
- Y-Axis Label - Title of the Y Axis
- Y-Axis Column - Column for the Y Axis returned from the results
- X-Axis Label - Title of the X Axis
- X-Axis Column - Column for the X Axis returned from the results
The table give you a configuration option:
- Table Title : The title of the table
Let's create a bar graph with options shown in the bar graph image for this sample. Click "Next".
Enter gadget details
We are at the final stage of the gadget generation. We need to enter the following details:
- Gadget Title : Each gadget will have a title that describes what the gadget's functionality. Enter the generated gadget's title here.
- Gadget File Name : The file name of the gadget as it will be stored in the system. In this case it will be stored in the embedded registry.
- Refresh rate : The gadget can have a refresh rate, where it will automatically refresh and pull the latest contents out of the data source.
A refresh rate, specially a high one (A smaller number of seconds) can slow down performance, when a large number of gadgets are present in the dashboard.
Now, click "Generate!".
Add gadget to dashboard
Now, the gadget has been generated. Copy the location of the gadget displayed in the screen.
Next, click "View Portal" from the left hand side menu.
Click on add gadget on the left hand side of the portal page.
Expand the "Enter Gadget Location" section on the right hand side and paste the gadget location. Then, click on "Add Gadget".
Now, the gadget will be shown in the dashboard as shown in the screen below.