Configure a Horizontal Bar Chart SQL Template
A horizontal bar chart, as evident by its name, renders data as individual horizontal bars. See also:
Example of a Horizontal Bar Chart SQL Template: Host CPU Performance
1. From the SQL Template Designer tabbed window, select Date Range and Host Groups and Client Scope.
2. Select Static Custom Combo Box and click Configure at the bottom of the Query window.
3. Enter the heading for the drop-down list in the Static Custom Combo box—for this example, Group by:
4. Enter the following comma-separated list of values and then click OK: Hour,Day,Week,Month,Quarter,Year
These will be the options that a user can select when generating a report.
5. Click on the Query tab and enter the following query:
SELECT
trunc(log_date,DECODE('${freeCombo1}','Hour','HH24','Day','DD','Week','WW','Month','MM','Quarter','Q','Year')) the_date,
avg(system_processing_time_pct) avg_system,
avg(user_processing_time_pct) avg_user,
max(system_processing_time_pct) max_system
FROM apt_v_host_cpu_log
WHERE log_date between ${startDate} AND ${endDate}
GROUP BY trunc(log_date,DECODE('${freeCombo1}','Hour','HH24','Day','DD','Week','WW','Month','MM','Quarter','Q','Year'))
6. Click Validate Query and then Next.
7. In the Formatting window, select Horizontal Bar and set the Caption field to the_date with the Axis label set to CPU Utilization%
8. Check all four fields: the_date, avg_system, avg_user, and max_system.
9. One by one, select the bar fields, avg_system and avg_user, and click the Formatting button (at the bottom of the window) to configure the color of the bar. And, enter a relevant label for each field.
10. Select the max_system field and click the Formatting button (at the bottom of the window) to configure the color of the line.
11. Save the report to a report menu group. Then, click the saved report to generate it.
The output for the horizontal bar chart will look something like this: