本文整理汇总了PHP中SugarChartFactory::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarChartFactory::getInstance方法的具体用法?PHP SugarChartFactory::getInstance怎么用?PHP SugarChartFactory::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarChartFactory
的用法示例。
在下文中一共展示了SugarChartFactory::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
$currency_symbol = $GLOBALS['sugar_config']['default_currency_symbol'];
if ($GLOBALS['current_user']->getPreference('currency')) {
require_once 'modules/Currencies/Currency.php';
$currency = new Currency();
$currency->retrieve($GLOBALS['current_user']->getPreference('currency'));
$currency_symbol = $currency->symbol;
}
$this->chartDefName = $this->which_chart[0];
//$chartDef = $this->chartDefs[$this->chartDefName];
$chartDef = array('type' => 'code', 'id' => 'Chart_invoices_by_month', 'label' => 'Invoices by Month', 'chartUnits' => 'Invoice Size in $1K', 'chartType' => 'stacked group by chart', 'groupBy' => array('m', 'state_in_chart'), 'base_url' => array('module' => 'reg_invoices', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search'), 'url_params' => array('state', 'date_closed'));
require_once 'include/SugarCharts/SugarChartFactory.php';
// Special chart config for RegInvoices
$sugarChart = SugarChartFactory::getInstance('Jit', 'RegInvoices');
$sugarChart->setProperties('', translate('LBL_FACT_SIZE', 'reg_invoices') . ' ' . $currency_symbol . '1' . translate('LBL_OPP_THOUSANDS', 'Charts'), $chartDef['chartType']);
$sugarChart->base_url = $chartDef['base_url'];
$sugarChart->is_currency = true;
$sugarChart->group_by = $chartDef['groupBy'];
$sugarChart->url_params = array();
$sugarChart->getData($this->constructQuery());
$this->sortData($sugarChart->data_set);
$xmlFile = $sugarChart->getXMLFileName($this->id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div><br />';
}
示例2: display
/**
* @see DashletGenericChart::display()
*/
public function display()
{
global $current_user, $sugar_config;
require "modules/Charts/chartdefs.php";
$chartDef = $chartDefs['lead_source_by_outcome'];
require_once 'include/SugarCharts/SugarChartFactory.php';
$sugarChart = SugarChartFactory::getInstance();
$sugarChart->is_currency = true;
$currency_symbol = $sugar_config['default_currency_symbol'];
if ($current_user->getPreference('currency')) {
$currency = new Currency();
$currency->retrieve($current_user->getPreference('currency'));
$currency_symbol = $currency->symbol;
}
$subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
$sugarChart->setProperties('', $subtitle, $chartDef['chartType']);
$sugarChart->base_url = $chartDef['base_url'];
$sugarChart->group_by = $chartDef['groupBy'];
$sugarChart->url_params = array();
if (count($this->lsbo_ids) > 0) {
$sugarChart->url_params['assigned_user_id'] = array_values($this->lsbo_ids);
}
$sugarChart->getData($this->constuctQuery());
$sugarChart->data_set = $sugarChart->sortData($sugarChart->data_set, 'lead_source', true, 'sales_stage', true, true);
$xmlFile = $sugarChart->getXMLFileName($this->id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div>' . $this->processAutoRefresh();
}
示例3: display
/**
* @see DashletGenericChart::display()
*/
public function display()
{
global $current_user, $sugar_config;
require_once 'include/SugarCharts/SugarChartFactory.php';
$sugarChart = SugarChartFactory::getInstance();
$sugarChart->base_url = array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search');
//fixing bug #27097: The opportunity list is not correct after drill-down
//should send to url additional params: start range value and end range value
$sugarChart->url_params = array('start_range_date_closed' => $this->pbss_date_start, 'end_range_date_closed' => $this->pbss_date_end);
$sugarChart->group_by = $this->constructGroupBy();
$sugarChart->setData($this->getChartData($this->constructQuery()));
$sugarChart->is_currency = true;
$sugarChart->thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
$currency_symbol = $sugar_config['default_currency_symbol'];
if ($current_user->getPreference('currency')) {
$currency = BeanFactory::getBean('Currencies', $current_user->getPreference('currency'));
$currency_symbol = $currency->symbol;
}
$subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
$pipeline_total_string = translate('LBL_TOTAL_PIPELINE', 'Charts') . $sugarChart->currency_symbol . format_number($sugarChart->getTotal(), 0, 0, array('convert' => true)) . $sugarChart->thousands_symbol;
if ($this->pbss_chart_type == 'hbar') {
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal group by chart');
} else {
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'funnel chart 3D');
}
$xmlFile = $sugarChart->getXMLFileName($this->id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
return $this->getTitle('') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div>' . $this->processAutoRefresh();
}
示例4: testConfigChartFactory
public function testConfigChartFactory()
{
global $sugar_config;
$sugar_config['chartEngine'] = 'Jit';
$sugarChart = SugarChartFactory::getInstance();
$name = get_class($sugarChart);
$this->assertEquals('Jit', $name, 'Assert chart engine set in global sugar_config is correct');
}
示例5: display
/**
* Don't override this method, since it does all the work of actually rendering the chart.
*
* @see DashletGenericChart::display()
*/
public function display()
{
$sugarChart = SugarChartFactory::getInstance();
$sugarChart->setProperties('', $this->subtitle, 'funnel chart 3D');
$sugarChart->base_url = array('module' => !empty($this->_seedName) ? $this->_seedName : 'Home', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search');
$sugarChart->group_by = $this->groupBy;
if (empty($this->urlParams)) {
$this->urlParams = $this->groupBy;
}
$sugarChart->url_params = $this->urlParams;
$sugarChart->setData($this->getDataset());
$xmlFile = $sugarChart->getXMLFileName($this->id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
return '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div>' . $this->processAutoRefresh();
}
示例6: display
public function display($title, $subTitle, $xmlFile, $chartType, $width = '100%', $height = '480')
{
global $current_user, $sugar_config;
require "modules/Charts/chartdefs.php";
require_once 'include/SugarCharts/SugarChartFactory.php';
$sugarChart = SugarChartFactory::getInstance();
$sugarChart->is_currency = true;
$currency_symbol = $sugar_config['default_currency_symbol'];
$sugarChart->setProperties($title, $subTitle, $chartType);
if ($current_user->getPreference('currency')) {
$currency = new Currency();
$currency->retrieve($current_user->getPreference('currency'));
$currency_symbol = $currency->symbol;
}
return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, $width, $height, false) . '</div>';
}
示例7: display
/**
* @see DashletGenericChart::display()
*/
public function display()
{
global $sugar_config, $current_user, $timedate;
require_once 'include/SugarCharts/SugarChartFactory.php';
$sugarChart = SugarChartFactory::getInstance();
$sugarChart->base_url = array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search');
$sugarChart->url_params = array('assigned_user_id' => $current_user->id);
$sugarChart->group_by = $this->constructGroupBy();
$currency_symbol = $sugar_config['default_currency_symbol'];
if ($current_user->getPreference('currency')) {
$currency = BeanFactory::getBean('Currencies', $current_user->getPreference('currency'));
$currency_symbol = $currency->symbol;
}
$sugarChart->is_currency = true;
$sugarChart->thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
$subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
$query = $this->constructQuery();
if ($this->mypbss_chart_type == 'hbar') {
$dataset = $this->constructCEChartData($this->getChartData($query));
$sugarChart->setData($dataset);
$total = format_number($this->getHorizBarTotal($dataset), 0, 0, array('convert' => true));
$pipeline_total_string = translate('LBL_TOTAL_PIPELINE', 'Charts') . $sugarChart->currency_symbol . $total . $sugarChart->thousands_symbol;
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal bar chart');
} else {
$sugarChart->setData($this->getChartData($query));
$total = format_number($sugarChart->getTotal(), 0, 0, array('convert' => true));
$pipeline_total_string = translate('LBL_TOTAL_PIPELINE', 'Charts') . $sugarChart->currency_symbol . $total . $sugarChart->thousands_symbol;
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'funnel chart 3D');
}
// Bug #53753 We have to add values for filter based on "Expected Close Date" field
if (!empty($this->mypbss_date_start) && !empty($this->mypbss_date_end)) {
$sugarChart->url_params['date_closed_advanced_range_choice'] = 'between';
$sugarChart->url_params['start_range_date_closed_advanced'] = $timedate->to_display_date($this->mypbss_date_start, false);
$sugarChart->url_params['end_range_date_closed_advanced'] = $timedate->to_display_date($this->mypbss_date_end, false);
} elseif (!empty($this->mypbss_date_start)) {
$sugarChart->url_params['date_closed_advanced_range_choice'] = 'greater_than';
$sugarChart->url_params['range_date_closed_advanced'] = $timedate->to_display_date($this->mypbss_date_start, false);
} elseif (!empty($this->mypbss_date_end)) {
$sugarChart->url_params['date_closed_advanced_range_choice'] = 'less_than';
$sugarChart->url_params['range_date_closed_advanced'] = $timedate->to_display_date($this->mypbss_date_end, false);
}
$xmlFile = $sugarChart->getXMLFileName($this->id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
return $this->getTitle('') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div><br />' . $this->processAutoRefresh();
}
示例8: display
/**
* @see DashletGenericChart::display()
*/
public function display()
{
require 'modules/Charts/chartdefs.php';
$chartDef = $chartDefs['opportunities_this_quarter'];
require_once 'include/SugarCharts/SugarChartFactory.php';
$sugarChart = SugarChartFactory::getInstance();
$sugarChart->setProperties('', translate('LBL_NUMBER_OF_OPPS', 'Charts'), $chartDef['chartType']);
$sugarChart->base_url = $chartDef['base_url'];
$sugarChart->group_by = $chartDef['groupBy'];
$sugarChart->url_params = array();
// get gauge target
$qry = "SELECT * from opportunities WHERE assigned_user_id = '" . $GLOBALS['current_user']->id . "' AND deleted=0";
$result = $this->getSeedBean()->db->query($this->getSeedBean()->create_list_count_query($qry));
$row = $this->getSeedBean()->db->fetchByAssoc($result);
$sugarChart->setDisplayProperty('gaugeTarget', $row['c']);
$sugarChart->getData($this->constructQuery());
$xmlFile = $sugarChart->getXMLFileName($this->id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div><br />' . $this->processAutoRefresh();
}
示例9: display
/**
* @see DashletGenericChart::display()
*/
public function display()
{
global $db, $app_list_strings;
require "modules/Charts/chartdefs.php";
$chartDef = $chartDefs['my_modules_used_last_30_days'];
require_once 'include/SugarCharts/SugarChartFactory.php';
$sugarChart = SugarChartFactory::getInstance();
$sugarChart->setProperties('', translate('LBL_MY_MODULES_USED_SIZE', 'Charts'), $chartDef['chartType']);
$sugarChart->base_url = $chartDef['base_url'];
$sugarChart->group_by = $chartDef['groupBy'];
$sugarChart->url_params = array();
$result = $db->query($this->constructQuery());
$dataset = array();
while ($row = $db->fetchByAssoc($result)) {
$dataset[translate($row['module_name'])] = $row['count'];
}
$sugarChart->setData($dataset);
$xmlFile = $sugarChart->getXMLFileName($this->id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div><br />' . $this->processAutoRefresh();
}
示例10: display
/**
* @see DashletGenericChart::display()
*/
public function display()
{
global $db;
require "modules/Charts/chartdefs.php";
$chartDef = $chartDefs['my_team_modules_used_last_30_days'];
require_once 'include/SugarCharts/SugarChartFactory.php';
$sugarChart = SugarChartFactory::getInstance();
$sugarChart->forceHideDataGroupLink = true;
$sugarChart->setProperties('', $chartDef['chartUnits'], $chartDef['chartType']);
$sugarChart->group_by = $chartDef['groupBy'];
$sugarChart->url_params = array();
$result = $db->query($this->constructQuery());
$dataset = array();
while ($row = $db->fetchByAssoc($result)) {
$dataset[] = array('user_name' => $row['user_name'], 'module_name' => $row['module_name'], 'total' => $row['count']);
}
$sugarChart->setData($dataset);
$xmlFile = $sugarChart->getXMLFileName($this->id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div>' . $this->processAutoRefresh();
}
示例11: display
/**
* @see DashletGenericChart::display()
*/
public function display()
{
$currency_symbol = $GLOBALS['sugar_config']['default_currency_symbol'];
if ($GLOBALS['current_user']->getPreference('currency')) {
$currency = BeanFactory::getBean('Currencies', $GLOBALS['current_user']->getPreference('currency'));
$currency_symbol = $currency->symbol;
}
require "modules/Charts/chartdefs.php";
$chartDef = $chartDefs['outcome_by_month'];
require_once 'include/SugarCharts/SugarChartFactory.php';
$sugarChart = SugarChartFactory::getInstance();
$sugarChart->setProperties('', translate('LBL_OPP_SIZE', 'Charts') . ' ' . $currency_symbol . '1' . translate('LBL_OPP_THOUSANDS', 'Charts'), $chartDef['chartType']);
$sugarChart->base_url = $chartDef['base_url'];
$sugarChart->group_by = $chartDef['groupBy'];
$sugarChart->url_params = array();
$sugarChart->getData($this->constructQuery());
$sugarChart->is_currency = true;
$sugarChart->data_set = $sugarChart->sortData($sugarChart->data_set, 'm', false, 'sales_stage', true, true);
$xmlFile = $sugarChart->getXMLFileName($this->id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div>' . $this->processAutoRefresh();
}
示例12: setUp
public function setUp()
{
$GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
$this->sugarChart = SugarChartFactory::getInstance('Jit', 'Reports');
}
示例13: build_report_chart
function build_report_chart()
{
require_once 'include/SugarCharts/SugarChartFactory.php';
$chart = SugarChartFactory::getInstance();
/* echo $resources = $chart->getChartResources();
echo $mySugarResources = $chart->getMySugarChartResources();*/
$chart->setProperties('test', 'sub_test', 'funnel chart 3D');
$chart->group_by = array('Type2', 'Assigned to1');
$result = $this->db->query($this->build_report_query());
$data = array();
while ($row = $this->db->fetchByAssoc($result, false)) {
$row['key'] = $row['Type2'];
$row['value'] = $row['Type2'];
$row['total'] = $row['count0'];
$data[] = $row;
}
$chart->setData($data);
$file = create_cache_directory('modules/AOR_Reports/Charts/') . 'chart.xml';
$chart->saveXMLFile($file, $chart->generateXML());
return $chart->display('test', $file, '100%', '480', false);
}
示例14: reportCriteriaWithResult
//.........这里部分代码省略.........
global $ACLAllowedModules;
$ACLAllowedModules = getACLAllowedModules();
$smarty->assign('ACLAllowedModules', $global_json->encode(array_keys($ACLAllowedModules)));
template_reports_filters($smarty, $args);
$smarty->assign('reporter_report_type', $args['reporter']->report_type);
$smarty->assign('current_user_id', $current_user->id);
$smarty->assign('md5_current_user_id', md5($current_user->id));
if (!hasRuntimeFilter($reporter)) {
//$showRunReportButton = false;
$smarty->assign('filterTabStyle', "display:none");
} else {
$smarty->assign('filterTabStyle', "display:''");
}
$smarty->assign('reportResultHeader', $mod_strings['LBL_REPORT_RESULTS']);
$reportDetailsButtonTitle = $mod_strings['LBL_REPORT_HIDE_DETAILS'];
$reportDetailsTableStyle = '';
if (isset($args['reportCache'])) {
$reportCache = $args['reportCache'];
if (!empty($reportCache->report_options_array)) {
if (array_key_exists("showDetails", $reportCache->report_options_array) && !$reportCache->report_options_array['showDetails']) {
$reportDetailsButtonTitle = $mod_strings['LBL_REPORT_SHOW_DETAILS'];
$reportDetailsTableStyle = 'display:none';
}
}
// if
}
// if
$smarty->assign('reportDetailsButtonTitle', $reportDetailsButtonTitle);
$smarty->assign('reportDetailsTableStyle', $reportDetailsTableStyle);
$smarty->assign('cache_path', sugar_cached(''));
template_reports_request_vars_js($smarty, $reporter, $args);
//custom chart code
require_once 'include/SugarCharts/SugarChartFactory.php';
$sugarChart = SugarChartFactory::getInstance();
$resources = $sugarChart->getChartResources();
$smarty->assign('chartResources', $resources);
$smarty->assign('id', empty($_REQUEST['id']) ? false : $_REQUEST['id']);
//Bug#51609: Create action buttons for report view. Previously existed in _reportCriteriaWithResult.tpl
$buttons = array();
$buttons[] = <<<EOD
<input name="runReportButton" id="runReportButton" type="submit" class="button" accessKey="{$mod_strings['LBL_RUN_REPORT_BUTTON_KEY']}" title="{$mod_strings['LBL_RUN_BUTTON_TITLE']}"
onclick="this.form.to_pdf.value='';this.form.to_csv.value='';this.form.save_report.value='';" value="{$mod_strings['LBL_RUN_REPORT_BUTTON_LABEL']}">
EOD;
$reportName = $args['reporter']->saved_report->name;
$shareButtonCode = "parent.SUGAR.App.bwc.shareRecord('Reports', '{$report_id}', '{$reportName}');";
$buttons[] = <<<EOD
<input type="button" class="button" name="shareReportButton" id="shareReportButton" accessKey="{$app_strings['LBL_SHARE_BUTTON_KEY']}" value="{$app_strings['LBL_SHARE_BUTTON_LABEL']}" title="{$app_strings['LBL_SHARE_BUTTON_TITLE']}"
onclick="{$shareButtonCode}">
EOD;
if ($report_edit_access) {
$buttons[] = <<<EOD
<input type="submit" class="button" name="editReportButton" id="editReportButton" accessKey="{$app_strings['LBL_EDIT_BUTTON_KEY']}" value="{$app_strings['LBL_EDIT_BUTTON_LABEL']}" title="{$app_strings['LBL_EDIT_BUTTON_TITLE']}"
onclick="this.form.to_pdf.value='';this.form.to_csv.value='';this.form.action.value='ReportsWizard';">
EOD;
}
array_push($buttons, $duplicateButtons);
if ($report_edit_access) {
$buttons[] = <<<EOD
<input type="button" class="button" name="scheduleReportButton" id="scheduleReportButton" value="{$mod_strings['LBL_REPORT_SCHEDULE_TITLE']}"
onclick="schedulePOPUP()">
EOD;
}
if ($report_export_access) {
//workaround for SP-1685, Need to clear bwcModel so change confirmation doesn't fire after making a PDF.
$buttons[] = <<<EOD
<input type="submit" class="button" name="printPDFButton" id="printPDFButton" accessKey="{$app_strings['LBL_VIEW_PDF_BUTTON_KEY']}" value="{$app_strings['LBL_VIEW_PDF_BUTTON_LABEL']}" title="{$app_strings['LBL_VIEW_PDF_BUTTON_TITLE']}"
示例15: getSugarChart
/**
* Return the SugarChart's object with all the values set and ready for display/consumption.
*
* @return JitReports|string
*/
public function getSugarChart()
{
if ($this->canDrawChart()) {
require_once 'include/SugarCharts/SugarChartFactory.php';
/* @var $sugarChart JitReports */
$sugarChart = SugarChartFactory::getInstance('', 'Reports');
$sugarChart->setData($this->chartRows);
global $do_thousands;
$sugarChart->setProperties($this->chartTitle, '', $this->chartType, 'on', 'value', 'on', $do_thousands);
if (isset($this->reporter->report_def['group_defs'])) {
$groupByNames = array();
foreach ($this->reporter->report_def['group_defs'] as $group_def) {
$groupByNames[] = $group_def['name'];
}
$sugarChart->group_by = $groupByNames;
}
return $sugarChart;
} else {
global $current_language;
$mod_strings = return_module_language($current_language, 'Reports');
return $mod_strings['LBL_NO_CHART_DRAWN_MESSAGE'];
}
}