Skip to main content
added 414 characters in body
Source Link
n3utrino
  • 1.2k
  • 1
  • 9
  • 16

Update: Found a solution! Using chrome developer tools, I've found that the problem is hardcoding src files in /Applications/blahblah. It's looking for the files in localhost/Applications/blahblah. For now, I've copied the .js files it needed in a subdirectory to /Library/WebServer/Documents/ (where localhost seems to start from on my machine) and coded a path to there. Thanks for the help!


Newbie to PHP here. Can't find my answer with some thorough googling and lots of trying to debug myself.

Newbie to PHP here. Can't find my answer with some thorough googling and lots of trying to debug myself.

Update: Found a solution! Using chrome developer tools, I've found that the problem is hardcoding src files in /Applications/blahblah. It's looking for the files in localhost/Applications/blahblah. For now, I've copied the .js files it needed in a subdirectory to /Library/WebServer/Documents/ (where localhost seems to start from on my machine) and coded a path to there. Thanks for the help!


Newbie to PHP here. Can't find my answer with some thorough googling and lots of trying to debug myself.

added 2 characters in body
Source Link
n3utrino
  • 1.2k
  • 1
  • 9
  • 16

GenHCSplineIrregTime.php: <?php

<?php

class GenHCSplineIrregTime
{
    public function __construct()
    {
        ;
    }
    
    public function __destruct()
    {
        ;
    }
        
    public function genWeb()
    {
        return $this->genEntireHTMLFile();
    }
        
    private function genEntireHTMLFile()
    {        
        $cont="";
        // $cont = $cont . "<!DOCTYPE HTML>\n";
        $cont = $cont . "<HTML>\n<head>\n";
        $cont = $cont . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
        $cont = $cont . "<title>This is my title</title>\n";
        $cont = $cont . "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>\n";
        $cont = $cont . "<style type=\"text/css\">\n\${demo.css}\n</style>\n";
        $cont = $cont . "<script type=\"text/javascript\">\n";
        $cont = $cont . "\$(function () {\n\n$('#container').highcharts({\nchart: {\ntype: 'spline'\n},\n title: {\ntext: 'BATTERY SHIT'\n},\nsubtitle: {\ntext: 'Irregular time data in Highcharts JS'\n},\n";
        $cont= $cont . "xAxis: {\ntype: 'datetime',\ndateTimeLabelFormats: {\nmonth: '%e. %b',\nyear: '%b'\n},\ntitle: {\ntext: 'Date'\n}\n},\n";
        $cont= $cont . "yAxis: {\ntitle: {\ntext: 'Snow depth (m)'\n},\nmin: 0\n},\ntooltip: {\nheaderFormat: '<b>{series.name}</b><br>',\npointFormat: '{point.x:%e. %b}: {point.y:.2f} m'\n},\n";
        //data starts here
        $cont= $cont . "series: [{\nname: 'Winter 2007-2008',\ndata: [\n";
        $cont= $cont . "[Date.UTC(1970,  9, 27), 0   ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 10), 0.6 ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 18), 0.7 ]\n]\n}]\n";
        $cont= $cont . "});\n});\n";

        $cont= $cont . "</script>\n</head>\n<body>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/highcharts.js\"></script>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/modules/exporting.js\"></script>\n";
        $cont= $cont . "<div id=\"container\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>\n";
        $cont= $cont . "</body>\n</html>\n";

        return $cont;
    }

    private function fetchData()
    {
        $data="";

        return $data;
    }

}
?>

GenHCSplineIrregTime.php: <?php

class GenHCSplineIrregTime
{
    public function __construct()
    {
        ;
    }
    
    public function __destruct()
    {
        ;
    }
        
    public function genWeb()
    {
        return $this->genEntireHTMLFile();
    }
        
