Subscribe Join 180,000+ subscribers and receive articles from our blog about software quality, testing, QA and security. Subscribe

Modify bar chart calculation

I have a script (below) that changes the pie chart in test runs and plans to percentage complete instead of using the default passed percentage. I would like to also change the bar chart (present in plans/view, runs/overview) to reflect percentage complete, but I’m not able to so far. The element appears to be “chart-bar-percent”. Has anyone been able to update the bar charts? If so, can you provide info on how you did this?

Thanks in advance for any help :slight_smile:

name: Test Status Percentage Complete
description: modifies the test status to display percentage complete instead of the percentage passed
author: Kevin
version: 1.0
includes: ^(runs|plans)/view

	function() {
		var data =;
		if (data == undefined)
			data = uiscripts.context.plan;
		total = data.passed_count + data.custom_status1_count + data.custom_status2_count + data.failed_count + data.blocked_count + data.retest_count + data.custom_status3_count + data.untested_count;

		complete = data.passed_count + data.custom_status1_count + data.custom_status2_count + data.failed_count + data.blocked_count + data.custom_status3_count;

		var p = 100 * complete / total;

		document.getElementsByClassName("chart-pie-percent-title")[0].innerHTML = p.toFixed() + "%";
		document.getElementsByClassName("chart-pie-percent-description")[0].innerHTML = "Complete";

Has anyone created UI scripts involving updating bar charts? There isn’t a lot of info on the scripts as it relates to these elements, so other than getting the element names, etc., and trying them I’m not sure what may work or if I’m missing something.