Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6152393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:54:45+00:00 2026-05-23T19:54:45+00:00

I have implemented Fusion charts into Codeigniter framework with following view. I am creating

  • 0

I have implemented Fusion charts into Codeigniter framework with following view. I am creating line chart with provided data in view but, I would like to retrieve this data from same structured database table.

Is there anyway to do it? I will be really appreciated if someone can help me.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php

class Chart extends CI_Controller {

    function __construct()
       {
          session_start();
          parent::__construct();
          if ( !isset($_SESSION['username']) ) {
             redirect('admin');
          }
       }

    public function index() {


        $this->load->helper(array('url','fusioncharts')) ;

        $graph_swfFile      = base_url().'public/flash/Line.swf' ;
        $graph_caption      = 'Results' ;
        $graph_numberPrefix = '€ ' ;
        $graph_title        = 'Results' ;
        $graph_width        = 600 ;
        $graph_height       = 250 ;

        // Store Name of Products
        $arrData[0][1] = "Novomatic";
        $arrData[1][1] = "Atronic";
        $arrData[2][1] = "Williams";
        $arrData[3][1] = "Roulettes";
        $arrData[4][1] = "IGT";
        $arrData[5][1] = "Interblock";

        //Store sales data
        $arrData[0][2] = 567500;
        $arrData[1][2] = 815300;
        $arrData[2][2] = 556800;
        $arrData[3][2] = 734500;
        $arrData[4][2] = 676800;
        $arrData[5][2] = 648500;

        $strXML = "<graph caption='".$graph_caption."' numberPrefix='".$graph_numberPrefix."' formatNumberScale='0' decimalPrecision='0'>";

        //Convert data to XML and append
    foreach ($arrData as $arSubData) {
            $strXML .= "<set name='" . $arSubData[1] . "' value='" . $arSubData[2] . "' color='".getFCColor()."' />";
        }
    //Close <chart> element
    $strXML .= "</graph>";

        $data['graph']  = renderChart($graph_swfFile, $graph_title, $strXML, "div" , $graph_width, $graph_height);

        //$this->load->view('chart_view',$data) ;
        $this->template->load('includes/template', 'chart_view' ,$data);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:54:45+00:00Added an answer on May 23, 2026 at 7:54 pm

    Primarily, you would just need to build the XML from the data from your table instead of the array in your existing code.

    Sample code can be derived from :

    $strXML = "<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units'>";
    //Fetch all factory records
    $strQuery = "select * from Factory_Master";
    $result = mysql_query($strQuery) or die(mysql_error());
    //Iterate through each factory
    if ($result) {
          while($ors = mysql_fetch_array($result)) {
          //Now create a second query to get details for this factory
           $strQuery = "select sum(Quantity) as TotOutput from Factory_Output where FactoryId=" . $ors['FactoryId'];
           $result2 = mysql_query($strQuery) or die(mysql_error()); 
           $ors2 = mysql_fetch_array($result2); 
          //Generate <set label='..' value='..'/>
           $strXML .= "<set label='" . $ors['FactoryName'] . "' value='" . $ors2['TotOutput'] . "' />";
          //free the resultset
           mysql_free_result($result2);
           }
      }
      mysql_close($link);
      //Finally, close <chart> element
      $strXML .= "</chart>";
      //Create the chart - Pie 3D Chart with data from $strXML
      echo renderChart("../../FusionCharts/Pie3D.swf", "", $strXML, "FactorySum", 600, 300, false, true);
    

    Here is a discussion on the same issue:

    http://codeigniter.com/forums/viewthread/136095/#671946

    However, you can also use a better data builder and chart generator PHP class provided with FusionCharts pakck.

    For detailed reading please refer to FusionCharts Documehtation:

    http://www.fusioncharts.com/docs/ > Guide For Web Developers > FusionCharts PHP Class

    or

    http://www.fusioncharts.com/docs/ > Guide For Web Developers > Using PHP Class

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented authentication systems for webapps several times over the years, but before
I have implemented contextual menus in QTreeView items with the following code MyDerivedQTreeView->setModel(MyDerivedQAbstractItemModel); MyDerivedQTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
I have implemented signals for mousePressEvent() in a QGraphicsScene subclass, but I can't figure
I have implemented a HttpModule in ASP.NET (framework 2.0). From my logging on the
I have implemented the plugin by NPAPI for Firefox, Chrome, Safari, but there is
I have implemented the fusion.dll wrapper mentioned in many posts and now find that
I have implemented INotifyPropertyChanged to the following class public class FactoryItems : INotifyPropertyChanged {
I have implemented horizontal scroll, but vertical scroll making trouble, and the trouble is
I have implemented the ability to load 3DS files into an OpenGL program of
I have implemented a registration/login/authentication system using this Django guide . But, how would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.