/** * Renders the control into the page * * Given a control label and an HTML element id, this will output * all of the necessary javascript to generate the chart. * * @access public * @since v2.0.0 * * @param string $controlType Type of control to render. * @param string $controlType Label of a saved chart. * @param string $elementId HTML element id to render the chart into. * @param mixed $divDimensions Set true for div creation, or pass an array with height & width * * @return string */ public function renderControl($controlType, $controlLabel, $elementId = null, $divDimensions = false) { $jsOutput = ''; $control = $this->volcano->getControl($controlType, $controlLabel); if (!empty($elementId) && Utils::nonEmptyString($elementId)) { $control->setElementId($elementId); } if ($this->jsFactory->coreJsRendered() === false) { $jsOutput = $this->jsFactory->getCoreJs(); $this->jsFactory->coreJsRendered(true); } if ($divDimensions !== false) { $jsOutput .= $this->div($control->elementId, $divDimensions); } $jsOutput .= $this->jsFactory->getControlWrapperJs($control, $elementId); return $jsOutput; }
/** * Outputs the chart javascript into the page * * Pass in a string of the html elementID that you want the chart to be * rendered into. * * @since v2.0.0 * @param string $ei The id of an HTML element to render the chart into. * @throws InvalidElementId * * @return string Javscript code blocks */ public function render($ei) { $jsf = new JavascriptFactory(); return $jsf->getControlWrapperJs($this, $ei); }