You are here

public function ChartsGraphsGoogleCharts::get_chart in Charts and Graphs 7

Same name and namespace in other branches
  1. 6.2 apis/charts_graphs_google_charts/charts_graphs_google_charts.class.inc \ChartsGraphsGoogleCharts::get_chart()

Function that renders data.

Overrides ChartsGraphsCanvas::get_chart

File

apis/charts_graphs_google_charts/charts_graphs_google_charts.class.inc, line 366
Implementation of abstract class ChartsGraphsCanvas for Google Charts library.

Class

ChartsGraphsGoogleCharts
Implementation of abstract class ChartsGraphsCanvas for Google Charts library.

Code

public function get_chart() {
  $provider = charts_graphs_google_charts_chartgraph_provider();
  $chart_id = sprintf('%s-chart-%d', $this->type, $this
    ->getUnique_ID());
  $alt_text = sprintf('%s %s chart', $this->title, $provider->chart_types[$this->type]);
  $output = sprintf('<div id="%s-wrapper" class="charts_graphs_google_chart charts_graphs_google_chart_%s">
        <img id="%1$s" src="%s" alt="%s" />
      </div>', check_plain($chart_id), check_plain($this->type), $this
    ->_get_url(), check_plain($alt_text));
  $element = array(
    '#markup' => $output,
  );
  return $element;
}