    # File app/controllers/fusioncharts/db_data_url_controller.rb, line 25
      def pie_data

          headers["content-type"]="text/xml";
          @factory_data = []

          # Find all the factories
          factory_masters = Fusioncharts::FactoryMaster.find(:all)

          # For each factory, find the factory output details.
            factory_masters.each do |factory_master|
              factory_name = factory_master.name
              total = 0.0
              factory_master.factory_output_quantities.each do |factory_output|
                # Total the output quantity for a particular factory
                total = total + factory_output.quantity
              end
              # Append the array of factory name and total output quantity to the existing array @factory_data
              @factory_data<<[factory_name,total]
          end
      end