/** * @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 testResolveSecondSeriesFormattedValueName() { $value = ReportDataProviderToAmChartMakerAdapter::resolveSecondSeriesFormattedValueName(5); $this->assertEquals('SecondSeriesFormattedValue5', $value); }