public function toObject()
 {
     $response = new stdClass();
     $response->dataType1 = $this->dataType1;
     $response->dataType2 = $this->dataType2;
     $response->chart = $this->chart->toObject();
     return $response;
 }
    private function buildChart() {
        $chart = new Gpf_Rpc_Chart();
        $chart->setChartType($this->chartType);
        $labels = new Gpf_Chart_Labels($this->statsParameters->getDateFrom(), $this->statsParameters->getDateTo(), $this->timeGroupBy);
        $chart->setLabels($labels->getLabels());

        $computer = $this->dataType1->getComputer($this->statsParameters, $this->timeGroupBy);
        $computer->computeStats();
        $chartData = $this->createChartData($this->dataType1, $chart->getLineColor(1));
        $chartData->fill($labels, $computer->getResult());
        $chart->addData1Recordset($chartData);

        if ($this->dataType2 !== null) {
            $computer = $this->dataType2->getComputer($this->statsParameters, $this->timeGroupBy);
            $computer->computeStats();
            $chartData = $this->createChartData($this->dataType2, $chart->getLineColor(2));
            $chartData->fill($labels, $computer->getResult());
            $chart->addData2Recordset($chartData);
        }
        return $chart;
    }