Class: Google::Visualization::Formatter::JSON

Inherits:
Object
  • Object
show all
Defined in:
lib/google_visualization/formatter/json.rb

Overview

JSON Formatter

Description

Serializes a DataTable to the JavaScript Object Notation (JSON).

Class Method Summary collapse

Class Method Details

.render(data_table) ⇒ Object

Generates a JSON string representation of a data table.



21
22
23
24
25
26
27
# File 'lib/google_visualization/formatter/json.rb', line 21

def self.render(data_table)
  {
    'cols' => render_columns(data_table),
    'rows' => render_rows(data_table) #,
#            'p' => render_custom_properties(data_table)
  }.to_json
end