Use custom hyperlink handler with a Dashboard in JasperReports Server
Used jasper server version : 6.3.0
Problem Statement: Add hyperlink control for particular dashlet which will open drill-down in same dashboard page instead of opening drill-down report in new page.
Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.
Expected Output :
Expected output should be in one dashboard as shown below when we click on one dashlet hyperlink should open drill down report in same panel.
Step 1 : Click on any part of pie chart(HTML5) ie.department .
Lets assume if we click on department_id = 18 shown below :
Step 2 : After click on department_id 18 we can see the difference it will reflect to drill down report which shows you the information related to department_id 18 and in input control automatically department_id as 18 will be selected shown below :
If you select/click on another department_id should reflect in drill down report , you can try it.
Solution :
As mentioned above in expected output we created one dashboard having two dashlets.In it instead of passing hyperlink url we set constant value in hyperlink type as shown below :
Or you can set it in source file(.jrxml) mentioned below :
Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.
-
- Create a custom hyperlink type in your main report. Here’s an example for an HTML5 chart. In this case we named it “UpdateDashboardParams”(in source code):
- Create a new Dashboard and put all your reports on canvas shown below:
-
- Go to “Show Parameter Mapping dialog” in the Dashboard and manually create a filter (will create a section named “Manually Created Filters”) with the same name as it is produced by your custom hyperlink. In this example it is “Gender”. Then wire it to corresponding parameters in your “child” reports:
*Show parameter mapping dialog*
-
- Save the Dashboard.
- Create a custom handler for your new hyperlink type, save it as dashboardHyperlinkHandler.js (in this case it is dashboardHyperlinkHandlerUpdateDashboardParams.js) should be same as constant value (Step 1) given for hyperlinkType otherwise it will not work.
- Put dashboardHyperlinkHandlerUpdateDashboardParams.js to both /scripts and /optimized-scripts folders of your server deployment (.js file attached below):
dashboardHyperlinkHandlerUpdateDashboardParams.js
- Restart jasper server and see hyperlink in dashboard.
- Open your dashboard in Dashboard Viewer and try hyperlinks.
Here I attached the same above mentioned example using HTML5 chart, you can refer :
Custom dashboard hyperlink using HTML5 chart Example
Custom_dashboard_hyperlink_HTML5_charts
Custom dashboard hyperlink using charts-pro Example
Here , we used charts-pro pie chart in dashboard for custom hyperlink , the functionality is same just little bit of chart data configuration is different in charts-pro.
Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.
Following are the steps to use custom hyperlink in charts-pro :
-
- In jasper studio create new report.
- From left side components-pro palette add charts-pro component and select pie chart.
- Set series , categories and value expression according to you requirement under chart data.
- Under Item Hyperlink set the constant value and its type which we previously used in HTML5 charts shown below :
-
- Set hyperlink parameters under “Hyperlink Parameters” Section.
- Now add your dashlets in dashboard :
-
- Follow above Step 3 to set filters for drill down report shown below :
-
- Save dashboard and follow above step 5 and step 6.
- Restart jasper server and see hyperlink in dashboard.
You can see the dashboard like this :
Please find the attachment of above example(custom hyperlink dashboard using charts-pro)
Custom_dashboard_hyperlink_charts_pro
Reference:
http://community.jaspersoft.com/wiki/how-use-custom-hyperlink-handler-dashboard-jasperreports-server
Best Open Source Business Intelligence Software Helical Insight is Here
A Business Intelligence Framework
Thanks,
Sayali | Helical IT Solutions