Bar Chart

A bar graph is a chart that uses bars to show comparisons between categories of data. The bars can be either horizontal or vertical. There are two types of the bar chart.

  • Basic Bar Chart

  • Stacked Bar Chart

In QMetry, the Advance SQL Query provides an ability to generate both the charts as with the required values; let’s understand how both types of bar charts can be generated by writing a SQL queries in detail.

 

Basic Bar Chart

Let’s take an example of a normal Bar Chart report.

Report : Generate a bar chart that displays the Count of the requirements by status

Count Of Requirements By Status

SELECT COUNT(requirements.entityKey) as "Requirement Count", requirements.requirementStatus as "Status" FROM requirements WHERE requirements.projectID in (`@filter.project`) GROUP BY requirements.requirementStatus

Apply the Filter

Query Output

By default, it gives you output in tabular format. You can modify the output format by switching to the available chart types from the table. In our case, we will switch it to the Bar Chart.

You can adjust the data columns based on your requirement to Label and Data section.

  • Label : Label always holds a single Test entity field with any value.

  • Data : Multiple Test entity field on Data creates a stacked chart; Data always contain fields with numeric values.

Once you get your desired report, you can save the report as a Gadget by clicking on the Add Gadget button.

Once you save the gadget, it will be available in the QMetry Custom Gadget section > My Gadget tab.

Stacked Bar Chart

Let’s take an example of a Stacked Bar Chart report.

Report : Generate a bar chart that displays the Count of the test cases by status over priority.

SQL Query

Count Of Test Cases By Status Over Priority

SELECT count(*) as "Testcase Count", COALESCE(testcases.priority, 'No Priority') as "Test Case Priority", COALESCE(testcases.testCaseStatus, 'No Status') as "Status" FROM testcases WHERE testcases.projectID in (`@filter.project`) GROUP BY testcases.priority, testcases.testCaseStatus

Apply the Filter

Query Output

By default, it gives you output in tabular format. You can modify the output format. You can switch to the available chart types from the table. In our case, we will switch it to the Bar Chart.

You can adjust the Columns based on the requirement to Label, Data and Cross Tab sections.

  • Label always holds a single Test entity field with any value.

  • Multiple Test entity field on Data creates a stacked chart; Data always contain fields with numeric values.

  • Cross Tab field will help to create a Group Stacked chart.

Once you get your desired report, you can save the report as a Gadget by clicking on the Add Gadget button.

Once you save the gadget, it will be available in the QMetry Custom Gadget section > My Gadget tab.