application/controllers/Chart.php
/**
     * Charts for symbol
     * 
     * @param string $code          Contains code of symbol
     * @param string $ratioCode     Contains code of ratio symbol
     */
Charts for symbol

@param string $code          Contains code of symbol
@param string $ratioCode     Contains code of ratio symbol
Charts for symbol @param string $code Contains code of symbol @param string $ratioCode Contains code of ratio symbol
public function ratio($code, $ratioCode) {
        $this->load->helper('url');
        $this->load->library('pchart');
        $symbol = $this->symbol_model->get_symbol_by_code($code);
        $ratioSymbol = $this->symbol_model->get_symbol_by_code($ratioCode);
        if ($symbol && $ratioSymbol) {
            $data['charts'] = array();
            $periods = array('hour', 'day', 'month');
            foreach ($periods as $period) {
                $fileName = 'img/chart/' . 'last_' . $period . '_' . str_replace('#', '', $symbol['code'])
                        . '_' . str_replace('#', '', $ratioSymbol['code']) . '.png';
                $valueName = $symbol['name'] . ' / ' . $ratioSymbol['name'];
                if ($this->_drawChartForValueAndPeriod($symbol['id'], $valueName, $period, $fileName, $ratioSymbol['id'])) {
                    $data['charts'][] = $fileName;
                }
            }
            $this->load->view('header', array('title' => $valueName));
            $this->load->view('chart', $data);
            $this->load->view('footer');
        } else {
            show_404();
        }
    }
public function ratio ( $ code , $ ratioCode ) { $ this -> load -> helper ( 'url' ) ; $ this -> load -> library ( 'pchart' ) ; $ symbol = $ this -> symbol_model -> get_symbol_by_code ( $ code ) ; $ ratioSymbol = $ this -> symbol_model -> get_symbol_by_code ( $ ratioCode ) ; if ( $ symbol && $ ratioSymbol ) { $ data [ 'charts' ] = array ( ) ; $ periods = array ( 'hour' , 'day' , 'month' ) ; foreach ( $ periods as $ period ) { $ fileName = 'img/chart/' . 'last_' . $ period . '_' . str_replace ( '#' , '' , $ symbol [ 'code' ] ) . '_' . str_replace ( '#' , '' , $ ratioSymbol [ 'code' ] ) . '.png' ; $ valueName = $ symbol [ 'name' ] . ' / ' . $ ratioSymbol [ 'name' ] ; if ( $ this -> _drawChartForValueAndPeriod ( $ symbol [ 'id' ] , $ valueName , $ period , $ fileName , $ ratioSymbol [ 'id' ] ) ) { $ data [ 'charts' ] [ ] = $ fileName ; } } $ this -> load -> view ( 'header' , array ( 'title' => $ valueName ) ) ; $ this -> load -> view ( 'chart' , $ data ) ; $ this -> load -> view ( 'footer' ) ; } else { show_404 ( ) ; } }
Charts for symbol
Charts for symbol