public function barState($stateData = null) {
		$result = '';
		if (!is_array($stateData)) {
			$stateData = [];
		}

		if (empty($stateData)) {
			$stateData = [
				[
					'stateName' => $this->showEmpty(null),
					'stateId' => null,
					'amount' => 0,
					'stateUrl' => null,
				]
			];
		}

		$totalAmount = Hash::apply($stateData, '{n}.amount', 'array_sum');
		$percSum = 0;
		$countState = count($stateData);
		foreach ($stateData as $i => $stateItem) {
			$class = 'progress-bar';
			if (isset($stateItem['class']) && !empty($stateItem['class'])) {
				$class .= ' ' . $stateItem['class'];
			}
			if ($totalAmount > 0) {
				$perc = round($stateItem['amount'] / $totalAmount * 100, 2);
			} else {
				$perc = 100;
			}
			$percRound = round($perc);
			if ($percSum + $percRound > 100) {
				$percRound = 100 - $percSum;
			} else {
				if ($i == $countState - 1) {
					$percRound = 100 - $percSum;
				}
			}
			$percSum += $percRound;
			$stateName = $stateItem['stateName'];
			$progressBar = $this->Html->div(
				$class,
				$stateName,
				['role' => 'progressbar', 'style' => 'width:' . $percRound . '%',
					'title' => $stateName . ': ' . $this->Number->format(
						$stateItem['amount'],
						['thousands' => ' ', 'before' => '', 'places' => 0]
					) . ' (' . $perc . '%)',
					'data-toggle' => 'tooltip']
			);

			if (isset($stateItem['stateUrl']) && !empty($stateItem['stateUrl'])) {
				$progressBar = $this->Html->link(
					$progressBar,
					$stateItem['stateUrl'],
					['target' => '_blank', 'escape' => false]
				);
			}
			$result .= $progressBar;
		}
		$result = $this->Html->div('progress', $result);

		return $result;
	}
public function barState($stateData = null) {
		$result = '';
		if (!is_array($stateData)) {
			$stateData = [];
		}

		if (empty($stateData)) {
			$stateData = [
				[
					'stateName' => $this->showEmpty(null),
					'stateId' => null,
					'amount' => 0,
					'stateUrl' => null,
				]
			];
		}

		$totalAmount = Hash::apply($stateData, '{n}.amount', 'array_sum');
		$percSum = 0;
		$countState = count($stateData);
		foreach ($stateData as $i => $stateItem) {
			$class = 'progress-bar';
			if (isset($stateItem['class']) && !empty($stateItem['class'])) {
				$class .= ' ' . $stateItem['class'];
			}
			if ($totalAmount > 0) {
				$perc = round($stateItem['amount'] / $totalAmount * 100, 2);
			} else {
				$perc = 100;
			}
			$percRound = round($perc);
			if ($percSum + $percRound > 100) {
				$percRound = 100 - $percSum;
			} else {
				if ($i == $countState - 1) {
					$percRound = 100 - $percSum;
				}
			}
			$percSum += $percRound;
			$stateName = $stateItem['stateName'];
			$progressBar = $this->Html->div(
				$class,
				$stateName,
				['role' => 'progressbar', 'style' => 'width:' . $percRound . '%',
					'title' => $stateName . ': ' . $this->Number->format(
						$stateItem['amount'],
						['thousands' => ' ', 'before' => '', 'places' => 0]
					) . ' (' . $perc . '%)',
					'data-toggle' => 'tooltip']
			);

			if (isset($stateItem['stateUrl']) && !empty($stateItem['stateUrl'])) {
				$progressBar = $this->Html->link(
					$progressBar,
					$stateItem['stateUrl'],
					['target' => '_blank', 'escape' => false]
				);
			}
			$result .= $progressBar;
		}
		$result = $this->Html->div('progress', $result);

		return $result;
	}
public function barState ( $ stateData = null ) { $ result = '' ; if ( ! is_array ( $ stateData ) ) { $ stateData = [ ] ; } if ( empty ( $ stateData ) ) { $ stateData = [ [ 'stateName' => $ this -> showEmpty ( null ) , 'stateId' => null , 'amount' => 0 , 'stateUrl' => null , ] ] ; } $ totalAmount = Hash :: apply ( $ stateData , '{n}.amount' , 'array_sum' ) ; $ percSum = 0 ; $ countState = count ( $ stateData ) ; foreach ( $ stateData as $ i => $ stateItem ) { $ class = 'progress-bar' ; if ( isset ( $ stateItem [ 'class' ] ) && ! empty ( $ stateItem [ 'class' ] ) ) { $ class .= ' ' . $ stateItem [ 'class' ] ; } if ( $ totalAmount > 0 ) { $ perc = round ( $ stateItem [ 'amount' ] / $ totalAmount * 100 , 2 ) ; } else { $ perc = 100 ; } $ percRound = round ( $ perc ) ; if ( $ percSum + $ percRound > 100 ) { $ percRound = 100 - $ percSum ; } else { if ( $ i == $ countState - 1 ) { $ percRound = 100 - $ percSum ; } } $ percSum += $ percRound ; $ stateName = $ stateItem [ 'stateName' ] ; $ progressBar = $ this -> Html -> div ( $ class , $ stateName , [ 'role' => 'progressbar' , 'style' => 'width:' . $ percRound . '%' , 'title' => $ stateName . ': ' . $ this -> Number -> format ( $ stateItem [ 'amount' ] , [ 'thousands' => ' ' , 'before' => '' , 'places' => 0 ] ) . ' (' . $ perc . '%)' , 'data-toggle' => 'tooltip' ] ) ; if ( isset ( $ stateItem [ 'stateUrl' ] ) && ! empty ( $ stateItem [ 'stateUrl' ] ) ) { $ progressBar = $ this -> Html -> link ( $ progressBar , $ stateItem [ 'stateUrl' ] , [ 'target' => '_blank' , 'escape' => false ] ) ; } $ result .= $ progressBar ; } $ result = $ this -> Html -> div ( 'progress' , $ result ) ; return $ result ; }
Return bar of state.

@param array $stateData Array of state in format:
- key `stateName`, value: name of state;
- key `stateId`, value: ID of state;
- key `amount`, value: amount elements in this state;
- key `stateUrl`, value: url for state, e.g.:
array('controller' => 'trips', 'action' => 'index', '?' => array('data[FilterData][0][Trip][state_id]' => '2')) [Not necessary];
- key `class`: ID of state, value: class of state for progress bar,
e.g.: 'progress-bar-danger progress-bar-striped' [Not necessary].
@return string Return bar of state.
Return bar of state .