Foros del Web » Programando para Internet » PHP » CodeIgniter »

[SOLUCIONADO] Usando HIGHCHARTS con Codeigniter

Estas en el tema de Usando HIGHCHARTS con Codeigniter en el foro de CodeIgniter en Foros del Web. Saludos, a ver si me pueden ayudar , estoy usando el ejemplo de esta web : http://blueflame-software.com/using-highcharts-with-codeigniter/ Aparentemente no tengo errores , pero no me ...
  #1 (permalink)  
Antiguo 26/01/2016, 07:38
 
Fecha de Ingreso: agosto-2012
Ubicación: Caracas
Mensajes: 14
Antigüedad: 11 años, 8 meses
Puntos: 0
Usando HIGHCHARTS con Codeigniter

Saludos, a ver si me pueden ayudar , estoy usando el ejemplo de esta web :
http://blueflame-software.com/using-highcharts-with-codeigniter/

Aparentemente no tengo errores , pero no me muestra el gráfico , continuación les paso mis códigos y a ver que puede ser

///Vista////
Código PHP:
<div class="row">
        <
div class="box-header with-border" >
          <
div class="col-xs-4" >
              <
class="btn btn-primary view-pdf" href="****"><span class=" fa fa-file-pdf-o"></span>  Reporte de Clientes</a>
              </
div>
                  <
div class="col-xs-4"  >
                      <
class="btn btn-primary view-pdf" href="****"><span class=" fa fa-file-pdf-o"></span>Reporte de Contactos</a>
                    </
div>
                    <
div class="col-xs-4"  >
            <
class="btn btn-primary view-pdf" href="***"><span class=" fa fa-file-pdf-o"></span>  Reporte de Gestiones</a>

                  </
div>

                  </
div>
        </
div>
<
div class="row">
  <
div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>

      </
div>
  </
div>

  <
script src="http://code.highcharts.com/highcharts.js"></script>
  <script src="http://code.highcharts.com/modules/exporting.js"></script>

<script>
(function(a){a.createModal=function(b){defaults={title:"",message:"Your Message Goes Here!",closeButton:true,scrollable:false};var b=a.extend({},defaults,b);var c=(b.scrollable===true)?'style="max-height: 420px;overflow-y: auto;"':"";html='<div class="modal fade" id="myModal">';html+='<div class="modal-dialog">';html+='<div class="modal-content">';html+='<div class="modal-header">';html+='<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>';if(b.title.length>0){html+='<h4 class="modal-title">'+b.title+"</h4>"}html+="</div>";html+='<div class="modal-body" '+c+">";html+=b.message;html+="</div>";html+='<div class="modal-footer">';if(b.closeButton===true){html+='<button type="button" class="btn btn-primary" data-dismiss="modal">Cerrar</button>'}html+="</div>";html+="</div>";html+="</div>";html+="</div>";a("body").prepend(html);a("#myModal").modal().on("hidden.bs.modal",function(){a(this).remove()})}})(jQuery);
$(function(){
    $('.view-pdf').on('click',function(){
        var pdf_link = $(this).attr('href');
        //var iframe = '<div class="iframe-container"><iframe src="'+pdf_link+'"></iframe></div>'
        //var iframe = '<object data="'+pdf_link+'" type="application/pdf"><embed src="'+pdf_link+'" type="application/pdf" /></object>'
        var iframe = '<object type="application/pdf" data="'+pdf_link+'" width="100%" height="400">No Support</object>'
        $.createModal({
            title:'REPORTE',
            message: iframe,
            closeButton:true,
            scrollable:false
        });
        return false;
    });
})
////////Graficas ////////////////////

$(document).ready(function() {
  var options = {
          chart: {
              renderTo: 'container',
              type: 'line',
              marginRight: 130,
              marginBottom: 25
          },
          title: {
              text: 'Project Requests',
              x: -20 //center
          },
          subtitle: {
              text: '',
              x: -20
          },
          xAxis: {
              categories: []
          },
          yAxis: {
              title: {
                  text: 'Requests'
              },
              plotLines: [{
                  value: 0,
                  width: 1,
                  color: '#808080'
              }]
          },
          tooltip: {
              formatter: function() {
                      return '<b>'+ this.series.name +'</b><br/>'+
                      this.x +': '+ this.y;
              }
          },
          legend: {
              layout: 'vertical',
              align: 'right',
              verticalAlign: 'top',
              x: -10,
              y: 100,
              borderWidth: 0
          },

          series: []
      }

      $.getJSON("Reportes", function(json) {
    options.xAxis.categories = json[0]['data'];
        options.series[0] = json[1];
        options.series[1] = json[2];
        options.series[2] = json[3];
        chart = new Highcharts.Chart(options);
      });
  });


