当前位置: 首页>>代码示例>>PHP>>正文


PHP FusionCharts::addGanttCategory方法代码示例

本文整理汇总了PHP中FusionCharts::addGanttCategory方法的典型用法代码示例。如果您正苦于以下问题:PHP FusionCharts::addGanttCategory方法的具体用法?PHP FusionCharts::addGanttCategory怎么用?PHP FusionCharts::addGanttCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FusionCharts的用法示例。


在下文中一共展示了FusionCharts::addGanttCategory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getChart


//.........这里部分代码省略.........
		$milestone = $params->get('fusion_gantt_chart_milestone');
		$milestoneraw = $milestone."_raw";
		$connector = $params->get('fusion_gantt_chart_connector');
		$connectorraw = $connector."_raw";
		$fields = array();

		$fields[] = FabrikString::safeColName($process)." AS " . $db->nameQuote($process);
		$fields[] = FabrikString::safeColName($start)." AS " . $db->nameQuote($start);
		$fields[] = FabrikString::safeColName($end)." AS " . $db->nameQuote($end);
		$fields[] = FabrikString::safeColName($label)." AS " . $db->nameQuote($label);
		if ($hover !== '') {
			$fields[] = FabrikString::safeColName($hover)." AS " . $db->nameQuote($hover);
		}
		if ($milestone !== '') {
			$fields[] = FabrikString::safeColName($milestone)." AS " . $db->nameQuote($milestone);
		}
		if ($connector !== '') {
			$fields[] = FabrikString::safeColName($connector)." AS " . $db->nameQuote($connector);
		}

		$listModel->asfields = $fields;
		$nav = $listModel->getPagination(0, 0, 0);
		$data = $listModel->getData();
		$data = $data[0];

		$mindate = null;
		$maxdate = null;
		$usedProcesses = array();
		$milestones = array();
		$connectors = array();
		$processLabel = $params->get('fusion_gantt_chart_process_label');
		$FC->setGanttProcessesParams("positionInGrid=right;align=center;headerText=$processLabel;fontColor=333333;fontSize=11;isBold=1;isAnimated=1;bgColor=99cc00;headerbgColor=333333;headerFontColor=99cc00;headerFontSize=16;bgAlpha=40");

		foreach ($data as $d) {
			$hovertext = $hover == '' ? '' : $d->$hover;
			$processid = $d->$processraw;
			$startdate = JFactory::getDate($d->$startraw);
			$enddate = JFactory::getDate($d->$endraw);
			$strParam = "start=".$startdate->toFormat('%Y/%m/%d').";end=".$enddate->toFormat('%Y/%m/%d').";processId={$processid};id={$d->__pk_val};color=99cc00;alpha=60;topPadding=19;hoverText={$hovertext};";
			$strParam .="link={$d->fabrik_view_url};";
			$FC->addGanttTask($FC->encodeSpecialChars($d->$label), $strParam);

			if ($milestone !== '' && $d->$milestoneraw == 1) {
				$FC->addGanttMilestone($d->__pk_val, "date=".$enddate->toFormat('%Y/%m/%d').";radius=10;color=333333;shape=Star;numSides=5;borderThickness=1");
			}

			if ($connector !== '' && $d->$connectorraw !== '') {
				$FC->addGanttConnector($d->$connectorraw, $d->__pk_val, "color=99cc00;thickness=2;");
			}
			#apply processes
			if (!in_array($processid, $usedProcesses)) {
				$usedProcesses[] = $processid;
				$FC->addGanttProcess($FC->encodeSpecialChars($d->$process), "id={$processid};");
			}
			#increaes max/min date range
			if (is_null($mindate)) {
				$mindate = $startdate;
				$maxdate = $enddate;
			} else {
				if (JFactory::getDate($d->$startraw)->toUnix() < $mindate->toUnix()) {
					$mindate = JFactory::getDate($d->$startraw);
				}

				if (JFactory::getDate($d->$endraw)->toUnix() > $maxdate->toUnix()) {
					$maxdate = JFactory::getDate($d->$endraw);
				}
			}
		}

		$startyear = $mindate ? $mindate->toFormat('%Y') : date('Y');
		$endyear = $maxdate ? $maxdate->toFormat('%Y') : 0;

		$monthdisplay = $params->get('fusion_gannt_chart_monthdisplay');
		$FC->addGanttCategorySet("bgColor=333333;fontColor=99cc00;isBold=1;fontSize=14");
		for ($y = $startyear; $y <= $endyear; $y++) {
			$firstmonth = ($y == $startyear) ? (int)$mindate->toFormat('%m') : 1;
			$lastmonth = ($y == $endyear) ? $maxdate->toFormat('%m')+1 : 13;

			$start = date('Y/m/d', mktime(0, 0, 0, $firstmonth, 1, $y));
			$end = date('Y/m/d', mktime(0, 0, 0, $lastmonth, 0, $y));

			$strParam = "start=". $start.";end=".$end.";";
			$FC->addGanttCategory($y, $strParam);
		}
		$FC->addGanttCategorySet("bgColor=99cc00;fontColor=333333;isBold=1;fontSize=10;bgAlpha=40;align=center");
		for ($y = $startyear; $y <= $endyear; $y++) {
			$lastmonth = ($y == $endyear) ? $maxdate->toFormat('%m')+1 : 13;
			$firstmonth = ($y == $startyear) ? (int)$mindate->toFormat('%m') : 1;
			for ($m = $firstmonth; $m < $lastmonth; $m++) {
				$starttime = mktime(0, 0, 0, $m, 1, $y);
				$start = date('Y/m/d', $starttime);
				$end = date('Y/m/d', mktime(0, 0, 0, $m+1, 0, $y));//use day = 0 to load last day of next month
				$m2 = $monthdisplay == 'str' ? JText::_(date('M', $starttime)) : $m;
				$FC->addGanttCategory($m2, "start=".$start.";end=".$end.";");
			}
		}

		# Render Chart
		return $FC->renderChart(false, false);
	}
