public function renderContent()
 {
     $accessContent = $this->resolveContentIfCurrentUserCanAccessChartByModule('OpportunitiesModule', 'OpportunitiesModulePluralLabel');
     if ($accessContent != null) {
         return $accessContent;
     }
     $chartDataProviderType = $this->getChartDataProviderType();
     $chartDataProvider = ChartDataProviderFactory::createByType($chartDataProviderType);
     ControllerSecurityUtil::resolveCanCurrentUserAccessModule($chartDataProvider->getModel()->getModuleClassName(), true);
     $chartData = $chartDataProvider->getChartData();
     Yii::import('ext.amcharts.AmChartMaker');
     $amChart = new AmChartMaker();
     $amChart->data = $chartData;
     $amChart->id = $this->uniqueLayoutId;
     $amChart->type = $this->resolveViewAndMetadataValueByName('type');
     $amChart->addSerialGraph('value', 'column');
     $amChart->xAxisName = $chartDataProvider->getXAxisName();
     $amChart->yAxisName = $chartDataProvider->getYAxisName();
     $amChart->yAxisUnitContent = Yii::app()->locale->getCurrencySymbol(Yii::app()->currencyHelper->getCodeForCurrentUserForDisplay());
     $javascript = $amChart->javascriptChart();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->uniqueLayoutId, $javascript);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("Chart");
     $cClipWidget->widget('application.core.widgets.AmChart', array('id' => $this->uniqueLayoutId));
     $cClipWidget->endClip();
     return $cClipWidget->getController()->clips['Chart'];
 }
 /**
  * @param MarketingListGrowthChartDataProvider $chartDataProvider
  * @param string $uniqueId
  * @return string
  */
 public static function renderListGrowthChartContent(MarketingListGrowthChartDataProvider $chartDataProvider, $uniqueId)
 {
     assert('is_string($uniqueId)');
     $chartData = $chartDataProvider->getChartData();
     Yii::import('ext.amcharts.AmChartMaker');
     $amChart = new AmChartMaker();
     $amChart->data = $chartData;
     $amChart->id = $uniqueId;
     $amChart->type = ChartRules::TYPE_STACKED_COLUMN_2D;
     $amChart->addSerialGraph(MarketingChartDataProvider::EXISTING_SUBSCRIBERS_COUNT, 'column', array('title' => "'" . Zurmo::t('MarketingModule', 'Existing Subscribers') . "'", 'balloonText' => "'[[dateBalloonLabel]]<br>" . Zurmo::t('MarketingModule', 'Existing Subscribers') . ": [[value]]'"));
     $amChart->addSerialGraph(MarketingChartDataProvider::NEW_SUBSCRIBERS_COUNT, 'column', array('title' => "'" . Zurmo::t('MarketingModule', 'New Subscribers') . "'", 'balloonText' => "'[[dateBalloonLabel]]<br>" . Zurmo::t('MarketingModule', 'New Subscribers') . ": [[value]]'"));
     $amChart->xAxisName = $chartDataProvider->getXAxisName();
     $amChart->yAxisName = $chartDataProvider->getYAxisName();
     $javascript = $amChart->javascriptChart();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . $uniqueId, $javascript);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("Chart");
     $cClipWidget->widget('application.core.widgets.AmChart', array('id' => $uniqueId));
     $cClipWidget->endClip();
     return $cClipWidget->getController()->clips['Chart'];
 }
 protected function renderMiniStatisticsChart()
 {
     $chartData = array(array('column' => 'level-undone', 'value' => 100 - (int) $this->generalLevelData['nextLevelPercentageComplete']), array('column' => 'level-done', 'value' => (int) $this->generalLevelData['nextLevelPercentageComplete']));
     Yii::import('ext.amcharts.AmChartMaker');
     $amChart = new AmChartMaker();
     $amChart->data = $chartData;
     $amChart->id = 'miniChart';
     $amChart->type = ChartRules::TYPE_DONUT_PROGRESSION;
     $amChart->addSerialGraph('value', 'column');
     $amChart->addSerialGraph('value', 'column');
     $javascript = $amChart->javascriptChart();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '-mini-chart', $javascript);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("Chart");
     $cClipWidget->widget('application.core.widgets.AmChart', array('id' => 'miniChart', 'height' => '150px'));
     $cClipWidget->endClip();
     return $cClipWidget->getController()->clips['Chart'];
 }
 /**
  * @return string
  */
 protected function renderChartContent()
 {
     $reportDataProviderToAmChartMakerAdapter = $this->dataProvider->makeReportDataProviderToAmChartMakerAdapter();
     Yii::import('ext.amcharts.AmChartMaker');
     $amChart = new AmChartMaker();
     $amChart->categoryField = ReportDataProviderToAmChartMakerAdapter::resolveFirstSeriesDisplayLabelName(1);
     $amChart->data = $reportDataProviderToAmChartMakerAdapter->getData();
     $amChart->id = $this->uniqueLayoutId;
     $amChart->type = $reportDataProviderToAmChartMakerAdapter->getType();
     $amChart->xAxisName = $this->dataProvider->resolveFirstSeriesLabel();
     $amChart->yAxisName = $this->dataProvider->resolveFirstRangeLabel();
     $amChart->yAxisUnitContent = $this->resolveYAxisUnitContent();
     if ($reportDataProviderToAmChartMakerAdapter->isStacked()) {
         for ($i = 1; $i < $reportDataProviderToAmChartMakerAdapter->getSecondSeriesValueCount() + 1; $i++) {
             $title = $reportDataProviderToAmChartMakerAdapter->getSecondSeriesDisplayLabelByKey($i);
             $balloonText = '"[[' . ReportDataProviderToAmChartMakerAdapter::resolveSecondSeriesDisplayLabelName($i) . ']] - [[' . ReportDataProviderToAmChartMakerAdapter::resolveFirstRangeDisplayLabelName($i) . ']] : [[' . ReportDataProviderToAmChartMakerAdapter::resolveFirstSeriesFormattedValueName($i) . ']] - [[' . ReportDataProviderToAmChartMakerAdapter::resolveSecondSeriesDisplayLabelName($i) . ']] : [[' . ReportDataProviderToAmChartMakerAdapter::resolveSecondSeriesFormattedValueName($i) . ']] "';
             $amChart->addSerialGraph(ReportDataProviderToAmChartMakerAdapter::resolveFirstSeriesValueName($i), 'column', array('title' => '"' . CJavaScript::quote($title) . '"', 'balloonText' => $balloonText));
         }
     } else {
         $amChart->addSerialGraph(ReportDataProviderToAmChartMakerAdapter::resolveFirstSeriesValueName(1), 'column');
     }
     $scriptContent = $amChart->javascriptChart();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->uniqueLayoutId, $scriptContent);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("Chart" . $this->uniqueLayoutId);
     $cClipWidget->widget('application.core.widgets.AmChart', array('id' => $this->uniqueLayoutId));
     $cClipWidget->endClip();
     return $cClipWidget->getController()->clips['Chart' . $this->uniqueLayoutId];
 }
 public function renderCategoryDirectCostsChartContent(OpportunityProductsEstimatorSummaryCategoryDirectCostsChartDataProvider $chartDataProvider, $uniqueId)
 {
     $chartData = $chartDataProvider->getChartData();
     Yii::import('ext.amcharts.AmChartMaker');
     $amChart = new AmChartMaker();
     $amChart->data = $chartData;
     $amChart->id = $uniqueId;
     $amChart->type = ChartRules::TYPE_GICRM_PIE_2D;
     $amChart->addChartProperties('balloonText', "'[[title]]: [[percents]]% (\$[[value]])'");
     //Legend
     $amChart->addLegendProperties('borderAlpha', 0.2);
     $amChart->addLegendProperties('valueWidth', 15);
     $amChart->addLegendProperties('horizontalGap', 10);
     $amChart->addLegendProperties('markerLabelGap', 20);
     $amChart->addLegendProperties('valueText', "'\$[[value]]'");
     $amChart->addSerialGraph("value", 'column');
     $amChart->xAxisName = $chartDataProvider->getXAxisName();
     $amChart->yAxisName = $chartDataProvider->getYAxisName();
     $javascript = $amChart->javascriptChart();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $uniqueId, $javascript);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("Chart");
     $cClipWidget->widget('application.core.widgets.AmChart', array('id' => $uniqueId));
     $cClipWidget->endClip();
     return $cClipWidget->getController()->clips['Chart'];
 }