    private function genEntireHTMLFile()
    {        
        $cont="";
        // $cont = $cont . "<!DOCTYPE HTML>\n";
        $cont = $cont . "<HTML>\n<head>\n";
        $cont = $cont . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
        $cont = $cont . "<title>This is my title</title>\n";
        $cont = $cont . "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>\n";
        $cont = $cont . "<style type=\"text/css\">\n\${demo.css}\n</style>\n";
        $cont = $cont . "<script type=\"text/javascript\">\n";
        $cont = $cont . "\$(function () {\n\n$('#container').highcharts({\nchart: {\ntype: 'spline'\n},\n title: {\ntext: 'BATTERY SHIT'\n},\nsubtitle: {\ntext: 'Irregular time data in Highcharts JS'\n},\n";
        $cont= $cont . "xAxis: {\ntype: 'datetime',\ndateTimeLabelFormats: {\nmonth: '%e. %b',\nyear: '%b'\n},\ntitle: {\ntext: 'Date'\n}\n},\n";
        $cont= $cont . "yAxis: {\ntitle: {\ntext: 'Snow depth (m)'\n},\nmin: 0\n},\ntooltip: {\nheaderFormat: '<b>{series.name}</b><br>',\npointFormat: '{point.x:%e. %b}: {point.y:.2f} m'\n},\n";
        //data starts here
        $cont= $cont . "series: [{\nname: 'Winter 2007-2008',\ndata: [\n";
        $cont= $cont . "[Date.UTC(1970,  9, 27), 0   ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 10), 0.6 ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 18), 0.7 ]\n]\n}]\n";
        $cont= $cont . "});\n});\n";

        $cont= $cont . "</script>\n</head>\n<body>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/highcharts.js\"></script>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/modules/exporting.js\"></script>\n";
        $cont= $cont . "<div id=\"container\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>\n";
        $cont= $cont . "</body>\n</html>\n";

        return $cont;
    }

    private function fetchData()
    {
        $data="";

        return $data;
    }

}
?>

GenHCSplineIrregTime.php:

<?php

class GenHCSplineIrregTime
{
    public function __construct()
    {
        ;
    }
    
    public function __destruct()
    {
        ;
    }
        
    public function genWeb()
    {
        return $this->genEntireHTMLFile();
    }
        
    private function genEntireHTMLFile()
    {        
        $cont="";
        // $cont = $cont . "<!DOCTYPE HTML>\n";
        $cont = $cont . "<HTML>\n<head>\n";
        $cont = $cont . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
        $cont = $cont . "<title>This is my title</title>\n";
        $cont = $cont . "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>\n";
        $cont = $cont . "<style type=\"text/css\">\n\${demo.css}\n</style>\n";
        $cont = $cont . "<script type=\"text/javascript\">\n";
        $cont = $cont . "\$(function () {\n\n$('#container').highcharts({\nchart: {\ntype: 'spline'\n},\n title: {\ntext: 'BATTERY SHIT'\n},\nsubtitle: {\ntext: 'Irregular time data in Highcharts JS'\n},\n";
        $cont= $cont . "xAxis: {\ntype: 'datetime',\ndateTimeLabelFormats: {\nmonth: '%e. %b',\nyear: '%b'\n},\ntitle: {\ntext: 'Date'\n}\n},\n";
        $cont= $cont . "yAxis: {\ntitle: {\ntext: 'Snow depth (m)'\n},\nmin: 0\n},\ntooltip: {\nheaderFormat: '<b>{series.name}</b><br>',\npointFormat: '{point.x:%e. %b}: {point.y:.2f} m'\n},\n";
        //data starts here
        $cont= $cont . "series: [{\nname: 'Winter 2007-2008',\ndata: [\n";
        $cont= $cont . "[Date.UTC(1970,  9, 27), 0   ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 10), 0.6 ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 18), 0.7 ]\n]\n}]\n";
        $cont= $cont . "});\n});\n";

        $cont= $cont . "</script>\n</head>\n<body>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/highcharts.js\"></script>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/modules/exporting.js\"></script>\n";
        $cont= $cont . "<div id=\"container\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>\n";
        $cont= $cont . "</body>\n</html>\n";

        return $cont;
    }

    private function fetchData()
    {
        $data="";

        return $data;
    }

}
?>
added 423 characters in body
Source Link
n3utrino
  • 1.2k
  • 1
  • 9
  • 16

EDIT: Here's the code:

index.php:

<?php

function __autoload($class_name) 
{
  $source = '/Path/To/src/' . $class_name . '.php';
  if (file_exists($source)) require $source; 
  else throw new Exception('class "' . $class_name . '" source file not found. Failed to autoload...');
}

$myweb=new GenHCSplineIrregTime();

echo $myweb->genWeb();

?>

GenHCSplineIrregTime.php: <?php

class GenHCSplineIrregTime
{
    public function __construct()
    {
        ;
    }
    
    public function __destruct()
    {
        ;
    }
        
    public function genWeb()
    {
        return $this->genEntireHTMLFile();
    }
        
