Gauge chart

With the next chart, the guage chart, we will expand on the interactivity a bit and demonstrate how drill-downs work. In addition to viewing the static chart, we want the user to be able to click on the chart and have it pull up an external report with the details for a particular user. This is called a drilldown.

The following meter chart will demonstrate an employees sales vs. a target amount per month, let's say 3000, on a 5000 dollar scale. This will be broken out and grouped monthly in the query statement. When the user clicks on the chart, it will bring them to the detail report we created last chapter for Employee sales.

  1. Create a new report titled Employee_Sales_Guage.rptDesign.
  2. From the library, drag over the dsClassicCars data source.
  3. Create a new dataset called employeeSales using the following query:
    select
    CLASSICMODELS.EMPLOYEES.EMPLOYEENUMBER,
    CLASSICMODELS.EMPLOYEES.LASTNAME || ', ' || CLASSICMODELS.EMPLOYEES.FIRSTNAME name,
    sum(CLASSICMODELS.ORDERDETAILS.PRICEEACH) sales,
    rtrim(char(year(CLASSICMODELS.ORDERS.ORDERDATE))) || '-' || rtrim(char(month(CLASSICMODELS.ORDERS.ORDERDATE))) orderDate
    from
    CLASSICMODELS.EMPLOYEES,
    CLASSICMODELS.CUSTOMERS,
    CLASSICMODELS.ORDERS,
    CLASSICMODELS.ORDERDETAILS
    where
    CLASSICMODELS.ORDERS.ORDERNUMBER = CLASSICMODELS.ORDERDETAILS.ORDERNUMBER
    and CLASSICMODELS.EMPLOYEES.EMPLOYEENUMBER = CLASSICMODELS.CUSTOMERS.SALESREPEMPLOYEENUMBER
    and CLASSICMODELS.ORDERS.CUSTOMERNUMBER = CLASSICMODELS.CUSTOMERS.CUSTOMERNUMBER
    and CLASSICMODELS.ORDERS.ORDERDATE between ? and ?
    group by
    year(CLASSICMODELS.ORDERS.ORDERDATE),
    month(CLASSICMODELS.ORDERS.ORDERDATE),
    CLASSICMODELS.EMPLOYEES.EMPLOYEENUMBER,
    CLASSICMODELS.EMPLOYEES.LASTNAME,
    CLASSICMODELS.EMPLOYEES.FIRSTNAME
    
  4. Link the two dataset parameters to the report parameters, startDate and endDate respectively.
    Gauge chart
  5. Drag the employeeSales dataset to the report designer.
    Gauge chart
  6. Delete the last two columns from the table.
    Gauge chart
  7. Create a group called GroupByEmployee in the table and set it to group on the EMPLOYEENUMBER.
    Gauge chart
    Gauge chart
  8. Create another group below GroupByEmployee and call it groupByDate. Set it to group on the ORDERDATE field.
    Gauge chart
  9. Merge all of the cells in the orderDate details row into one large cell. Be sure to delete any data items that are still present such as the NAME and EMPLOYEENUMBER items.
    Gauge chart
  10. In the new large cell, create a chart element.
    Gauge chart
  11. Select Meter as the type, and select SuperImpose Meter as the chart type. If we need to know which type of chart we are picking, hover the mouse over the chart for a second and its description will pop up. Set the Output Format to PNG.
    Gauge chart
  12. In the Select Data tab, create another dial by selecting the Meter Value Definition drop-down list and selecting<New Series..>.
    Gauge chart
  13. For the expression for Dial 1, select row["SALES"] by either dragging the column over from the Data Preview pane or by using the Expression Editor.
    Gauge chart
  14. The value for Dial 2 should be set to 3000.
    Gauge chart
  15. As Category Definition, use row["NAME"] by either dragging the column over from the Data Preview section or using the Expression Editor.
    Gauge chart
  16. In the Format Chart tab, under the Value Series section, click the Scale button.
    Gauge chart
  17. Enter 0 for the Min value and 5000 for the Max value. We have now set up the scale.
    Gauge chart
  18. On the Edit Chart tab, under the Legend section, uncheck the Visible checkbox.
    Gauge chart
  19. Select Chart Area.
    Gauge chart
  20. Click the Interactivity button.
    Gauge chart
  21. Select Mouse Click from the Event listbox and select Hyperlink from the Action listbox.
    Gauge chart
  22. Click the Add Button.
  23. In the Name field, insert NewHyperlink.
    Gauge chart
  24. Click the Edit Base URL... button.
  25. Select Drill-through as the hyperlink type.
    Gauge chart
  26. For the Report Design, navigate and select the report Employee Sales Details Report.rptDesign. This report was created in the preceding chapter.
  27. Select the startDate and endDate parameters under the Parameters drop down, which selects the parameters in the target report. Under Values, enter params["startDate"].value and params["endDate"].value, or whatever names that have been used used for the current report's startDate and endDate parameters.
    Gauge chart
  28. Under Step 2, select Target Bookmark. From the drop-down list, select row["EmployeeNumber"].
  29. Under Step 4, select New Window.
  30. We can skip Step 5 as we are sticking to our default output format, which is HTML. We could have the target report open in any format that we have an emitter registered for. Emitters are plugins for BIRT that produce output in different formats such as HTML, PDF, Microsoft Excel, or Microsoft Word.
    Gauge chart
  31. Click OK to exit the dialog and save the report.
  32. Delete the table header.
    Gauge chart
  33. Delete the EMPLOYEENUMBER data element.
    Gauge chart
  34. Drag the EMPLOYEENUMBER column from the Data Explorer, next to the OrderDate report item.
    Gauge chart
  35. Now run the report. When we click on any of the charts, a detailed report will open and the control will automatically jump to the employees section, as specified in the Bookmark in the target report.
Gauge chart

Of course, this example can be heavily modified to simplify things. The charts could be consolidated into single chart, with more needles for each month instead of separate charts for each month, by moving the chart into the EmployeeNumber group's header or footer row and adding a group by date in the chart editors dialog under the Select Data tab. It is also possible to make the needles interactive and to filter down to a specific user and date range by modifying the bookmarks in the target report, but I will leave that up to the reader to discover. The following is a modified version of the the report that has created different series in the chart itself for the date groupings.

Gauge chart
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset