nowDbDate(); } if (empty($options['obm_date_end'])) { $options['obm_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months")); } parent::__construct($id, $options); } /** * @see DashletGenericChart::displayOptions() */ public function displayOptions() { if (!isset($this->obm_ids) || count($this->obm_ids) == 0) { $this->_searchFields['obm_ids']['input_name0'] = array_keys(get_user_array(false)); } return parent::displayOptions(); } /** * @see DashletGenericChart::display() */ public function display() { $currency_symbol = $GLOBALS['sugar_config']['default_currency_symbol']; if ($GLOBALS['current_user']->getPreference('currency')) { $currency = BeanFactory::newBean('Currencies'); $currency->retrieve($GLOBALS['current_user']->getPreference('currency')); $currency_symbol = $currency->symbol; } $thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts'); $module = 'Opportunities'; $action = 'index'; $query = 'true'; $searchFormTab = 'advanced_search'; $groupBy = array( 'm', 'sales_stage', ); $data = $this->getChartData($this->constructQuery()); //I have taken out the sort as this will throw off the labels we have calculated $data = $this->sortData($data, 'm', false, 'sales_stage', true, true); $chartReadyData = $this->prepareChartData($data, $currency_symbol, $thousands_symbol); $canvasId = 'rGraphOutcomeByMonth'.uniqid(); $chartWidth = 900; $chartHeight = 500; $autoRefresh = $this->processAutoRefresh(); //$chartReadyData['data'] = [[1.1,2.2],[3.3,4.4]]; $jsonData = json_encode($chartReadyData['data']); $jsonLabels = json_encode($chartReadyData['labels']); $jsonLabelsAndValues = json_encode($chartReadyData['labelsAndValues']); $jsonKey = json_encode($chartReadyData['key']); $jsonTooltips = json_encode($chartReadyData['tooltips']); $colours = "['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#ffff99','#b15928']"; if (!is_array($chartReadyData['data'])||count($chartReadyData['data']) < 1) { return "