public function testAliasedIsDataTable() { $this->assertTrue(Utils::isDataTable(new c\DataTable())); $this->assertFalse(Utils::isDataTable(new \stdClass())); }
/** * Checks the Chart for DataTable and builds the Javascript code block * * Build the script block for the actual chart and passes it back to * output function of the calling chart object. If there are any * events defined, they will be automatically be attached to the chart and * pulled from the callbacks folder. * * @access public * * @uses Chart * @param Chart $chart Chart object to render. * @param string $elementId HTML element id to output the chart into. * @throws DataTableNotFound * @throws InvalidElementId * * @return string Javascript code block. */ public function getChartJs(Chart $chart, $elementId = null) { if (isset($chart->datatable) && Utils::isDataTable($chart->datatable)) { $this->chart = $chart; } else { throw new DataTableNotFound($chart); } if (Utils::nonEmptyString($elementId)) { $this->elementId = $elementId; } else { throw new InvalidElementId($elementId); } return $this->buildChartJs(); }