Welcome Guest, Not a member yet? Register   Sign In
QUESTION about reports in CI
#6

[eluser]James Bolongan[/eluser]
I guess it's hard to intergrate Crystal reports or Jasper Reports in this framework since this is a PHP(pure scripting) compared to .NET and JAVA.

There are so many ways on how make reports in CI. About graphing you can use the Jpgraph or the Panaci Chart where data can vary from the database.

Just click this link for your reference:

1. Jpgraph

2. Panaci

And just feel free to post in this forums if you have any problems on how to used this charting libray or regarding about the data from database to make your graph real time.

Example code:

Code:
<?php

class Chart extends Controller {

    function Chart()
    {
        parent::Controller();
        $this->load->helper('url');
        $this->load->plugin('jpgraph');    
    }
    
    function index()
    {
        $data['title'] = "Using JpGraph from CodeIgniter 1.5";        
        $data['heading'] = "Example 0 in JpGraph 2.1.4";        
            
        // Setup Chart
        //$ydata = array(11,3,8,12,5,1,9,13,5,7); // this should come from the model        
        
        // Setup Chart real time data
    $j = 0;
    $string = "";
    $query = $this->db->query("select value from graph");
    foreach($query->result_array() as $row){
       $id[$j] = $row['value'].",";
       $string = $string.$id[$j];
       $j++;
    }
    $ydata = explode(",",$string);


        $graph = linechart($ydata, 'This is a Line Chart');  // add more parameters to plugin function as required        
        // File locations
        // Could possibly add to config file if necessary
        $graph_temp_directory = 'temp';  // in the webroot (add directory to .htaccess exclude)
        $graph_file_name = 'test.png';    
        
        $graph_file_location = $graph_temp_directory . '/' . $graph_file_name;
                
        $graph->Stroke('./'.$graph_file_location);  // create the graph and write to file
        
        $data['graph'] = $graph_file_location;
        
        $this->load->view('chart_view', $data);
    }
}
?>


Messages In This Thread
QUESTION about reports in CI - by El Forum - 11-08-2009, 07:49 PM
QUESTION about reports in CI - by El Forum - 11-08-2009, 09:32 PM
QUESTION about reports in CI - by El Forum - 11-08-2009, 11:35 PM
QUESTION about reports in CI - by El Forum - 11-09-2009, 01:51 AM
QUESTION about reports in CI - by El Forum - 11-09-2009, 08:06 AM
QUESTION about reports in CI - by El Forum - 11-09-2009, 10:21 AM
QUESTION about reports in CI - by El Forum - 11-09-2009, 12:56 PM
QUESTION about reports in CI - by El Forum - 11-09-2009, 07:55 PM
QUESTION about reports in CI - by El Forum - 11-10-2009, 12:11 AM
QUESTION about reports in CI - by El Forum - 11-10-2009, 08:28 AM
QUESTION about reports in CI - by El Forum - 11-13-2009, 07:22 AM
QUESTION about reports in CI - by El Forum - 11-13-2009, 07:28 AM
QUESTION about reports in CI - by El Forum - 11-22-2009, 08:05 PM
QUESTION about reports in CI - by El Forum - 11-22-2009, 09:16 PM
QUESTION about reports in CI - by El Forum - 11-25-2009, 02:17 PM
QUESTION about reports in CI - by El Forum - 12-28-2010, 10:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB