CataractComplicationsReport::graphConfig PHP Method

graphConfig() public method

public graphConfig ( ) : string
return string
    public function graphConfig()
    {
        $this->setComplicationCategories();
        $this->graphConfig['chart']['renderTo'] = $this->graphId();
        $this->graphConfig['subtitle']['text'] .= $this->getTotalComplications();
        $this->graphConfig['subtitle']['text'] .= ' Total Operations: ' . $this->getTotalOperations();
        return json_encode(array_merge_recursive($this->globalGraphConfig, $this->graphConfig));
    }

Usage Example

 /**
  * Test the configuration for the graph.
  */
 public function testConfig()
 {
     $report = new CataractComplicationsReport(Yii::app());
     $config = $report->graphConfig();
     $configDecoded = json_decode($config, true);
     $this->assertInternalType('string', $config);
     //is a string
     $this->assertEquals('bar', $configDecoded['chart']['type']);
     // check it looks ok
     $this->assertEquals(false, $configDecoded['credits']['enabled']);
     //check globabl config merge
     $this->assertEquals('CataractComplicationsReport', $configDecoded['chart']['renderTo']);
 }