You are here

function ViewsSimplechartPluginStyle::render in Views Simple Chart 7

Render the display in this style.

Overrides views_plugin_style::render

File

plugins/views_simplechart_plugin_style.inc, line 88
Contains the list style plugin.

Class

ViewsSimplechartPluginStyle
Style plugin to render each item in an ordered or unordered list.

Code

function render() {
  $barchart = $this
    ->render_fields($this->view->result);
  $chartdata[] = explode(',', $this->options['chart_axis_mapping']);
  foreach ($barchart as $row) {
    $chartdata[] = array_values($row);
  }
  $chartdata = json_encode($chartdata, JSON_NUMERIC_CHECK);
  if ($this->options['chart_type'] == 'Timeline') {
    $chartdata = preg_replace('/"(\\d+)-(\\d+)-(\\d+)"/i', 'new Date(\'$1-$2-$3\')', $chartdata);
  }
  return theme('views_simplechart_graph', array(
    'barchart' => $chartdata,
    'metadata' => $this->options,
  ));
}