开发者ID:Jobar87,项目名称:fabrik,代码行数:101,代码来源:fusion_gantt_chart.php

示例2: fs_gantt_chart

function fs_gantt_chart($title, $from, $to, $tasks, $milestones, $width, $height)
{
    // Generate the XML
    $chart = new FusionCharts("Gantt", $width, $height, "1", "0");
    $chart->setSWFPath("include/graphs/FusionCharts/");
    $chart->setChartParams('dateFormat=dd/mm/yyyy;hoverCapBorderColor=2222ff;hoverCapBgColor=e1f5ff;ganttLineAlpha=80;canvasBorderColor=024455;canvasBorderThickness=0;gridBorderColor=2179b1;gridBorderAlpha=20;ganttWidthPercent=80');
    $chart->setGanttProcessesParams('headerText=' . __('Task') . ';fontColor=ffffff;fontSize=9;isBold=1;isAnimated=1;bgColor=2179b1;headerbgColor=2179b1;headerFontColor=ffffff;headerFontSize=12;align=left');
    $chart->setGanttTasksParams('');
    $start_date = explode('/', $from);
    $start_day = $start_date[0];
    $start_month = $start_date[1];
    $start_year = $start_date[2];
    $end_date = explode('/', $to);
    $end_day = $end_date[0];
    $end_month = $end_date[1];
    $end_year = $end_date[2];
    $time_span = date_to_epoch($to) - date_to_epoch($from);
    // Years
    $chart->addGanttCategorySet('bgColor=2179b1;fontColor=ff0000');
    for ($i = $start_year; $i <= $end_year; $i++) {
        if ($i == $start_year) {
            $start = sprintf('%02d/%02d/%04d', $start_day, $start_month, $start_year);
        } else {
            $start = sprintf('%02d/%02d/%04d', 1, 1, $i);
        }
        if ($i == $end_year) {
            $end = sprintf('%02d/%02d/%04d', $end_day, $end_month, $end_year);
        } else {
            $end = sprintf('%02d/%02d/%04d', cal_days_in_month(CAL_GREGORIAN, 12, $i), 12, $i);
        }
        $chart->addGanttCategory($i, ';start=' . $start . ';end=' . $end . ';align=center;fontColor=ffffff;isBold=1;fontSize=16');
    }
    // Months
    $chart->addGanttCategorySet('bgColor=ffffff;fontColor=1288dd;fontSize=10');
    for ($i = $start_year; $i <= $end_year; $i++) {
        for ($j = 1; $j <= 12; $j++) {
            if ($i == $start_year && $j < $start_month) {
                continue;
            } else {
                if ($i == $end_year && $j > $end_month) {
                    break;
                }
            }
            if ($i == $start_year && $j == $start_month) {
                $start = sprintf('%02d/%02d/%04d', $start_day, $start_month, $start_year);
            } else {
                $start = sprintf('%02d/%02d/%04d', 1, $j, $i);
            }
            if ($i == $end_year && $j == $end_month) {
                $end = sprintf('%02d/%02d/%04d', $end_day, $end_month, $end_year);
            } else {
                $end = sprintf('%02d/%02d/%04d', cal_days_in_month(CAL_GREGORIAN, $j, $i), $j, $i);
            }
            $chart->addGanttCategory(date('F', mktime(0, 0, 0, $j, 1)), ';start=' . $start . ';end=' . $end . ';align=center;isBold=1');
        }
    }
    // Days
    if ($time_span < 2592000) {
        $chart->addGanttCategorySet();
        for ($i = $start_year; $i <= $end_year; $i++) {
            for ($j = 1; $j <= 12; $j++) {
                if ($i == $start_year && $j < $start_month) {
                    continue;
                } else {
                    if ($i == $end_year && $j > $end_month) {
                        break;
                    }
                }
                $num_days = cal_days_in_month(CAL_GREGORIAN, $j, $i);
                for ($k = 1; $k <= $num_days; $k++) {
                    if ($i == $start_year && $j == $start_month && $k < $start_day) {
                        continue;
                    } else {
                        if ($i == $end_year && $j == $end_month && $k > $end_day) {
                            break;
                        }
                    }
                    $start = sprintf('%02d/%02d/%04d', $k, $j, $i);
                    $end = sprintf('%02d/%02d/%04d', $k, $j, $i);
                    $chart->addGanttCategory($k, ';start=' . $start . ';end=' . $end . ';fontSize=8;isBold=0');
                }
            }
        }
    } else {
        if ($time_span < 10368000) {
            $chart->addGanttCategorySet();
            for ($i = $start_year; $i <= $end_year; $i++) {
                for ($j = 1; $j <= 12; $j++) {
                    if ($i == $start_year && $j < $start_month) {
                        continue;
                    } else {
                        if ($i == $end_year && $j > $end_month) {
                            break;
                        }
                    }
                    $num_days = cal_days_in_month(CAL_GREGORIAN, $j, $i);
                    for ($k = 1, $l = 1; $k <= $num_days; $k += 8, $l++) {
                        if ($i == $start_year && $j == $start_month && $k + 7 < $start_day) {
                            continue;
                        }
//.........这里部分代码省略.........
开发者ID:articaST,项目名称:integriaims,代码行数:101,代码来源:functions_fsgraph.php


注:本文中的FusionCharts::addGanttCategory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。