    private function genEntireHTMLFile()
    {        
        $cont="";
        // $cont = $cont . "<!DOCTYPE HTML>\n";
        $cont = $cont . "<HTML>\n<head>\n";
        $cont = $cont . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
        $cont = $cont . "<title>This is my title</title>\n";
        $cont = $cont . "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>\n";
        $cont = $cont . "<style type=\"text/css\">\n\${demo.css}\n</style>\n";
        $cont = $cont . "<script type=\"text/javascript\">\n";
        $cont = $cont . "\$(function () {\n\n$('#container').highcharts({\nchart: {\ntype: 'spline'\n},\n title: {\ntext: 'BATTERY SHIT'\n},\nsubtitle: {\ntext: 'Irregular time data in Highcharts JS'\n},\n";
        $cont= $cont . "xAxis: {\ntype: 'datetime',\ndateTimeLabelFormats: {\nmonth: '%e. %b',\nyear: '%b'\n},\ntitle: {\ntext: 'Date'\n}\n},\n";
        $cont= $cont . "yAxis: {\ntitle: {\ntext: 'Snow depth (m)'\n},\nmin: 0\n},\ntooltip: {\nheaderFormat: '<b>{series.name}</b><br>',\npointFormat: '{point.x:%e. %b}: {point.y:.2f} m'\n},\n";
        //data starts here
        $cont= $cont . "series: [{\nname: 'Winter 2007-2008',\ndata: [\n";
        $cont= $cont . "[Date.UTC(1970,  9, 27), 0   ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 10), 0.6 ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 18), 0.7 ]\n]\n}]\n";
        $cont= $cont . "});\n});\n";

        $cont= $cont . "</script>\n</head>\n<body>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/highcharts.js\"></script>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/modules/exporting.js\"></script>\n";
        $cont= $cont . "<div id=\"container\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>\n";
        $cont= $cont . "</body>\n</html>\n";

        return $cont;
    }

    private function fetchData()
    {
        $data="";

        return $data;
    }

}
?>

EDIT: Here's the code:

index.php:

<?php

function __autoload($class_name) 
{
  $source = '/Path/To/src/' . $class_name . '.php';
  if (file_exists($source)) require $source; 
  else throw new Exception('class "' . $class_name . '" source file not found. Failed to autoload...');
}

$myweb=new GenHCSplineIrregTime();

echo $myweb->genWeb();

?>

GenHCSplineIrregTime.php: <?php

class GenHCSplineIrregTime
{
    public function __construct()
    {
        ;
    }
    
    public function __destruct()
    {
        ;
    }
        
    public function genWeb()
    {
        return $this->genEntireHTMLFile();
    }
        
    private function genEntireHTMLFile()
    {        
        $cont="";
        // $cont = $cont . "<!DOCTYPE HTML>\n";
        $cont = $cont . "<HTML>\n<head>\n";
        $cont = $cont . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
        $cont = $cont . "<title>This is my title</title>\n";
        $cont = $cont . "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>\n";
        $cont = $cont . "<style type=\"text/css\">\n\${demo.css}\n</style>\n";
        $cont = $cont . "<script type=\"text/javascript\">\n";
        $cont = $cont . "\$(function () {\n\n$('#container').highcharts({\nchart: {\ntype: 'spline'\n},\n title: {\ntext: 'BATTERY SHIT'\n},\nsubtitle: {\ntext: 'Irregular time data in Highcharts JS'\n},\n";
        $cont= $cont . "xAxis: {\ntype: 'datetime',\ndateTimeLabelFormats: {\nmonth: '%e. %b',\nyear: '%b'\n},\ntitle: {\ntext: 'Date'\n}\n},\n";
        $cont= $cont . "yAxis: {\ntitle: {\ntext: 'Snow depth (m)'\n},\nmin: 0\n},\ntooltip: {\nheaderFormat: '<b>{series.name}</b><br>',\npointFormat: '{point.x:%e. %b}: {point.y:.2f} m'\n},\n";
        //data starts here
        $cont= $cont . "series: [{\nname: 'Winter 2007-2008',\ndata: [\n";
        $cont= $cont . "[Date.UTC(1970,  9, 27), 0   ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 10), 0.6 ],\n";
        $cont= $cont . "[Date.UTC(1970, 10, 18), 0.7 ]\n]\n}]\n";
        $cont= $cont . "});\n});\n";

        $cont= $cont . "</script>\n</head>\n<body>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/highcharts.js\"></script>\n";
        $cont= $cont . "<script src=\"/Applications/BasicSoftware/Highcharts-4.0.3/js/modules/exporting.js\"></script>\n";
        $cont= $cont . "<div id=\"container\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>\n";
        $cont= $cont . "</body>\n</html>\n";

        return $cont;
    }

    private function fetchData()
    {
        $data="";

        return $data;
    }

}
?>
Source Link
n3utrino
  • 1.2k
  • 1
  • 9
  • 16
Loading