Class | Fusioncharts::BasicExampleController
In: | app/controllers/fusioncharts/basic_example_controller.rb
Parent: | ApplicationController

Contains functions to generate chart by

- adopting the dataURL method of FusionCharts and using render_chart function from the helper class.
- adopting the dataXML method of FusionCharts and using render_chart function from the helper class.
- adopting the dataURL method of FusionCharts and using render_chart_html function from the helper class.
- adopting the dataXML method of FusionCharts and using render_chart_html function from the helper class.

Demonstrates the ease of generating charts using FusionCharts. All the views related to this controller will use the "common" layout. As per Ruby On Rails conventions, we have the corresponding views with the same name as the function name in the controller.

### Methods

basic_chart basic_data_xml data_xml multi_chart simple_chart

### Public Instance methods

basic_chart()

In this action, a pre-defined Data.xml (contained in /Data/ folder) is used to provide the xml in the dataURL method. render_chart_html function from the helper is invoked to render the chart. The function itself has no code, all the work is done in the builder and the view.

basic_data_xml()

This action demonstrates the ease of generating charts using FusionCharts. Here, we‘ve used a Builder Template to build the XML data. Ideally, you would generate XML data documents at run-time, after interfacing with forms or databases etc. Such examples are also present. Here, we‘ve kept this example very simple. render_chart_html function from the helper is invoked to render the chart. The function itself has no code, all the work is done in the builder and the view.

data_xml()

A Builder Template is used to build the XML data which is hard-coded. Ideally, you would generate XML data documents in the builder at run-time, after interfacing with forms or databases etc. Such examples are also present. We set the content-type header to text/html. render_chart function from the helper is invoked to render the chart. The function itself has no code, all the work is done in the builder and the view.

multi_chart()

A Builder Template is used to build the XML data which is hard-coded. Ideally, you would generate XML data documents in the builder at run-time, after interfacing with forms or databases etc. Such examples are also present. We set the content-type header to text/html. render_chart function from the helper is invoked to render the chart. The function itself has no code, all the work is done in the builder and the view.

simple_chart()

Here, we‘ve used a pre-defined Data.xml (contained in /Data/ folder) Ideally, you would NOT use a physical data file. Instead you‘ll have your own code virtually relay the XML data document. Such examples are also present. For a head-start, we‘ve kept this example very simple. This function uses the dataURL method of FusionCharts. A view with the same name simple_chart.html.erb is present and it is this view, which gets shown along with the layout "common". render_chart function from the helper is invoked to render the chart. The function itself has no code, all the work is done in the builder and the view.

[Validate]