Cumulative Flow Diagram

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
Posts: 1
Joined: 12 Jun 2013, 12:37

Cumulative Flow Diagram

Post by spidgorny »


I've implemented a cumulative flow diagram for myself, but I don't know (and don't want to know) how to create an official plugin. Here's the core of the source code attached. Charting is done with Depends on Hope it's useful for somebody.

Code: Select all

	function show_cfd($t_project_id, $t_version) {
		$t_bug_table	= db_get_table( 'mantis_bug_table' );
		$t_history_table = db_get_table( 'mantis_bug_history_table' );
		$query = "SELECT sbt.*, $t_history_table.date_modified AS fixed
			FROM $t_bug_table AS sbt
			LEFT OUTER JOIN $t_history_table ON (
				 AND field_name = 'status'
				 AND new_value = 80
				) OR IS NULL
			WHERE sbt.project_id=" . db_param() . " AND sbt.target_version=" . db_param() . "
			ORDER BY sbt.status ASC, sbt.last_updated DESC";

		$t_result = db_query_bound( $query, Array( $t_project_id, $t_version ) );
		$db = new MySQL();
		$bugs = $db->fetchAll($t_result->_queryID);

		$timeline = array();
		foreach ($bugs as $bug) {
			$time = round($bug['date_submitted']/100)*100;
			if ($bug['fixed']) {
				$time = round($bug['fixed']/100)*100;
		//$f = new Flot($bugs, 'project_id', 'fixed', '');
		//$f->data = $timeline;
		//echo $f->render();
		$fa = new FlotArea($timeline, array('add', 'fix'));
		echo $fa->render();
Cumulative Flow Diagram
Cumulative Flow Diagram
Roadmap - MantisBT_2013-06-12_14-40-27.png (27.74 KiB) Viewed 28614 times
Post Reply