/**
  * Renders the dashboard into the page
  *
  * Given a dashboard 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 $dashboardType     Type of dashboard to render.
  * @param string $dashboardLabel    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 renderDashboard($dashboardType, $dashboardLabel, $elementId = null, $divDimensions = false)
 {
     $jsOutput = '';
     $dashboard = $this->volcano->getDashboard($dashboardType, $dashboardLabel);
     if (!empty($elementId) && Utils::nonEmptyString($elementId)) {
         $dashboard->setElementId($elementId);
     }
     if ($this->jsFactory->coreJsRendered() === false) {
         $jsOutput = $this->jsFactory->getCoreJs();
         $this->jsFactory->coreJsRendered(true);
     }
     if ($divDimensions !== false) {
         $jsOutput .= $this->div($dashboard->elementId, $divDimensions);
     }
     $jsOutput .= $this->jsFactory->getDashboardJs($dashboard, $elementId);
     return $jsOutput;
 }
Beispiel #2
0
 /**
  * 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->getDashboardJs($this, $ei);
 }