</script> 
//Controlador/////

Código PHP:
class Reportes extends CI_COntroller
    
{


        function 
__construct()
        {
            
parent::__construct();
            
$this->load->model('cliente');
            
$this->load->model('reporte_gestion');
        }
        function 
index()
        {
            if(    
$this->session->userdata('logged_in') ){
                
$session $this->session->userdata('logged_in');
          
$content     = array(     'clientes'    => $this->cliente->mis_clientes() );
                
$body_view     $this->load->view('crm/reportes/home'$contentTRUE);
                
$modal         $this->load->view('template/modal''' TRUE);

                
$data = array(    'title'             => 'Reportes',
                                
'content_header'     => array('Reportes','Home'),
                                
'breadcrumb_inicio'    => 'Reportes',
                                
'breadcrumbs'         => NULL,
                                
'content_body'         => $body_view,
                                
'modal'                => $modal,
                                
'active'             => 'reportes'
                            
);

                
$this->load->view('template/template',$data);
            }
            else
               
redirect('index.php/main','refresh');

        }

        public function 
data()
        {

            
$data $this->Reporte_gestion->get_data();

            
$category = array();
            
$category['name'] = 'Category';

            
$series1 = array();
            
$series1['name'] = 'WordPress';

            
$series2 = array();
            
$series2['name'] = 'Code Igniter';

            
$series3 = array();
            
$series3['name'] = 'Highcharts';

            foreach (
$data as $row)
            {
                
$category['data'][] = $row->month;
                
$series1['data'][] = $row->wordpress;
                
$series2['data'][] = $row->codeigniter;
                
$series3['data'][] = $row->highcharts;
            }

            
$result = array();
            
array_push($result,$category);
            
array_push($result,$series1);
            
array_push($result,$series2);
            
array_push($result,$series3);

            print 
json_encode($resultJSON_NUMERIC_CHECK);
        }
    }
?> 

////Modelo////



Código PHP:
<?php
class Reporte_gestion extends CI_Model {

    function 
__construct()
    {
        
parent::__construct();
    }

    function 
obtenerGestion()
    {
      
$this->db->select('CONCAT(nombre,apellido)as vendedor,
                        DATE_FORMAT(gestiones.fecha, "%d/%l/%Y") AS fecha1,
                        clientes.nombre_fantasia,
                        tipo_gestion.tipo_gestion,
                        gestiones.detalle as observaciones'
);
      
$this->db->from('gestiones');
      
$this->db->join('tipo_gestion','gestiones.tipo_gestion_id = tipo_gestion.id');
      
$this->db->join('users''gestiones.usuario_id = users.id');
      
$this->db->join('clientes''clientes.id_usuario = users.id and gestiones.cliente_rut = clientes.rut');
      
$this->db->order_by("fecha1""desc");
      
$this->db->limit(5);
      
$gestiones $this->db->get();

        return 
$gestiones->result();
    }

    function 
get_data()
    {
        
$this->db->select('month, wordpress, codeigniter, highcharts');
            
$this->db->from('project_requests');
            
$query $this->db->get();
           return 
$query->result();
    }
}
?>
  #2 (permalink)  
Antiguo 27/01/2016, 08:52
 
Fecha de Ingreso: agosto-2012
Ubicación: Caracas
Mensajes: 14
Antigüedad: 11 años, 8 meses
Puntos: 0
Respuesta: Usando HIGHCHARTS con Codeigniter

Creo que mi problema esta por aqui , alguien tiene idea , porque en verdad no lo veo


$.getJSON("Reportes", function(json) {
options.xAxis.categories = json[0]['data'];
options.series[0] = json[1];
options.series[1] = json[2];
options.series[2] = json[3];
chart = new Highcharts.Chart(options);
});
  #3 (permalink)  
Antiguo 29/01/2016, 07:06
 
Fecha de Ingreso: agosto-2012
Ubicación: Caracas
Mensajes: 14
Antigüedad: 11 años, 8 meses
Puntos: 0
Respuesta: Usando HIGHCHARTS con Codeigniter

Ya lo repare esa tan sencillo gracias por ayudar jojojo

Etiquetas: usando
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:53.