Class Fusioncharts::ArrayExampleController
In: app/controllers/fusioncharts/array_example_controller.rb
Parent: ApplicationController

This controller class will show ways of generating chart by

  • using sales data of products with their names present in an array.
  • using sales data of products for current year and previous year with their names present in an array.
  • using sales figure and quantity sold in each quarter of a year of a product present in an array.
  • using sales information of two products in each quarter of a year present in an array .

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

Public Instance methods

In this function, we plot a Combination chart from data contained in an array. Each element in the array will have three values - first one for Quarter Name second one for sales figure and third one for quantity. These values in the array will be used by the builder to build an appropriate xml, which is then rendered by the corresponding view.

In this function, we plot a multi-series chart from data contained in an array. Each element in the array will have three values - first one for data label (product) and the next one store sales information for current year and the last one stores sales information for previous year. The sales data and product names for 6 products are thus, stored. These values in the array will be used by the builder to build an appropriate xml, which is then rendered by the corresponding view.

In this function, we plot a single series chart from data contained in an array. Each element in the array will have two values - first one for data label and the next one for data value. The sales data and product names for 6 products are stored in the array. These values in the array will be used by the builder to build an appropriate xml, which is then rendered by the corresponding view.

In this function, we plot a Stacked chart from data contained in an array. Each element in the array will have three values - first one for Quarter Name and the next one for sales information of Product A and the last one for sales information of Product B.

[Validate]