Welcome Guest, Not a member yet? Register   Sign In
Array manipulation
#5

[eluser]InsiteFX[/eluser]
Code:
function buildPie($data)
            {
                 $this->load->library('charts');
                $config = array(
                'SpliceDistance'=>10,
                'TitleFontSize' => 16,
                'TitleFontName' => 'pf_arma_five.ttf');
                
                $percents = $data['percents'];
                $legend = $data['legend'];
                $title = $data['title'];
                $bottom_label='bottom label';
                
                $i = $data['count'];
                
                $data['image'.$i] = $this->charts->pieChart(100,$percents,$legend,'',$title,$bottom_label,$config);
        
                
                return $data;
                
            }
            
            function results()
            {
                $data['count'] = 0;
              
                $data['percents'] = array(19,34,13,20,10,4);
                $data['legend'] = array('one','two','tree','four','five','six');
                $data['title'] = 'Title 1';
            
                $data['count']++;
                $onion1 = $this->buildPie($data);

                
                $data['percents'] = array(1,2,3,4,45,45);
                $data['legend'] = array('one','two','tree','four','five','six');
                $data['title'] = 'Title 2';
                
                $data['count']++;
                $onion2 = $this->buildPie($data);


                
                $data['percents'] = array(15,20,25,10,10,10);
                $data['legend'] = array('one','two','tree','four','five','six');
                $data['title'] = 'Title 3';
                
                $data['count']++;
                $onion3 = $this->buildPie($data);
                
                $onion = array_merge($onion1, $onion2, $onion3);

                $this->load->view('includes/template', $onion);

Not tested but you can try the above.

Enjoy
InsiteFX


Messages In This Thread
Array manipulation - by El Forum - 03-22-2010, 02:51 PM
Array manipulation - by El Forum - 03-22-2010, 03:08 PM
Array manipulation - by El Forum - 03-22-2010, 03:09 PM
Array manipulation - by El Forum - 03-22-2010, 03:21 PM
Array manipulation - by El Forum - 03-22-2010, 05:28 PM
Array manipulation - by El Forum - 03-22-2010, 06:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB