Class Fusioncharts::DbDataUrlController
In: app/controllers/fusioncharts/db_data_url_controller.rb
Parent: ApplicationController

This controller class shows how to render a pie-chart by retrieving factory name and total output quantity dynamically at run-time, from the database. setDataURL method is used here. As per Ruby On Rails conventions, we have the corresponding views with the same name as the function name in the controller.

Methods

default   pie_data  

Public Instance methods

Set DataURL with animation property to 1. NOTE: It‘s necessary to encode the dataURL if you‘ve added parameters to it. In this example, we show how to connect FusionCharts to a database using dataURL method. In our other examples, we‘ve used dataXML method where the XML is generated in the same page as chart. Here, the XML data for the chart would be generated in pie_data function. To illustrate how to pass additional data as querystring to dataURL, we‘ve added an animate property, which will be passed to pie_data action. pie_data action would handle this animate property and then generate the XML accordingly.

Finds all factories Uses the Model FactoryMaster Content-type for its view is text/xml

[Validate]