Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] Problemas JpGraph

Estas en el tema de Problemas JpGraph en el foro de PHP en Foros del Web. Como muchos sabréis jpgraph es una librería que te permite generar gráficos mediante las librerías que trae definidas. El caso es que me está dando ...
  #1 (permalink)  
Antiguo 01/05/2015, 18:27
 
Fecha de Ingreso: junio-2009
Mensajes: 101
Antigüedad: 14 años, 10 meses
Puntos: 13
Problemas JpGraph

Como muchos sabréis jpgraph es una librería que te permite generar gráficos mediante las librerías que trae definidas. El caso es que me está dando un problema:

Como podréis ver en el código (más abajo) en la linea
Código PHP:
include('config/statistics.class.php'); 
estoy incluyendo un archivo donde tengo la siguiente clase:



Entonces: Si incluyo la clase mediante tal linea se muestra como si la imagen de la gráfica estuviera rota:


En cambio, si directamente pego todo el código de la clase en el archivo principal (cuyo código muestro a continuación) funciona perfectamente.

Qué puede ser?


/home/users/web/b2641/glo.bannss1/websites/XXXXXXX/includes/account/statistics_graph.php
Código PHP:
session_start();
error_reporting(2047);
ini_set("display_errors",1);
date_default_timezone_set("Europe/Madrid");
setlocale(LC_TIME,"es_ES");

if(isset(
$_GET['q']) && isset($_SESSION['userid'])){
    if((
$_GET['q'] == "month" || $_GET['q'] == "year")  && isset($_GET['mn']) && is_numeric($_GET['mn'])){

        
set_include_path('/home/users/web/b2641/glo.bannss1/websites/XXXXXXX');
        
ini_set('include_path''/home/users/web/b2641/glo.bannss1/websites/XXXXXXX');


        require_once (
'jpgraph/src/jpgraph.php');
        require_once (
'jpgraph/src/jpgraph_line.php');
        include(
'config/mysql.php');
        include(
'config/statistics.class.php');
        include(
'config/lang.es.php');



        
        
$active_months Statistics::getActiveMonths($_SESSION['userid']);
        
$active_years Statistics::getActiveYears($_SESSION['userid']);
        if((
$_GET['q'] == "month" && isset($active_months[$_GET['mn']])) || ($_GET['q'] == "year" && isset($active_years[$_GET['mn']])) ){
            
            
$statistics = new Statistics($_GET['q']);
            if(
$_GET['q']=='year'){
                
$statistics->setMonthYear($active_years[$_GET['mn']]);
            }else{
                
$statistics->setMonthYear($active_months[$_GET['mn']][1],$active_months[$_GET['mn']][0]);
            }
        
            
$xAxis $statistics->getX();
            
$yAxis $statistics->getY();
            
            
$graph = new Graph(700,500);
            
$graph->SetScale("textlin");

            
$theme_class=new UniversalTheme;

            
$graph->SetTheme($theme_class);
            
$graph->img->SetAntiAliasing(false);
            
$graph->SetBox(false);

            
$graph->img->SetAntiAliasing();

            
$graph->yaxis->HideZeroLabel();
            
$graph->yaxis->HideLine(false);
            
//$graph->yaxis->HideTicks(false,false);

            
$graph->xgrid->Show();
            
$graph->xgrid->SetLineStyle("solid");
            
$graph->xaxis->SetTickLabels($xAxis);
            
$graph->xgrid->SetColor('#E3E3E3');

            
// Create the first line
            
            
$p1 = new LinePlot($yAxis[0]);
            
$graph->Add($p1);
            
$p1->SetColor("#2ec55b");
            
$p1->SetLegend('Creditos A');

            
$p2 = new LinePlot($yAxis[1]);
            
$graph->Add($p2);
            
$p2->SetColor("#eeFF00");
            
$p2->SetLegend('Creditos R');
            
            
$p3 = new LinePlot($yAxis[2]);
            
$graph->Add($p3);
            
$p3->SetColor("#FF0000");
            
$p3->SetLegend('Creditos Totales');




            
$graph->legend->SetFrameWeight(1);

            
// Output line
            
$graph->img->SetImgFormat('png');
            
$graph->SetMargin(50,50,10,10); //left,right,top,bottom
            
            
$graph->Stroke();

        }
    }


Última edición por BanNsS1; 01/05/2015 a las 19:38
  #2 (permalink)  
Antiguo 02/05/2015, 08:20
 
Fecha de Ingreso: junio-2009
Mensajes: 101
Antigüedad: 14 años, 10 meses
Puntos: 13
Respuesta: Problemas JpGraph

Up!!!!!!!!!!!


Edit: Ya lo solucioné, tenia algún que otro error sin importancia en la clase. No se mostraban ya que algunas funciones no eran llamadas

Última edición por BanNsS1; 02/05/2015 a las 10:01

Etiquetas: jpgraph, sql
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 20:25.