mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 03:19:05 +02:00
- Update lang files (Pandora Console)
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@59 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f7ad7cae85
commit
90dd5ed9db
@ -961,11 +961,11 @@ while ($row=mysql_fetch_array($result)){
|
|||||||
|
|
||||||
<input type="text" name="other" size="5">
|
<input type="text" name="other" size="5">
|
||||||
|
|
||||||
<tr><td class="datos"><?php echo $lang_label["min"]." ".$lang_label["alerts"] ?>
|
<tr><td class="datos"><?php echo $lang_label["min_alerts"] ?>
|
||||||
<td class="datos">
|
<td class="datos">
|
||||||
<input type="text" name="min_alerts" size="5" value="<?php if (isset($alerta_min_alerts)) {echo$alerta_min_alerts;} ?>">
|
<input type="text" name="min_alerts" size="5" value="<?php if (isset($alerta_min_alerts)) {echo$alerta_min_alerts;} ?>">
|
||||||
|
|
||||||
<?php echo $lang_label["max"]." ".$lang_label["alerts"] ?>
|
<?php echo $lang_label["max_alerts"] ?>
|
||||||
|
|
||||||
<input type="text" name="max_alerts" size="5" value="<?php if (isset($alerta_max_alerts)) {echo $alerta_max_alerts;} ?>">
|
<input type="text" name="max_alerts" size="5" value="<?php if (isset($alerta_max_alerts)) {echo $alerta_max_alerts;} ?>">
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
// Raul Mateos <raulofpandora@gmail.com>, 2004-2006
|
// Raul Mateos <raulofpandora@gmail.com>, 2004-2006
|
||||||
// David Muniz , 2005-2006
|
// David Muniz , 2005-2006
|
||||||
|
|
||||||
$lang_label["view_agents"]="Agüeyar axentes";
|
$lang_label["view_agents"]="Agüeyar axentes";
|
||||||
$lang_label["manage_incidents"]="Xestión d'incidentes";
|
$lang_label["manage_incidents"]="Xestión d'incidentes";
|
||||||
$lang_label["view_users"]="Agüeyar usuarios";
|
$lang_label["view_users"]="Agüeyar usuarios";
|
||||||
$lang_label["new_incident"]="Nuevu incidente";
|
$lang_label["new_incident"]="Nuevu incidente";
|
||||||
$lang_label["search_incident"]="Buscar incidente";
|
$lang_label["search_incident"]="Buscar incidente";
|
||||||
$lang_label["index_myuser"]="Editar mi usuariu";
|
$lang_label["index_myuser"]="Editar mi usuariu";
|
||||||
@ -201,7 +201,7 @@ $lang_label["db_stat_agent"]="Estadístiques de la Base de Datos per axent
|
|||||||
$lang_label["configure"]="Configurar";
|
$lang_label["configure"]="Configurar";
|
||||||
$lang_label["event_main_view"]="Vista principal d'eventos";
|
$lang_label["event_main_view"]="Vista principal d'eventos";
|
||||||
$lang_label["event_name"]="Nome del eventu";
|
$lang_label["event_name"]="Nome del eventu";
|
||||||
$lang_label["view_events"]="Agüeyar eventos";
|
$lang_label["view_events"]="Agüeyar eventos";
|
||||||
$lang_label["timestamp"]="Fecha/Hora";
|
$lang_label["timestamp"]="Fecha/Hora";
|
||||||
$lang_label["links_header"]="Enllaces";
|
$lang_label["links_header"]="Enllaces";
|
||||||
$lang_label["godmode_header"]="Alministración";
|
$lang_label["godmode_header"]="Alministración";
|
||||||
@ -247,8 +247,8 @@ $lang_label["add"]="Añadir";
|
|||||||
$lang_label["db_purge_event"]="Llimpieza de la Base de Datos d'eventos";
|
$lang_label["db_purge_event"]="Llimpieza de la Base de Datos d'eventos";
|
||||||
$lang_label["db_event"]="BD de eventos";
|
$lang_label["db_event"]="BD de eventos";
|
||||||
$lang_label["max_min"]="Max/Min";
|
$lang_label["max_min"]="Max/Min";
|
||||||
$lang_label["max"]="Máximo";
|
$lang_label["max"]="Máximo";
|
||||||
$lang_label["min"]="Mínimo";
|
$lang_label["min"]="Mínimo";
|
||||||
$lang_label["med"]="Media";
|
$lang_label["med"]="Media";
|
||||||
$lang_label["month_graph"]="Gráficu mensual";
|
$lang_label["month_graph"]="Gráficu mensual";
|
||||||
$lang_label["week_graph"]="Gráficu selmanal";
|
$lang_label["week_graph"]="Gráficu selmanal";
|
||||||
@ -301,9 +301,9 @@ $lang_label["manage_config"]="Xestionar conf.";
|
|||||||
$lang_label["config_manage"]="Xestión de Configuraciones";
|
$lang_label["config_manage"]="Xestión de Configuraciones";
|
||||||
$lang_label["get_info"]="Obtener info.";
|
$lang_label["get_info"]="Obtener info.";
|
||||||
$lang_label["are_you_sure"]="¿Ta usté seguru?";
|
$lang_label["are_you_sure"]="¿Ta usté seguru?";
|
||||||
$lang_label["users_msg"]="Los perfiles d'usuariu en Pandora definen que usuarios puen aceder a Pandora y que puen facer cada unu. Los grupos definen ellementos en común, cada usuariu pue pertenecer a unu o más grupos, y tien asignáu un perfil a cada grupu que pertenezca. Un perfil ye una llista de lo que pue y nun pue facer cada grupu, como per exemplu «agüeyar incidentes» o «xestionar bases de datos». Abaxu se muestra una llista de los perfiles disponibles (definíos por los alministraores llocales de Pandora)";
|
$lang_label["users_msg"]="Los perfiles d'usuariu en Pandora definen que usuarios puen aceder a Pandora y que puen facer cada unu. Los grupos definen ellementos en común, cada usuariu pue pertenecer a unu o más grupos, y tien asignáu un perfil a cada grupu que pertenezca. Un perfil ye una llista de lo que pue y nun pue facer cada grupu, como per exemplu «agüeyar incidentes» o «xestionar bases de datos». Abaxu se muestra una llista de los perfiles disponibles (definíos por los alministraores llocales de Pandora)";
|
||||||
$help_label["users_msg1"]="Esti usuariu ye especial y tien permisu pa tou, pasando per encima de los privilexios asignados mediante grupos/perfiles";
|
$help_label["users_msg1"]="Esti usuariu ye especial y tien permisu pa tou, pasando per encima de los privilexios asignados mediante grupos/perfiles";
|
||||||
$help_label["users_msg2"]="Esti usuariu tien permisos segregaos pa agüeyar datos en los axentes de su grupu, crear incidentes dientru d'aquellos grupos sobre los que tenga acceso y añadir notes en incidentes o de terceros.";
|
$help_label["users_msg2"]="Esti usuariu tien permisos segregaos pa agüeyar datos en los axentes de su grupu, crear incidentes dientru d'aquellos grupos sobre los que tenga acceso y añadir notes en incidentes o de terceros.";
|
||||||
$help_label["db_purge1"]="Esti botón resfresca la información sobre el usu de la Base de Datos a lo llargu del tiempu";
|
$help_label["db_purge1"]="Esti botón resfresca la información sobre el usu de la Base de Datos a lo llargu del tiempu";
|
||||||
$help_label["db_purge0"]="Use esti control pa selecionar un axente. Ye necesariu selecionar un axente tantu pa obtener información de la Base de Datos como pa borrar datos de la misma";
|
$help_label["db_purge0"]="Use esti control pa selecionar un axente. Ye necesariu selecionar un axente tantu pa obtener información de la Base de Datos como pa borrar datos de la misma";
|
||||||
$lang_label["profiles"]="Perfiles";
|
$lang_label["profiles"]="Perfiles";
|
||||||
@ -314,7 +314,7 @@ $lang_label["create_profile"]="Crear perfil";
|
|||||||
$lang_label["profile_name"]="Nome del perfil";
|
$lang_label["profile_name"]="Nome del perfil";
|
||||||
$lang_label["pandora_management"]="Xestión de Pandora";
|
$lang_label["pandora_management"]="Xestión de Pandora";
|
||||||
$lang_label["manage_db"]="Xestión de BD";
|
$lang_label["manage_db"]="Xestión de BD";
|
||||||
$lang_label["incident_view"]="Agüeyar incidentes";
|
$lang_label["incident_view"]="Agüeyar incidentes";
|
||||||
$lang_label["incident_edit"]="Editar incidentes";
|
$lang_label["incident_edit"]="Editar incidentes";
|
||||||
$lang_label["agent_edit"]="Editar axentes";
|
$lang_label["agent_edit"]="Editar axentes";
|
||||||
$lang_label["alert_edit"]="Editar alertes";
|
$lang_label["alert_edit"]="Editar alertes";
|
||||||
@ -368,7 +368,7 @@ $lang_label["statistics"]="Estadístiques";
|
|||||||
$lang_label["incident_priority"]="Prioridaes de los incidentes";
|
$lang_label["incident_priority"]="Prioridaes de los incidentes";
|
||||||
$lang_label["copy"]="Copiar";
|
$lang_label["copy"]="Copiar";
|
||||||
$lang_label["choose_agent"]="Escoxa axente";
|
$lang_label["choose_agent"]="Escoxa axente";
|
||||||
$lang_label["press_db_info"]="Pulse equí pa agüeyar información de la BD como texto";
|
$lang_label["press_db_info"]="Pulse equí pa agüeyar información de la BD como texto";
|
||||||
$lang_label["event_statistics"]="Estadístiques de eventos";
|
$lang_label["event_statistics"]="Estadístiques de eventos";
|
||||||
$lang_label["deletedata"]="Borrar datos";
|
$lang_label["deletedata"]="Borrar datos";
|
||||||
$lang_label["source"]="Orixen";
|
$lang_label["source"]="Orixen";
|
||||||
@ -554,5 +554,4 @@ $lang_label["graph_order"]="Orden del gráficu";
|
|||||||
$lang_label["truetype"]="Fontes truetype";
|
$lang_label["truetype"]="Fontes truetype";
|
||||||
$lang_label["right_left"]="dre. a manz.";
|
$lang_label["right_left"]="dre. a manz.";
|
||||||
$lang_label["left_right"]="manz. a dre.";
|
$lang_label["left_right"]="manz. a dre.";
|
||||||
$lang_label["enabled"]="habilitáu";
|
|
||||||
?>
|
?>
|
@ -245,9 +245,9 @@ $lang_label["doit"]="Fes-ho!";
|
|||||||
$lang_label["add"]="Afegeix";
|
$lang_label["add"]="Afegeix";
|
||||||
$lang_label["db_purge_event"]="Purgar la base de dades d'events";
|
$lang_label["db_purge_event"]="Purgar la base de dades d'events";
|
||||||
$lang_label["db_event"]="Event de la base de dades";
|
$lang_label["db_event"]="Event de la base de dades";
|
||||||
$lang_label["max_min"]="Max/Min";
|
$lang_label["max_min"]="Màx/Mín";
|
||||||
$lang_label["max"]="Màxim";
|
$lang_label["max"]="Màxim";
|
||||||
$lang_label["min"]="Mínim";
|
$lang_label["min"]="Mínim";
|
||||||
$lang_label["med"]="Mitjana";
|
$lang_label["med"]="Mitjana";
|
||||||
$lang_label["month_graph"]="Gràfica mensual";
|
$lang_label["month_graph"]="Gràfica mensual";
|
||||||
$lang_label["week_graph"]="Gràfica setmanal";
|
$lang_label["week_graph"]="Gràfica setmanal";
|
||||||
|
File diff suppressed because one or more lines are too long
@ -116,7 +116,7 @@ $lang_label["description"] ="Descripción";
|
|||||||
$lang_label["last_fired"]="Lanzada por última vez";
|
$lang_label["last_fired"]="Lanzada por última vez";
|
||||||
$lang_label["type"]="Tipo";
|
$lang_label["type"]="Tipo";
|
||||||
$lang_label["last_contact"]="Último contacto";
|
$lang_label["last_contact"]="Último contacto";
|
||||||
$lang_label["last_data_chunk"]="Contenido de los ultimos paquetes enviado por el agente : ";
|
$lang_label["last_data_chunk"]="Contenido de los últimos paquetes enviados por el agente: ";
|
||||||
$lang_label["graph"]="Gráfica";
|
$lang_label["graph"]="Gráfica";
|
||||||
$lang_label["raw_data"]="Datos";
|
$lang_label["raw_data"]="Datos";
|
||||||
$lang_label["data"]="Datos";
|
$lang_label["data"]="Datos";
|
||||||
@ -283,8 +283,8 @@ $lang_label["add"]="Añadir";
|
|||||||
$lang_label["db_purge_event"]="Limpieza de la Base de Datos de eventos";
|
$lang_label["db_purge_event"]="Limpieza de la Base de Datos de eventos";
|
||||||
$lang_label["db_event"]="BBDD de eventos";
|
$lang_label["db_event"]="BBDD de eventos";
|
||||||
$lang_label["max_min"]="Máx/Mín";
|
$lang_label["max_min"]="Máx/Mín";
|
||||||
$lang_label["max"]="Máximo";
|
$lang_label["max"]="Máximo";
|
||||||
$lang_label["min"]="Mínimo";
|
$lang_label["min"]="Mínimo";
|
||||||
$lang_label["med"]="Media";
|
$lang_label["med"]="Media";
|
||||||
$lang_label["month_graph"]="Gráfica mensual";
|
$lang_label["month_graph"]="Gráfica mensual";
|
||||||
$lang_label["week_graph"]="Gráfica semanal";
|
$lang_label["week_graph"]="Gráfica semanal";
|
||||||
@ -615,8 +615,6 @@ $lang_label["graph_order"]="Orden del gráfico";
|
|||||||
$lang_label["truetype"]="Fuentes truetype";
|
$lang_label["truetype"]="Fuentes truetype";
|
||||||
$lang_label["right_left"]="der. a izq.";
|
$lang_label["right_left"]="der. a izq.";
|
||||||
$lang_label["left_right"]="izq. a der.";
|
$lang_label["left_right"]="izq. a der.";
|
||||||
$lang_label["enabled"]="habilitado";
|
|
||||||
$lang_label["disabled"]="deshabilitado";
|
|
||||||
|
|
||||||
global $lang_label;
|
global $lang_label;
|
||||||
global $help_label;
|
global $help_label;
|
||||||
|
@ -609,14 +609,12 @@ $lang_label["del_server_ok"]="Serveur éliminé avec succès";
|
|||||||
$lang_label["del_server_no"]=" Pandora a rencontré un problème pour éliminer le serveur ";
|
$lang_label["del_server_no"]=" Pandora a rencontré un problème pour éliminer le serveur ";
|
||||||
$lang_label["groups"]="groupes";
|
$lang_label["groups"]="groupes";
|
||||||
$lang_label["other"]="Autre";
|
$lang_label["other"]="Autre";
|
||||||
$lang_label["icon"]="Icône";
|
$lang_label["icon"]="Icône";
|
||||||
$lang_label["agent_exists"]="Cet agent existe déjà";
|
$lang_label["agent_exists"]="Cet agent existe déjà";
|
||||||
$lang_label["graph_order"]="Ordre du tableau";
|
$lang_label["graph_order"]="Ordre du tableau";
|
||||||
$lang_label["truetype"]="Polices truetype";
|
$lang_label["truetype"]="Polices truetype";
|
||||||
$lang_label["right_left"]="dr. a gau.";
|
$lang_label["right_left"]="dr. a gau.";
|
||||||
$lang_label["left_right"]="gau. a dr.";
|
$lang_label["left_right"]="gau. a dr.";
|
||||||
$lang_label["enabled"]="habilité";
|
|
||||||
$lang_label["disabled"]="deshabilité";
|
|
||||||
|
|
||||||
global $lang_label;
|
global $lang_label;
|
||||||
global $help_label;
|
global $help_label;
|
||||||
|
@ -249,9 +249,9 @@ $lang_label["add"] = "Adicionar";
|
|||||||
$lang_label["db_purge_event"] = "Limpeza da Base de Dados de eventos";
|
$lang_label["db_purge_event"] = "Limpeza da Base de Dados de eventos";
|
||||||
$lang_label["db_event"] = "BD de eventos";
|
$lang_label["db_event"] = "BD de eventos";
|
||||||
$lang_label["max_min"] = "Máx/Mín";
|
$lang_label["max_min"] = "Máx/Mín";
|
||||||
$lang_label["max"] = "Máximo";
|
$lang_label["max"] = "Máximo";
|
||||||
$lang_label["min"] = "Mínimo";
|
$lang_label["min"] = "Mínimo";
|
||||||
$lang_label["med"] = "Média";
|
$lang_label["med"] = "Média";
|
||||||
$lang_label["month_graph"] = "Gráfico mensal";
|
$lang_label["month_graph"] = "Gráfico mensal";
|
||||||
$lang_label["week_graph"] = "Gráfico Semanal";
|
$lang_label["week_graph"] = "Gráfico Semanal";
|
||||||
$lang_label["day_graph"] = "Gráfico Diário";
|
$lang_label["day_graph"] = "Gráfico Diário";
|
||||||
@ -554,8 +554,8 @@ $lang_label["icon"] = "ícone";
|
|||||||
$lang_label["agent_exists"] = "O agente já existe";
|
$lang_label["agent_exists"] = "O agente já existe";
|
||||||
$lang_label["graph_order"] = "Ordem do gráfico";
|
$lang_label["graph_order"] = "Ordem do gráfico";
|
||||||
$lang_label["truetype"] = "Fontes truetype";
|
$lang_label["truetype"] = "Fontes truetype";
|
||||||
$lang_label["right_left"]="Dir. à Esq."; // direita à esquerda
|
$lang_label["right_left"]="Dir. à Esq."; // direita à esquerda
|
||||||
$lang_label["left_right"]="Esq. à Dir."; // esquerda à direita
|
$lang_label["left_right"]="Esq. à Dir."; // esquerda à direita
|
||||||
|
|
||||||
global $lang_label;
|
global $lang_label;
|
||||||
global $help_label;
|
global $help_label;
|
||||||
|
@ -4,51 +4,49 @@
|
|||||||
// Description: Base64 encoded images for small round markers
|
// Description: Base64 encoded images for small round markers
|
||||||
// Created: 2003-03-20
|
// Created: 2003-03-20
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: imgdata_balls.inc 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: imgdata_balls.inc 20 2005-05-30 20:34:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
class ImgData_Balls extends ImgData {
|
class ImgData_Balls extends ImgData {
|
||||||
var $name = 'Round Balls';
|
protected $name = 'Round Balls';
|
||||||
var $an = array(MARK_IMG_LBALL => 'imgdata_large',
|
protected $an = array(MARK_IMG_LBALL => 'imgdata_large',
|
||||||
MARK_IMG_MBALL => 'imgdata_small',
|
MARK_IMG_MBALL => 'imgdata_small',
|
||||||
MARK_IMG_SBALL => 'imgdata_xsmall',
|
MARK_IMG_SBALL => 'imgdata_xsmall',
|
||||||
MARK_IMG_BALL => 'imgdata_xsmall');
|
MARK_IMG_BALL => 'imgdata_xsmall');
|
||||||
var $colors_1 = array('blue','lightblue','brown','darkgreen',
|
protected $colors,$index,$maxidx;
|
||||||
|
private $colors_1 = array('blue','lightblue','brown','darkgreen',
|
||||||
'green','purple','red','gray','yellow','silver','gray');
|
'green','purple','red','gray','yellow','silver','gray');
|
||||||
var $index_1 = array('blue'=>9,'lightblue'=>1,'brown'=>6,'darkgreen'=>7,
|
private $index_1 = array('blue'=>9,'lightblue'=>1,'brown'=>6,'darkgreen'=>7,
|
||||||
'green'=>8,'purple'=>4,'red'=>0,'gray'=>5,'silver'=>3,'yellow'=>2);
|
'green'=>8,'purple'=>4,'red'=>0,'gray'=>5,'silver'=>3,'yellow'=>2);
|
||||||
var $maxidx_1 = 9 ;
|
private $maxidx_1 = 9 ;
|
||||||
|
|
||||||
var $colors_2 = array('blue','bluegreen','brown','cyan',
|
private $colors_2 = array('blue','bluegreen','brown','cyan',
|
||||||
'darkgray','greengray','gray','green',
|
'darkgray','greengray','gray','green',
|
||||||
'greenblue','lightblue','lightred',
|
'greenblue','lightblue','lightred',
|
||||||
'purple','red','white','yellow');
|
'purple','red','white','yellow');
|
||||||
|
|
||||||
|
|
||||||
var $index_2 = array('blue'=>9,'bluegreen'=>13,'brown'=>8,'cyan'=>12,
|
private $index_2 = array('blue'=>9,'bluegreen'=>13,'brown'=>8,'cyan'=>12,
|
||||||
'darkgray'=>5,'greengray'=>6,'gray'=>2,'green'=>10,
|
'darkgray'=>5,'greengray'=>6,'gray'=>2,'green'=>10,
|
||||||
'greenblue'=>3,'lightblue'=>1,'lightred'=>14,
|
'greenblue'=>3,'lightblue'=>1,'lightred'=>14,
|
||||||
'purple'=>7,'red'=>0,'white'=>11,'yellow'=>4);
|
'purple'=>7,'red'=>0,'white'=>11,'yellow'=>4);
|
||||||
|
|
||||||
var $maxidx_2 = 14 ;
|
private $maxidx_2 = 14 ;
|
||||||
|
|
||||||
|
|
||||||
var $colors_3 = array('bluegreen','cyan','darkgray','greengray',
|
private $colors_3 = array('bluegreen','cyan','darkgray','greengray',
|
||||||
'gray','graypurple','green','greenblue','lightblue',
|
'gray','graypurple','green','greenblue','lightblue',
|
||||||
'lightred','navy','orange','purple','red','yellow');
|
'lightred','navy','orange','purple','red','yellow');
|
||||||
|
|
||||||
var $index_3 = array('bluegreen'=>1,'cyan'=>11,'darkgray'=>14,'greengray'=>10,
|
private $index_3 = array('bluegreen'=>1,'cyan'=>11,'darkgray'=>14,'greengray'=>10,
|
||||||
'gray'=>3,'graypurple'=>4,'green'=>9,'greenblue'=>7,
|
'gray'=>3,'graypurple'=>4,'green'=>9,'greenblue'=>7,
|
||||||
'lightblue'=>13,'lightred'=>0,'navy'=>2,'orange'=>12,
|
'lightblue'=>13,'lightred'=>0,'navy'=>2,'orange'=>12,
|
||||||
'purple'=>8,'red'=>5,'yellow'=>6);
|
'purple'=>8,'red'=>5,'yellow'=>6);
|
||||||
var $maxidx_3 = 14 ;
|
private $maxidx_3 = 14 ;
|
||||||
|
|
||||||
var $colors,$index,$maxidx;
|
protected $imgdata_large, $imgdata_small, $imgdata_xsmall ;
|
||||||
var $imgdata_large ;
|
|
||||||
var $imgdata_small ;
|
|
||||||
var $imgdata_xsmall ;
|
|
||||||
|
|
||||||
|
|
||||||
function GetImg($aMark,$aIdx) {
|
function GetImg($aMark,$aIdx) {
|
||||||
|
@ -4,20 +4,20 @@
|
|||||||
// Description: Base64 encoded images for round bevels
|
// Description: Base64 encoded images for round bevels
|
||||||
// Created: 2003-03-20
|
// Created: 2003-03-20
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: imgdata_bevels.inc 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: imgdata_bevels.inc 20 2005-05-30 20:34:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
class ImgData_Bevels extends ImgData {
|
class ImgData_Bevels extends ImgData {
|
||||||
var $name = 'Round Bevels';
|
protected $name = 'Round Bevels';
|
||||||
var $an = array(MARK_IMG_BEVEL => 'imgdata');
|
protected $an = array(MARK_IMG_BEVEL => 'imgdata');
|
||||||
|
|
||||||
var $colors = array('green','purple','orange','red','yellow');
|
protected $colors = array('green','purple','orange','red','yellow');
|
||||||
var $index = array('green'=>1,'purple'=>4,'orange'=>2,'red'=>0,'yellow'=>3);
|
protected $index = array('green'=>1,'purple'=>4,'orange'=>2,'red'=>0,'yellow'=>3);
|
||||||
var $maxidx = 4 ;
|
protected $maxidx = 4 ;
|
||||||
|
|
||||||
var $imgdata ;
|
protected $imgdata ;
|
||||||
|
|
||||||
function ImgData_Bevels() {
|
function ImgData_Bevels() {
|
||||||
//==========================================================
|
//==========================================================
|
||||||
|
@ -4,21 +4,21 @@
|
|||||||
// Description: Base64 encoded images for diamonds
|
// Description: Base64 encoded images for diamonds
|
||||||
// Created: 2003-03-20
|
// Created: 2003-03-20
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: imgdata_diamonds.inc 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: imgdata_diamonds.inc 20 2005-05-30 20:34:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
class ImgData_Diamonds extends ImgData {
|
class ImgData_Diamonds extends ImgData {
|
||||||
var $name = 'Diamonds';
|
protected $name = 'Diamonds';
|
||||||
var $an = array(MARK_IMG_DIAMOND =>'imgdata');
|
protected $an = array(MARK_IMG_DIAMOND =>'imgdata');
|
||||||
var $colors = array('lightblue','darkblue','gray',
|
protected $colors = array('lightblue','darkblue','gray',
|
||||||
'blue','pink','purple','red','yellow');
|
'blue','pink','purple','red','yellow');
|
||||||
var $index = array('lightblue' =>7,'darkblue'=>2,'gray'=>6,
|
protected $index = array('lightblue' =>7,'darkblue'=>2,'gray'=>6,
|
||||||
'blue'=>4,'pink'=>1,'purple'=>5,'red'=>0,'yellow'=>3);
|
'blue'=>4,'pink'=>1,'purple'=>5,'red'=>0,'yellow'=>3);
|
||||||
|
|
||||||
var $maxidx = 7 ;
|
protected $maxidx = 7 ;
|
||||||
var $imgdata ;
|
protected $imgdata ;
|
||||||
|
|
||||||
function ImgData_Diamonds() {
|
function ImgData_Diamonds() {
|
||||||
//==========================================================
|
//==========================================================
|
||||||
|
@ -4,21 +4,21 @@
|
|||||||
// Description: Base64 encoded images for pushpins
|
// Description: Base64 encoded images for pushpins
|
||||||
// Created: 2003-03-20
|
// Created: 2003-03-20
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: imgdata_pushpins.inc 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: imgdata_pushpins.inc 20 2005-05-30 20:34:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
class ImgData_PushPins extends ImgData {
|
class ImgData_PushPins extends ImgData {
|
||||||
var $name = 'Push pins';
|
protected $name = 'Push pins';
|
||||||
var $an = array(MARK_IMG_PUSHPIN => 'imgdata_small',
|
protected $an = array(MARK_IMG_PUSHPIN => 'imgdata_small',
|
||||||
MARK_IMG_SPUSHPIN => 'imgdata_small',
|
MARK_IMG_SPUSHPIN => 'imgdata_small',
|
||||||
MARK_IMG_LPUSHPIN => 'imgdata_large');
|
MARK_IMG_LPUSHPIN => 'imgdata_large');
|
||||||
|
|
||||||
var $colors = array('blue','green','orange','pink','red');
|
protected $colors = array('blue','green','orange','pink','red');
|
||||||
var $index = array('red' => 0, 'orange' => 1, 'pink' => 2, 'blue' => 3, 'green' => 4 ) ;
|
protected $index = array('red' => 0, 'orange' => 1, 'pink' => 2, 'blue' => 3, 'green' => 4 ) ;
|
||||||
var $maxidx = 4 ;
|
protected $maxidx = 4 ;
|
||||||
var $imgdata_large, $imgdata_small ;
|
protected $imgdata_large, $imgdata_small ;
|
||||||
|
|
||||||
function ImgData_PushPins() {
|
function ImgData_PushPins() {
|
||||||
|
|
||||||
|
@ -4,21 +4,21 @@
|
|||||||
// Description: Base64 encoded images for squares
|
// Description: Base64 encoded images for squares
|
||||||
// Created: 2003-03-20
|
// Created: 2003-03-20
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: imgdata_squares.inc 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: imgdata_squares.inc 20 2005-05-30 20:34:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
class ImgData_Squares extends ImgData {
|
class ImgData_Squares extends ImgData {
|
||||||
var $name = 'Squares';
|
protected $name = 'Squares';
|
||||||
var $an = array(MARK_IMG_SQUARE =>'imgdata');
|
protected $an = array(MARK_IMG_SQUARE =>'imgdata');
|
||||||
|
|
||||||
var $colors = array('bluegreen','blue','green',
|
protected $colors = array('bluegreen','blue','green',
|
||||||
'lightblue','orange','purple','red','yellow');
|
'lightblue','orange','purple','red','yellow');
|
||||||
var $index = array('bluegreen' =>2,'blue'=>5,'green'=>6,
|
protected $index = array('bluegreen' =>2,'blue'=>5,'green'=>6,
|
||||||
'lightblue'=>0,'orange'=>7,'purple'=>4,'red'=>3,'yellow'=>1);
|
'lightblue'=>0,'orange'=>7,'purple'=>4,'red'=>3,'yellow'=>1);
|
||||||
var $maxidx = 7 ;
|
protected $maxidx = 7 ;
|
||||||
var $imgdata ;
|
protected $imgdata ;
|
||||||
|
|
||||||
function ImgData_Squares () {
|
function ImgData_Squares () {
|
||||||
//==========================================================
|
//==========================================================
|
||||||
|
@ -4,21 +4,21 @@
|
|||||||
// Description: Base64 encoded images for stars
|
// Description: Base64 encoded images for stars
|
||||||
// Created: 2003-03-20
|
// Created: 2003-03-20
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: imgdata_stars.inc 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: imgdata_stars.inc 20 2005-05-30 20:34:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
|
|
||||||
class ImgData_Stars extends ImgData {
|
class ImgData_Stars extends ImgData {
|
||||||
var $name = 'Stars';
|
protected $name = 'Stars';
|
||||||
var $an = array(MARK_IMG_STAR => 'imgdata');
|
protected $an = array(MARK_IMG_STAR => 'imgdata');
|
||||||
|
|
||||||
var $colors = array('bluegreen','lightblue','purple','blue','green','pink','red','yellow');
|
protected $colors = array('bluegreen','lightblue','purple','blue','green','pink','red','yellow');
|
||||||
var $index = array('bluegreen'=>3,'lightblue'=>4,'purple'=>1,
|
protected $index = array('bluegreen'=>3,'lightblue'=>4,'purple'=>1,
|
||||||
'blue'=>5,'green'=>0,'pink'=>7,'red'=>2,'yellow'=>6);
|
'blue'=>5,'green'=>0,'pink'=>7,'red'=>2,'yellow'=>6);
|
||||||
var $maxidx = 7 ;
|
protected $maxidx = 7 ;
|
||||||
var $imgdata ;
|
protected $imgdata ;
|
||||||
|
|
||||||
function ImgData_Stars() {
|
function ImgData_Stars() {
|
||||||
//==========================================================
|
//==========================================================
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,14 +4,15 @@
|
|||||||
// Description: Genarate anti-spam challenge
|
// Description: Genarate anti-spam challenge
|
||||||
// Created: 2004-10-07
|
// Created: 2004-10-07
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_antispam-digits.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_antispam-digits.php 629 2006-05-26 00:05:28Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
class HandDigits {
|
class HandDigits {
|
||||||
var $digits_thumb30x30 = array();
|
public $digits = array();
|
||||||
var $iHeight=30, $iWidth=30;
|
public $iHeight=30, $iWidth=30;
|
||||||
|
|
||||||
function HandDigits() {
|
function HandDigits() {
|
||||||
//==========================================================
|
//==========================================================
|
||||||
// d6-small.jpg
|
// d6-small.jpg
|
||||||
|
@ -4,14 +4,15 @@
|
|||||||
// Description: Genarate anti-spam challenge
|
// Description: Genarate anti-spam challenge
|
||||||
// Created: 2004-10-07
|
// Created: 2004-10-07
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_antispam.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_antispam.php 20 2005-05-30 20:34:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
class HandDigits {
|
class HandDigits {
|
||||||
var $chars = array();
|
public $chars = array();
|
||||||
var $iHeight=30, $iWidth=30;
|
public $iHeight=30, $iWidth=30;
|
||||||
|
|
||||||
function HandDigits() {
|
function HandDigits() {
|
||||||
|
|
||||||
//==========================================================
|
//==========================================================
|
||||||
@ -545,18 +546,14 @@ $this->chars['q'][1]=
|
|||||||
|
|
||||||
class AntiSpam {
|
class AntiSpam {
|
||||||
|
|
||||||
var $iData='';
|
private $iData='';
|
||||||
var $iDD=null;
|
private $iDD=null;
|
||||||
|
|
||||||
function AntiSpam($aData='') {
|
function AntiSpam($aData='') {
|
||||||
$this->iData = $aData;
|
$this->iData = $aData;
|
||||||
$this->iDD = new HandDigits();
|
$this->iDD = new HandDigits();
|
||||||
}
|
}
|
||||||
|
|
||||||
function Set($aData) {
|
|
||||||
$this->iData = $aData;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Rand($aLen) {
|
function Rand($aLen) {
|
||||||
$d='';
|
$d='';
|
||||||
for($i=0; $i < $aLen; ++$i) {
|
for($i=0; $i < $aLen; ++$i) {
|
||||||
@ -576,7 +573,7 @@ class AntiSpam {
|
|||||||
return $d;
|
return $d;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke($aStrokeFileName="") {
|
function Stroke() {
|
||||||
|
|
||||||
$n=strlen($this->iData);
|
$n=strlen($this->iData);
|
||||||
if( $n==0 ) {
|
if( $n==0 ) {
|
||||||
@ -606,19 +603,9 @@ class AntiSpam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
imagecopy($resimg,$img,2,2,0,0,$start, $this->iDD->iHeight);
|
imagecopy($resimg,$img,2,2,0,0,$start, $this->iDD->iHeight);
|
||||||
|
|
||||||
if( $aStrokeFileName!="" ) {
|
|
||||||
if( file_exists($aStrokeFileName) ) {
|
|
||||||
if( !@unlink($aStrokeFileName) )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
imagejpeg($resimg,$aStrokeFileName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Content-type: image/jpeg");
|
header("Content-type: image/jpeg");
|
||||||
$res=imagejpeg($resimg);
|
imagejpeg($resimg);
|
||||||
return $res;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Bar plot extension for JpGraph
|
// Description: Bar plot extension for JpGraph
|
||||||
// Created: 2001-01-08
|
// Created: 2001-01-08
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_bar.php 334 2005-12-15 22:34:17Z ljp $
|
// Ver: $Id: jpgraph_bar.php 634 2006-05-26 00:59:09Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -29,22 +29,22 @@ DEFINE('PATTERN_STRIPE2',10);
|
|||||||
// Description: Main code to produce a bar plot
|
// Description: Main code to produce a bar plot
|
||||||
//===================================================
|
//===================================================
|
||||||
class BarPlot extends Plot {
|
class BarPlot extends Plot {
|
||||||
var $width=0.4; // in percent of major ticks
|
public $fill=false,$fill_color="lightblue"; // Default is to fill with light blue
|
||||||
var $abswidth=-1; // Width in absolute pixels
|
public $iPattern=-1,$iPatternDensity=80,$iPatternColor='black';
|
||||||
var $fill=false,$fill_color="lightblue"; // Default is to fill with light blue
|
public $valuepos='top';
|
||||||
var $ybase=0; // Bars start at 0
|
public $grad=false,$grad_style=1;
|
||||||
var $align="center";
|
public $grad_fromcolor=array(50,50,200),$grad_tocolor=array(255,255,255);
|
||||||
var $grad=false,$grad_style=1;
|
protected $width=0.4; // in percent of major ticks
|
||||||
var $grad_fromcolor=array(50,50,200),$grad_tocolor=array(255,255,255);
|
protected $abswidth=-1; // Width in absolute pixels
|
||||||
var $bar_shadow=false;
|
protected $ybase=0; // Bars start at 0
|
||||||
var $bar_shadow_color="black";
|
protected $align="center";
|
||||||
var $bar_shadow_hsize=3,$bar_shadow_vsize=3;
|
protected $bar_shadow=false;
|
||||||
var $valuepos='top';
|
protected $bar_shadow_color="black";
|
||||||
var $iPattern=-1,$iPatternDensity=80,$iPatternColor='black';
|
protected $bar_shadow_hsize=3,$bar_shadow_vsize=3;
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function BarPlot(&$datay,$datax=false) {
|
function BarPlot($datay,$datax=false) {
|
||||||
$this->Plot($datay,$datax);
|
$this->Plot($datay,$datax);
|
||||||
++$this->numpoints;
|
++$this->numpoints;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ class BarPlot extends Plot {
|
|||||||
$this->ybase=$aYStartValue;
|
$this->ybase=$aYStartValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Legend(&$graph) {
|
function Legend($graph) {
|
||||||
if( $this->grad && $this->legend!="" && !$this->fill ) {
|
if( $this->grad && $this->legend!="" && !$this->fill ) {
|
||||||
$color=array($this->grad_fromcolor,$this->grad_tocolor);
|
$color=array($this->grad_fromcolor,$this->grad_tocolor);
|
||||||
// In order to differentiate between gradients and cooors specified as an RGB triple
|
// In order to differentiate between gradients and cooors specified as an RGB triple
|
||||||
@ -110,11 +110,9 @@ class BarPlot extends Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gets called before any axis are stroked
|
// Gets called before any axis are stroked
|
||||||
function PreStrokeAdjust(&$graph) {
|
function PreStrokeAdjust($graph) {
|
||||||
parent::PreStrokeAdjust($graph);
|
parent::PreStrokeAdjust($graph);
|
||||||
|
|
||||||
$cn = strtolower(get_class($this));
|
|
||||||
|
|
||||||
// If we are using a log Y-scale we want the base to be at the
|
// If we are using a log Y-scale we want the base to be at the
|
||||||
// minimum Y-value unless the user have specifically set some other
|
// minimum Y-value unless the user have specifically set some other
|
||||||
// value than the default.
|
// value than the default.
|
||||||
@ -137,9 +135,8 @@ class BarPlot extends Plot {
|
|||||||
elseif( $this->align == "right" )
|
elseif( $this->align == "right" )
|
||||||
$graph->SetTextScaleOff(1-$this->width);
|
$graph->SetTextScaleOff(1-$this->width);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif( $cn !== 'accbarplot' && $cn !== 'groupbarplot') {
|
elseif( ($this instanceof AccBarPlot) || ($this instanceof GroupBarPlot) ) {
|
||||||
// We only set an absolute width for linear and int scale
|
// We only set an absolute width for linear and int scale
|
||||||
// for text scale the width will be set to a fraction of
|
// for text scale the width will be set to a fraction of
|
||||||
// the majstep width.
|
// the majstep width.
|
||||||
@ -166,8 +163,13 @@ class BarPlot extends Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Specify width as fractions of the major stepo size
|
// Specify width as fractions of the major stepo size
|
||||||
function SetWidth($aFractionWidth) {
|
function SetWidth($aWidth) {
|
||||||
$this->width=$aFractionWidth;
|
if( $aWidth > 1 ) {
|
||||||
|
// Interpret this as absolute width
|
||||||
|
$this->abswidth=$aWidth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->width=$aWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specify width in absolute pixels. If specified this
|
// Specify width in absolute pixels. If specified this
|
||||||
@ -264,18 +266,18 @@ class BarPlot extends Plot {
|
|||||||
break;
|
break;
|
||||||
case PATTERN_STRIPE1:
|
case PATTERN_STRIPE1:
|
||||||
$aPatternValue= 5;
|
$aPatternValue= 5;
|
||||||
$aDensity = 95;
|
$aDensity = 90;
|
||||||
break;
|
break;
|
||||||
case PATTERN_STRIPE2:
|
case PATTERN_STRIPE2:
|
||||||
$aPatternValue= 5;
|
$aPatternValue= 5;
|
||||||
$aDensity = 85;
|
$aDensity = 75;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise('Unknown pattern specified in call to BarPlot::SetPattern()');
|
JpGraphError::Raise('Unknown pattern specified in call to BarPlot::SetPattern()');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
|
|
||||||
$numpoints = count($this->coords[0]);
|
$numpoints = count($this->coords[0]);
|
||||||
if( isset($this->coords[1]) ) {
|
if( isset($this->coords[1]) ) {
|
||||||
@ -305,7 +307,7 @@ class BarPlot extends Plot {
|
|||||||
else
|
else
|
||||||
$abswidth=round($this->width*$xscale->scale_factor,0);
|
$abswidth=round($this->width*$xscale->scale_factor,0);
|
||||||
|
|
||||||
// Count potential pattern array to avoid doing the count for each iteration
|
// Count pontetial pattern array to avoid doing the count for each iteration
|
||||||
if( is_array($this->iPattern) ) {
|
if( is_array($this->iPattern) ) {
|
||||||
$np = count($this->iPattern);
|
$np = count($this->iPattern);
|
||||||
}
|
}
|
||||||
@ -331,7 +333,6 @@ class BarPlot extends Plot {
|
|||||||
elseif($this->align=="right")
|
elseif($this->align=="right")
|
||||||
$x -= $abswidth;
|
$x -= $abswidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
// Stroke fill color and fill gradient
|
// Stroke fill color and fill gradient
|
||||||
$pts=array(
|
$pts=array(
|
||||||
@ -511,7 +512,7 @@ class BarPlot extends Plot {
|
|||||||
}
|
}
|
||||||
if( !empty($this->csimtargets[$i]) ) {
|
if( !empty($this->csimtargets[$i]) ) {
|
||||||
$this->csimareas .= '<area shape="poly" coords="'.$csimcoord.'" ';
|
$this->csimareas .= '<area shape="poly" coords="'.$csimcoord.'" ';
|
||||||
$this->csimareas .= " href=\"".$this->csimtargets[$i]."\"";
|
$this->csimareas .= " href=\"".htmlentities($this->csimtargets[$i])."\"";
|
||||||
$sval='';
|
$sval='';
|
||||||
if( !empty($this->csimalts[$i]) ) {
|
if( !empty($this->csimalts[$i]) ) {
|
||||||
$sval=sprintf($this->csimalts[$i],$this->coords[0][$i]);
|
$sval=sprintf($this->csimalts[$i],$this->coords[0][$i]);
|
||||||
@ -529,13 +530,11 @@ class BarPlot extends Plot {
|
|||||||
// Description: Produce grouped bar plots
|
// Description: Produce grouped bar plots
|
||||||
//===================================================
|
//===================================================
|
||||||
class GroupBarPlot extends BarPlot {
|
class GroupBarPlot extends BarPlot {
|
||||||
var $plots;
|
private $plots, $nbrplots=0;
|
||||||
var $width=0.7;
|
|
||||||
var $nbrplots=0;
|
|
||||||
var $numpoints;
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function GroupBarPlot($plots) {
|
function GroupBarPlot($plots) {
|
||||||
|
$this->width=0.7;
|
||||||
$this->plots = $plots;
|
$this->plots = $plots;
|
||||||
$this->nbrplots = count($plots);
|
$this->nbrplots = count($plots);
|
||||||
if( $this->nbrplots < 1 ) {
|
if( $this->nbrplots < 1 ) {
|
||||||
@ -547,16 +546,16 @@ class GroupBarPlot extends BarPlot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->numpoints = $plots[0]->numpoints;
|
$this->numpoints = $plots[0]->numpoints;
|
||||||
|
$this->width=0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
function Legend(&$graph) {
|
function Legend($graph) {
|
||||||
$n = count($this->plots);
|
$n = count($this->plots);
|
||||||
for($i=0; $i < $n; ++$i) {
|
for($i=0; $i < $n; ++$i) {
|
||||||
$c = strtolower(get_class($this->plots[$i]));
|
$c = get_class($this->plots[$i]);
|
||||||
$sc = is_subclass_of($this->plots[$i],'BarPlot') || is_subclass_of($this->plots[$i],'barplot');
|
if( !($this->plots[$i] instanceof BarPlot) ) {
|
||||||
if( $c !== 'barplot' && !$sc ) {
|
|
||||||
JpGraphError::Raise('One of the objects submitted to GroupBar is not a BarPlot. Make sure that you create the Group Bar plot from an array of BarPlot or AccBarPlot objects. (Class = '.$c.')');
|
JpGraphError::Raise('One of the objects submitted to GroupBar is not a BarPlot. Make sure that you create the Group Bar plot from an array of BarPlot or AccBarPlot objects. (Class = '.$c.')');
|
||||||
}
|
}
|
||||||
$this->plots[$i]->DoLegend($graph);
|
$this->plots[$i]->DoLegend($graph);
|
||||||
@ -595,10 +594,11 @@ class GroupBarPlot extends BarPlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stroke all the bars next to each other
|
// Stroke all the bars next to each other
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
$tmp=$xscale->off;
|
$tmp=$xscale->off;
|
||||||
$n = count($this->plots);
|
$n = count($this->plots);
|
||||||
$subwidth = $this->width/$this->nbrplots ;
|
$subwidth = $this->width/$this->nbrplots ;
|
||||||
|
|
||||||
for( $i=0; $i < $n; ++$i ) {
|
for( $i=0; $i < $n; ++$i ) {
|
||||||
$this->plots[$i]->ymin=$this->ybase;
|
$this->plots[$i]->ymin=$this->ybase;
|
||||||
$this->plots[$i]->SetWidth($subwidth);
|
$this->plots[$i]->SetWidth($subwidth);
|
||||||
@ -608,8 +608,7 @@ class GroupBarPlot extends BarPlot {
|
|||||||
// If we assume it is always one the positioning will work
|
// If we assume it is always one the positioning will work
|
||||||
// fine with a text scale but this will not work with
|
// fine with a text scale but this will not work with
|
||||||
// arbitrary linear scale
|
// arbitrary linear scale
|
||||||
$xscale->off = $tmp+$i*round(/*$xscale->ticks->major_step* */
|
$xscale->off = $tmp+$i*round($xscale->scale_factor* $subwidth);
|
||||||
$xscale->scale_factor* $subwidth);
|
|
||||||
$this->plots[$i]->Stroke($img,$xscale,$yscale);
|
$this->plots[$i]->Stroke($img,$xscale,$yscale);
|
||||||
}
|
}
|
||||||
$xscale->off=$tmp;
|
$xscale->off=$tmp;
|
||||||
@ -621,7 +620,7 @@ class GroupBarPlot extends BarPlot {
|
|||||||
// Description: Produce accumulated bar plots
|
// Description: Produce accumulated bar plots
|
||||||
//===================================================
|
//===================================================
|
||||||
class AccBarPlot extends BarPlot {
|
class AccBarPlot extends BarPlot {
|
||||||
var $plots=null,$nbrplots=0,$numpoints=0;
|
private $plots=null,$nbrplots=0;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function AccBarPlot($plots) {
|
function AccBarPlot($plots) {
|
||||||
@ -641,11 +640,11 @@ class AccBarPlot extends BarPlot {
|
|||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
function Legend(&$graph) {
|
function Legend($graph) {
|
||||||
$n = count($this->plots);
|
$n = count($this->plots);
|
||||||
for( $i=$n-1; $i >= 0; --$i ) {
|
for( $i=$n-1; $i >= 0; --$i ) {
|
||||||
$c = strtolower(get_class($this->plots[$i]));
|
$c = get_class($this->plots[$i]);
|
||||||
if( $c !== 'barplot' ) {
|
if( !($this->plots[$i] instanceof BarPlot) ) {
|
||||||
JpGraphError::Raise('One of the objects submitted to AccBar is not a BarPlot. Make sure that you create the AccBar plot from an array of BarPlot objects.(Class='.$c.')');
|
JpGraphError::Raise('One of the objects submitted to AccBar is not a BarPlot. Make sure that you create the AccBar plot from an array of BarPlot objects.(Class='.$c.')');
|
||||||
}
|
}
|
||||||
$this->plots[$i]->DoLegend($graph);
|
$this->plots[$i]->DoLegend($graph);
|
||||||
@ -668,9 +667,15 @@ class AccBarPlot extends BarPlot {
|
|||||||
// individual plots max y-value since that
|
// individual plots max y-value since that
|
||||||
// would in most cases give to large y-value.
|
// would in most cases give to large y-value.
|
||||||
$y=0;
|
$y=0;
|
||||||
|
if( !isset($this->plots[0]->coords[0][$i]) ) {
|
||||||
|
JpGraphError::RaiseL(2014);
|
||||||
|
}
|
||||||
if( $this->plots[0]->coords[0][$i] > 0 )
|
if( $this->plots[0]->coords[0][$i] > 0 )
|
||||||
$y=$this->plots[0]->coords[0][$i];
|
$y=$this->plots[0]->coords[0][$i];
|
||||||
for( $j = 1; $j < $this->nbrplots; $j++ ) {
|
for( $j = 1; $j < $this->nbrplots; $j++ ) {
|
||||||
|
if( !isset($this->plots[$j]->coords[0][$i]) ) {
|
||||||
|
JpGraphError::RaiseL(2014);
|
||||||
|
}
|
||||||
if( $this->plots[$j]->coords[0][$i] > 0 )
|
if( $this->plots[$j]->coords[0][$i] > 0 )
|
||||||
$y += $this->plots[$j]->coords[0][$i];
|
$y += $this->plots[$j]->coords[0][$i];
|
||||||
}
|
}
|
||||||
@ -700,8 +705,11 @@ class AccBarPlot extends BarPlot {
|
|||||||
// It would be wrong to just add the
|
// It would be wrong to just add the
|
||||||
// individual plots max y-value since that
|
// individual plots max y-value since that
|
||||||
// would in most cases give to large y-value.
|
// would in most cases give to large y-value.
|
||||||
|
$y=0;
|
||||||
|
if( $this->plots[0]->coords[0][$i] < 0 )
|
||||||
$y=$this->plots[0]->coords[0][$i];
|
$y=$this->plots[0]->coords[0][$i];
|
||||||
for( $j = 1; $j < $this->nbrplots; $j++ ) {
|
for( $j = 1; $j < $this->nbrplots; $j++ ) {
|
||||||
|
if( $this->plots[$j]->coords[0][$i] < 0 )
|
||||||
$y += $this->plots[ $j ]->coords[0][$i];
|
$y += $this->plots[ $j ]->coords[0][$i];
|
||||||
}
|
}
|
||||||
$ymin[$i] = $y;
|
$ymin[$i] = $y;
|
||||||
@ -714,7 +722,7 @@ class AccBarPlot extends BarPlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stroke acc bar plot
|
// Stroke acc bar plot
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
$pattern=NULL;
|
$pattern=NULL;
|
||||||
$img->SetLineWeight($this->weight);
|
$img->SetLineWeight($this->weight);
|
||||||
for($i=0; $i < $this->numpoints-1; $i++) {
|
for($i=0; $i < $this->numpoints-1; $i++) {
|
||||||
@ -856,6 +864,7 @@ class AccBarPlot extends BarPlot {
|
|||||||
if( ! empty($this->plots[$j]->csimtargets[$i]) ) {
|
if( ! empty($this->plots[$j]->csimtargets[$i]) ) {
|
||||||
$this->csimareas.= '<area shape="poly" coords="'.$csimcoord.'" ';
|
$this->csimareas.= '<area shape="poly" coords="'.$csimcoord.'" ';
|
||||||
$this->csimareas.= " href=\"".$this->plots[$j]->csimtargets[$i]."\"";
|
$this->csimareas.= " href=\"".$this->plots[$j]->csimtargets[$i]."\"";
|
||||||
|
$sval='';
|
||||||
if( !empty($this->plots[$j]->csimalts[$i]) ) {
|
if( !empty($this->plots[$j]->csimalts[$i]) ) {
|
||||||
$sval=sprintf($this->plots[$j]->csimalts[$i],$this->plots[$j]->coords[0][$i]);
|
$sval=sprintf($this->plots[$j]->csimalts[$i],$this->plots[$j]->coords[0][$i]);
|
||||||
$this->csimareas .= " title=\"$sval\" ";
|
$this->csimareas .= " title=\"$sval\" ";
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Canvas drawing extension for JpGraph
|
// Description: Canvas drawing extension for JpGraph
|
||||||
// Created: 2001-01-08
|
// Created: 2001-01-08
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_canvas.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_canvas.php 626 2006-05-08 19:06:19Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -39,8 +39,30 @@ class CanvasGraph extends Graph {
|
|||||||
$this->texts[$i]->Stroke($this->img);
|
$this->texts[$i]->Stroke($this->img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( $this->iTables !== null ) {
|
||||||
|
for($i=0; $i < count($this->iTables); ++$i) {
|
||||||
|
$this->iTables[$i]->Stroke($this->img);
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->StrokeTitles();
|
$this->StrokeTitles();
|
||||||
|
|
||||||
|
// If the filename is the predefined value = '_csim_special_'
|
||||||
|
// we assume that the call to stroke only needs to do enough
|
||||||
|
// to correctly generate the CSIM maps.
|
||||||
|
// We use this variable to skip things we don't strictly need
|
||||||
|
// to do to generate the image map to improve performance
|
||||||
|
// a best we can. Therefor you will see a lot of tests !$_csim in the
|
||||||
|
// code below.
|
||||||
|
$_csim = ($aStrokeFileName===_CSIM_SPECIALFILE);
|
||||||
|
|
||||||
|
// We need to know if we have stroked the plot in the
|
||||||
|
// GetCSIMareas. Otherwise the CSIM hasn't been generated
|
||||||
|
// and in the case of GetCSIM called before stroke to generate
|
||||||
|
// CSIM without storing an image to disk GetCSIM must call Stroke.
|
||||||
|
$this->iHasStroked = true;
|
||||||
|
|
||||||
|
if( !$_csim ) {
|
||||||
|
|
||||||
// Should we do any final image transformation
|
// Should we do any final image transformation
|
||||||
if( $this->iImgTrans ) {
|
if( $this->iImgTrans ) {
|
||||||
if( !class_exists('ImgTrans') ) {
|
if( !class_exists('ImgTrans') ) {
|
||||||
@ -67,6 +89,8 @@ class CanvasGraph extends Graph {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} // Class
|
} // Class
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
?>
|
?>
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Some utilities for text and shape drawing on a canvas
|
// Description: Some utilities for text and shape drawing on a canvas
|
||||||
// Created: 2002-08-23
|
// Created: 2002-08-23
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_canvtools.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_canvtools.php 20 2005-05-30 20:34:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -23,12 +23,12 @@ DEFINE('CORNER_BOTTOMLEFT',3);
|
|||||||
//===================================================
|
//===================================================
|
||||||
|
|
||||||
class CanvasScale {
|
class CanvasScale {
|
||||||
var $g;
|
private $g;
|
||||||
var $w,$h;
|
private $w,$h;
|
||||||
var $ixmin=0,$ixmax=10,$iymin=0,$iymax=10;
|
private $ixmin=0,$ixmax=10,$iymin=0,$iymax=10;
|
||||||
|
|
||||||
function CanvasScale(&$graph,$xmin=0,$xmax=10,$ymin=0,$ymax=10) {
|
function CanvasScale($graph,$xmin=0,$xmax=10,$ymin=0,$ymax=10) {
|
||||||
$this->g = &$graph;
|
$this->g = $graph;
|
||||||
$this->w = $graph->img->width;
|
$this->w = $graph->img->width;
|
||||||
$this->h = $graph->img->height;
|
$this->h = $graph->img->height;
|
||||||
$this->ixmin = $xmin;
|
$this->ixmin = $xmin;
|
||||||
@ -68,12 +68,12 @@ class CanvasScale {
|
|||||||
// Description: Methods to draw shapes on canvas
|
// Description: Methods to draw shapes on canvas
|
||||||
//===================================================
|
//===================================================
|
||||||
class Shape {
|
class Shape {
|
||||||
var $img,$scale;
|
private $img,$scale;
|
||||||
|
|
||||||
function Shape(&$aGraph,&$scale) {
|
function Shape($aGraph,$scale) {
|
||||||
$this->img = &$aGraph->img;
|
$this->img = $aGraph->img;
|
||||||
$this->img->SetColor('black');
|
$this->img->SetColor('black');
|
||||||
$this->scale = &$scale;
|
$this->scale = $scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetColor($aColor) {
|
function SetColor($aColor) {
|
||||||
@ -374,11 +374,11 @@ class Shape {
|
|||||||
// rounded, possible filled, rectangle.
|
// rounded, possible filled, rectangle.
|
||||||
//===================================================
|
//===================================================
|
||||||
class CanvasRectangleText {
|
class CanvasRectangleText {
|
||||||
var $ix,$iy,$iw,$ih,$ir=4;
|
private $ix,$iy,$iw,$ih,$ir=4;
|
||||||
var $iTxt,$iColor='black',$iFillColor='',$iFontColor='black';
|
private $iTxt,$iColor='black',$iFillColor='',$iFontColor='black';
|
||||||
var $iParaAlign='center';
|
private $iParaAlign='center';
|
||||||
var $iAutoBoxMargin=5;
|
private $iAutoBoxMargin=5;
|
||||||
var $iShadowWidth=3,$iShadowColor='';
|
private $iShadowWidth=3,$iShadowColor='';
|
||||||
|
|
||||||
function CanvasRectangleText($aTxt='',$xl=0,$yt=0,$w=0,$h=0) {
|
function CanvasRectangleText($aTxt='',$xl=0,$yt=0,$w=0,$h=0) {
|
||||||
$this->iTxt = new Text($aTxt);
|
$this->iTxt = new Text($aTxt);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Classes to handle Date scaling
|
// Description: Classes to handle Date scaling
|
||||||
// Created: 2005-05-02
|
// Created: 2005-05-02
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_date.php 220 2005-10-15 16:53:53Z ljp $
|
// Ver: $Id: jpgraph_date.php 573 2006-03-04 10:41:59Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -48,9 +48,9 @@ DEFINE('SECPERMIN',60);
|
|||||||
|
|
||||||
|
|
||||||
class DateScale extends LinearScale {
|
class DateScale extends LinearScale {
|
||||||
var $date_format = '';
|
private $date_format = '';
|
||||||
var $iStartAlign = false, $iEndAlign = false;
|
private $iStartAlign = false, $iEndAlign = false;
|
||||||
var $iStartTimeAlign = false, $iEndTimeAlign = false;
|
private $iStartTimeAlign = false, $iEndTimeAlign = false;
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
@ -377,6 +377,7 @@ class DateScale extends LinearScale {
|
|||||||
// Overrides the automatic determined date format. Must be a valid date() format string
|
// Overrides the automatic determined date format. Must be a valid date() format string
|
||||||
function SetDateFormat($aFormat) {
|
function SetDateFormat($aFormat) {
|
||||||
$this->date_format = $aFormat;
|
$this->date_format = $aFormat;
|
||||||
|
$this->ticks->SetLabelDateFormat($this->date_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetDateAlign($aStartAlign,$aEndAlign=false) {
|
function SetDateAlign($aStartAlign,$aEndAlign=false) {
|
||||||
@ -396,7 +397,9 @@ class DateScale extends LinearScale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function AutoScale(&$img,$aStartTime,$aEndTime,$aNumSteps) {
|
function AutoScale($img,$aStartTime,$aEndTime,$aNumSteps,$_adummy=false) {
|
||||||
|
// We need to have one dummy argument to make the signature of AutoScale()
|
||||||
|
// identical to LinearScale::AutoScale
|
||||||
if( $aStartTime == $aEndTime ) {
|
if( $aStartTime == $aEndTime ) {
|
||||||
// Special case when we only have one data point.
|
// Special case when we only have one data point.
|
||||||
// Create a small artifical intervall to do the autoscaling
|
// Create a small artifical intervall to do the autoscaling
|
||||||
@ -427,7 +430,8 @@ class DateScale extends LinearScale {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if( $this->iStartTimeAlign !== false && $this->iStartAlign !== false ) {
|
if( $this->iStartTimeAlign !== false && $this->iStartAlign !== false ) {
|
||||||
JpGraphError::Raise('It is only possible to use either SetDateAlign() or SetTimeAlign() but not both');
|
JpGraphError::RaiseL(3001);
|
||||||
|
//('It is only possible to use either SetDateAlign() or SetTimeAlign() but not both');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $this->iStartTimeAlign !== false ) {
|
if( $this->iStartTimeAlign !== false ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Error plot extension for JpGraph
|
// Description: Error plot extension for JpGraph
|
||||||
// Created: 2001-01-08
|
// Created: 2001-01-08
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_error.php 88 2005-08-07 17:18:51Z ljp $
|
// Ver: $Id: jpgraph_error.php 462 2006-02-04 12:07:05Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -16,10 +16,10 @@
|
|||||||
// each datapoint
|
// each datapoint
|
||||||
//===================================================
|
//===================================================
|
||||||
class ErrorPlot extends Plot {
|
class ErrorPlot extends Plot {
|
||||||
var $errwidth=2;
|
private $errwidth=2;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function ErrorPlot(&$datay,$datax=false) {
|
function ErrorPlot($datay,$datax=false) {
|
||||||
$this->Plot($datay,$datax);
|
$this->Plot($datay,$datax);
|
||||||
$this->numpoints /= 2;
|
$this->numpoints /= 2;
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ class ErrorPlot extends Plot {
|
|||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
|
|
||||||
// Gets called before any axis are stroked
|
// Gets called before any axis are stroked
|
||||||
function PreStrokeAdjust(&$graph) {
|
function PreStrokeAdjust($graph) {
|
||||||
if( $this->center ) {
|
if( $this->center ) {
|
||||||
$a=0.5; $b=0.5;
|
$a=0.5; $b=0.5;
|
||||||
++$this->numpoints;
|
++$this->numpoints;
|
||||||
@ -40,14 +40,15 @@ class ErrorPlot extends Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Method description
|
// Method description
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
$numpoints=count($this->coords[0])/2;
|
$numpoints=count($this->coords[0])/2;
|
||||||
$img->SetColor($this->color);
|
$img->SetColor($this->color);
|
||||||
$img->SetLineWeight($this->weight);
|
$img->SetLineWeight($this->weight);
|
||||||
|
|
||||||
if( isset($this->coords[1]) ) {
|
if( isset($this->coords[1]) ) {
|
||||||
if( count($this->coords[1])!=$numpoints )
|
if( count($this->coords[1])!=$numpoints )
|
||||||
JpGraphError::Raise("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
JpGraphError::RaiseL(2003,count($this->coords[1]),$numpoints);
|
||||||
|
//("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
||||||
else
|
else
|
||||||
$exist_x = true;
|
$exist_x = true;
|
||||||
}
|
}
|
||||||
@ -84,10 +85,10 @@ class ErrorPlot extends Plot {
|
|||||||
// BACKWARD COMPATIBILITY
|
// BACKWARD COMPATIBILITY
|
||||||
//===================================================
|
//===================================================
|
||||||
class ErrorLinePlot extends ErrorPlot {
|
class ErrorLinePlot extends ErrorPlot {
|
||||||
var $line=null;
|
public $line=null;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function ErrorLinePlot(&$datay,$datax=false) {
|
function ErrorLinePlot($datay,$datax=false) {
|
||||||
$this->ErrorPlot($datay,$datax);
|
$this->ErrorPlot($datay,$datax);
|
||||||
// Calculate line coordinates as the average of the error limits
|
// Calculate line coordinates as the average of the error limits
|
||||||
$n = count($datay);
|
$n = count($datay);
|
||||||
@ -99,13 +100,13 @@ class ErrorLinePlot extends ErrorPlot {
|
|||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
function Legend(&$graph) {
|
function Legend($graph) {
|
||||||
if( $this->legend != "" )
|
if( $this->legend != "" )
|
||||||
$graph->legend->Add($this->legend,$this->color);
|
$graph->legend->Add($this->legend,$this->color);
|
||||||
$this->line->Legend($graph);
|
$this->line->Legend($graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
parent::Stroke($img,$xscale,$yscale);
|
parent::Stroke($img,$xscale,$yscale);
|
||||||
$this->line->Stroke($img,$xscale,$yscale);
|
$this->line->Stroke($img,$xscale,$yscale);
|
||||||
}
|
}
|
||||||
@ -117,16 +118,16 @@ class ErrorLinePlot extends ErrorPlot {
|
|||||||
// Description: Combine a line and error plot
|
// Description: Combine a line and error plot
|
||||||
//===================================================
|
//===================================================
|
||||||
class LineErrorPlot extends ErrorPlot {
|
class LineErrorPlot extends ErrorPlot {
|
||||||
var $line=null;
|
public $line=null;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
// Data is (val, errdeltamin, errdeltamax)
|
// Data is (val, errdeltamin, errdeltamax)
|
||||||
function LineErrorPlot(&$datay,$datax=false) {
|
function LineErrorPlot($datay,$datax=false) {
|
||||||
$ly=array(); $ey=array();
|
$ly=array(); $ey=array();
|
||||||
$n = count($datay);
|
$n = count($datay);
|
||||||
if( $n % 3 != 0 ) {
|
if( $n % 3 != 0 ) {
|
||||||
JpGraphError::Raise('Error in input data to LineErrorPlot.'.
|
JpGraphError::RaiseL(4002);
|
||||||
'Number of data points must be a multiple of 3');
|
//('Error in input data to LineErrorPlot. Number of data points must be a multiple of 3');
|
||||||
}
|
}
|
||||||
for($i=0; $i < $n; $i+=3 ) {
|
for($i=0; $i < $n; $i+=3 ) {
|
||||||
$ly[]=$datay[$i];
|
$ly[]=$datay[$i];
|
||||||
@ -139,13 +140,13 @@ class LineErrorPlot extends ErrorPlot {
|
|||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
function Legend(&$graph) {
|
function Legend($graph) {
|
||||||
if( $this->legend != "" )
|
if( $this->legend != "" )
|
||||||
$graph->legend->Add($this->legend,$this->color);
|
$graph->legend->Add($this->legend,$this->color);
|
||||||
$this->line->Legend($graph);
|
$this->line->Legend($graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
parent::Stroke($img,$xscale,$yscale);
|
parent::Stroke($img,$xscale,$yscale);
|
||||||
$this->line->Stroke($img,$xscale,$yscale);
|
$this->line->Stroke($img,$xscale,$yscale);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Class Jpfile. Handles plotmarks
|
// Description: Class Jpfile. Handles plotmarks
|
||||||
// Created: 2003-06-28
|
// Created: 2003-06-28
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_flags.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_flags.php 472 2006-02-04 12:13:48Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -19,7 +19,7 @@ DEFINE('FLAGSIZE4',4);
|
|||||||
|
|
||||||
class FlagImages {
|
class FlagImages {
|
||||||
|
|
||||||
var $iCountryNameMap = array(
|
private $iCountryNameMap = array(
|
||||||
'Afghanistan' => 'afgh',
|
'Afghanistan' => 'afgh',
|
||||||
'Republic of Angola' => 'agla',
|
'Republic of Angola' => 'agla',
|
||||||
'Republic of Albania' => 'alba',
|
'Republic of Albania' => 'alba',
|
||||||
@ -188,6 +188,7 @@ class FlagImages {
|
|||||||
'Republic of Palau' => 'pala',
|
'Republic of Palau' => 'pala',
|
||||||
'Independent State of Papua New Guinea' => 'pang',
|
'Independent State of Papua New Guinea' => 'pang',
|
||||||
'Republic of Paraguay' => 'para',
|
'Republic of Paraguay' => 'para',
|
||||||
|
'Republic of Peru' => 'peru',
|
||||||
'Republic of the Philippines' => 'phil',
|
'Republic of the Philippines' => 'phil',
|
||||||
'British Overseas Territory of the Pitcairn Islands' => 'piis',
|
'British Overseas Territory of the Pitcairn Islands' => 'piis',
|
||||||
'Republic of Poland' => 'pola',
|
'Republic of Poland' => 'pola',
|
||||||
@ -253,16 +254,16 @@ class FlagImages {
|
|||||||
'Republic of Zimbabwe' => 'zbwe' ) ;
|
'Republic of Zimbabwe' => 'zbwe' ) ;
|
||||||
|
|
||||||
|
|
||||||
var $iFlagCount = -1;
|
private $iFlagCount = -1;
|
||||||
var $iFlagSetMap = array(
|
private $iFlagSetMap = array(
|
||||||
FLAGSIZE1 => 'flags_thumb35x35',
|
FLAGSIZE1 => 'flags_thumb35x35',
|
||||||
FLAGSIZE2 => 'flags_thumb60x60',
|
FLAGSIZE2 => 'flags_thumb60x60',
|
||||||
FLAGSIZE3 => 'flags_thumb100x100',
|
FLAGSIZE3 => 'flags_thumb100x100',
|
||||||
FLAGSIZE4 => 'flags'
|
FLAGSIZE4 => 'flags'
|
||||||
);
|
);
|
||||||
|
|
||||||
var $iFlagData ;
|
private $iFlagData ;
|
||||||
var $iOrdIdx=array();
|
private $iOrdIdx=array();
|
||||||
|
|
||||||
function FlagImages($aSize=FLAGSIZE1) {
|
function FlagImages($aSize=FLAGSIZE1) {
|
||||||
switch($aSize) {
|
switch($aSize) {
|
||||||
@ -276,8 +277,8 @@ class FlagImages {
|
|||||||
$this->iFlagData = unserialize($rawdata);
|
$this->iFlagData = unserialize($rawdata);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise('Unknown flag size. ('.$aSize.')');
|
JpGraphError::RaiseL(5001,$aSize);
|
||||||
die();
|
//('Unknown flag size. ('.$aSize.')');
|
||||||
}
|
}
|
||||||
$this->iFlagCount = count($this->iCountryNameMap);
|
$this->iFlagCount = count($this->iCountryNameMap);
|
||||||
}
|
}
|
||||||
@ -297,7 +298,8 @@ class FlagImages {
|
|||||||
return Image::CreateFromString($d);
|
return Image::CreateFromString($d);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JpGraphError::Raise("Flag index \" $aIdx\" does not exist.");
|
JpGraphError::RaiseL(5002,$aIdx);
|
||||||
|
//("Flag index \" $aIdx\" does not exist.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +324,8 @@ class FlagImages {
|
|||||||
return $tmp[0];
|
return $tmp[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JpGraphError::Raise('Invalid ordinal number specified for flag index.');
|
JpGraphError::RaiseL(5003,$aOrd);
|
||||||
|
//('Invalid ordinal number specified for flag index.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +362,8 @@ class FlagImages {
|
|||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JpGraphError::Raise("The (partial) country name \"$aName\" does not have a cooresponding flag image. The flag may still exist but under another name, e.g. insted of \"usa\" try \"united states\".");
|
JpGraphError::RaiseL(5004,$aName);
|
||||||
|
//("The (partial) country name \"$aName\" does not have a cooresponding flag image. The flag may still exist but under another name, e.g. insted of \"usa\" try \"united states\".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: JpGraph Gantt plot extension
|
// Description: JpGraph Gantt plot extension
|
||||||
// Created: 2001-11-12
|
// Created: 2001-11-12
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_gantt.php 286 2005-11-28 22:09:25Z ljp $
|
// Ver: $Id: jpgraph_gantt.php 587 2006-03-04 18:57:09Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
require_once('jpgraph_plotband.php');
|
require_once('jpgraph_plotband.php');
|
||||||
require_once('jpgraph_iconplot.php');
|
require_once('jpgraph_iconplot.php');
|
||||||
require_once('jpgraph_plotmark.inc');
|
require_once('jpgraph_plotmark.inc.php');
|
||||||
|
|
||||||
// Maximum size for Automatic Gantt chart
|
// Maximum size for Automatic Gantt chart
|
||||||
DEFINE('MAX_GANTTIMG_SIZE_W',4000);
|
DEFINE('MAX_GANTTIMG_SIZE_W',4000);
|
||||||
@ -141,17 +141,17 @@ if (!function_exists('array_fill')) {
|
|||||||
// Description:
|
// Description:
|
||||||
//===================================================
|
//===================================================
|
||||||
class GanttActivityInfo {
|
class GanttActivityInfo {
|
||||||
var $iColor='black';
|
public $iShow=true;
|
||||||
var $iBackgroundColor='lightgray';
|
public $iLeftColMargin=4,$iRightColMargin=1,$iTopColMargin=1,$iBottomColMargin=3;
|
||||||
var $iFFamily=FF_FONT1,$iFStyle=FS_NORMAL,$iFSize=10,$iFontColor='black';
|
public $vgrid = null;
|
||||||
var $iTitles=array();
|
private $iColor='black';
|
||||||
var $iWidth=array(),$iHeight=-1;
|
private $iBackgroundColor='lightgray';
|
||||||
var $iLeftColMargin=4,$iRightColMargin=1,$iTopColMargin=1,$iBottomColMargin=3;
|
private $iFFamily=FF_FONT1,$iFStyle=FS_NORMAL,$iFSize=10,$iFontColor='black';
|
||||||
var $iTopHeaderMargin = 4;
|
private $iTitles=array();
|
||||||
var $vgrid = null;
|
private $iWidth=array(),$iHeight=-1;
|
||||||
var $iStyle=1;
|
private $iTopHeaderMargin = 4;
|
||||||
var $iShow=true;
|
private $iStyle=1;
|
||||||
var $iHeaderAlign='center';
|
private $iHeaderAlign='center';
|
||||||
|
|
||||||
function GanttActivityInfo() {
|
function GanttActivityInfo() {
|
||||||
$this->vgrid = new LineProperty();
|
$this->vgrid = new LineProperty();
|
||||||
@ -236,12 +236,12 @@ class GanttActivityInfo {
|
|||||||
return $w;
|
return $w;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetColStart($aImg,&$ioStart,$aAddLeftMargin=false) {
|
function GetColStart($aImg,&$aStart,$aAddLeftMargin=false) {
|
||||||
$n = count($this->iTitles) ;
|
$n = count($this->iTitles) ;
|
||||||
$adj = $aAddLeftMargin ? $this->iLeftColMargin : 0;
|
$adj = $aAddLeftMargin ? $this->iLeftColMargin : 0;
|
||||||
$ioStart=array($aImg->left_margin+$adj);
|
$aStart=array($aImg->left_margin+$adj);
|
||||||
for( $i=1; $i < $n; ++$i ) {
|
for( $i=1; $i < $n; ++$i ) {
|
||||||
$ioStart[$i] = $ioStart[$i-1]+$this->iLeftColMargin+$this->iWidth[$i-1];
|
$aStart[$i] = $aStart[$i-1]+$this->iLeftColMargin+$this->iWidth[$i-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +268,8 @@ class GanttActivityInfo {
|
|||||||
$yTop = $aUseTextHeight ? $aYBottom-$h-$this->iTopColMargin-$this->iBottomColMargin : $aYTop ;
|
$yTop = $aUseTextHeight ? $aYBottom-$h-$this->iTopColMargin-$this->iBottomColMargin : $aYTop ;
|
||||||
|
|
||||||
if( $h < 0 ) {
|
if( $h < 0 ) {
|
||||||
JpGraphError::Raise('Internal error. Height for ActivityTitles is < 0');
|
JpGraphError::RaiseL(6001);
|
||||||
|
//('Internal error. Height for ActivityTitles is < 0');
|
||||||
}
|
}
|
||||||
|
|
||||||
$aImg->SetLineWeight(1);
|
$aImg->SetLineWeight(1);
|
||||||
@ -329,16 +330,16 @@ class GanttActivityInfo {
|
|||||||
// Description: Main class to handle gantt graphs
|
// Description: Main class to handle gantt graphs
|
||||||
//===================================================
|
//===================================================
|
||||||
class GanttGraph extends Graph {
|
class GanttGraph extends Graph {
|
||||||
var $scale; // Public accessible
|
public $scale; // Public accessible
|
||||||
var $iObj=array(); // Gantt objects
|
public $hgrid=null;
|
||||||
var $iLabelHMarginFactor=0.2; // 10% margin on each side of the labels
|
private $iObj=array(); // Gantt objects
|
||||||
var $iLabelVMarginFactor=0.4; // 40% margin on top and bottom of label
|
private $iLabelHMarginFactor=0.2; // 10% margin on each side of the labels
|
||||||
var $iLayout=GANTT_FROMTOP; // Could also be GANTT_EVEN
|
private $iLabelVMarginFactor=0.4; // 40% margin on top and bottom of label
|
||||||
var $iSimpleFont = FF_FONT1,$iSimpleFontSize=11;
|
private $iLayout=GANTT_FROMTOP; // Could also be GANTT_EVEN
|
||||||
var $iSimpleStyle=GANTT_RDIAG,$iSimpleColor='yellow',$iSimpleBkgColor='red';
|
private $iSimpleFont = FF_FONT1,$iSimpleFontSize=11;
|
||||||
var $iSimpleProgressBkgColor='gray',$iSimpleProgressColor='darkgreen';
|
private $iSimpleStyle=GANTT_RDIAG,$iSimpleColor='yellow',$iSimpleBkgColor='red';
|
||||||
var $iSimpleProgressStyle=GANTT_SOLID;
|
private $iSimpleProgressBkgColor='gray',$iSimpleProgressColor='darkgreen';
|
||||||
var $hgrid=null;
|
private $iSimpleProgressStyle=GANTT_SOLID;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
// Create a new gantt graph
|
// Create a new gantt graph
|
||||||
@ -349,7 +350,8 @@ class GanttGraph extends Graph {
|
|||||||
if( $aHeight == -1 ) $aHeight=0;
|
if( $aHeight == -1 ) $aHeight=0;
|
||||||
|
|
||||||
if( $aWidth< 0 || $aHeight < 0 ) {
|
if( $aWidth< 0 || $aHeight < 0 ) {
|
||||||
JpgraphError::Raise("You can't specify negative sizes for Gantt graph dimensions. Use 0 to indicate that you want the library to automatically determine a dimension.");
|
JpgraphError::RaiseL(6002);
|
||||||
|
//("You can't specify negative sizes for Gantt graph dimensions. Use 0 to indicate that you want the library to automatically determine a dimension.");
|
||||||
}
|
}
|
||||||
Graph::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);
|
Graph::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);
|
||||||
$this->scale = new GanttScale($this->img);
|
$this->scale = new GanttScale($this->img);
|
||||||
@ -414,7 +416,8 @@ class GanttGraph extends Graph {
|
|||||||
$n = count($constrains);
|
$n = count($constrains);
|
||||||
for( $j=0; $j < $n; ++$j ) {
|
for( $j=0; $j < $n; ++$j ) {
|
||||||
if( empty($constrains[$j]) || (count($constrains[$j]) != 3) ) {
|
if( empty($constrains[$j]) || (count($constrains[$j]) != 3) ) {
|
||||||
JpGraphError::Raise("Invalid format for Constrain parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Constrain-To,Constrain-Type)");
|
JpGraphError::RaiseL(6003,$j);
|
||||||
|
//("Invalid format for Constrain parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Constrain-To,Constrain-Type)");
|
||||||
}
|
}
|
||||||
if( $constrains[$j][0]==$data[$i][0] ) {
|
if( $constrains[$j][0]==$data[$i][0] ) {
|
||||||
$a->SetConstrain($constrains[$j][1],$constrains[$j][2],'black',ARROW_S2,ARROWT_SOLID);
|
$a->SetConstrain($constrains[$j][1],$constrains[$j][2],'black',ARROW_S2,ARROWT_SOLID);
|
||||||
@ -426,11 +429,11 @@ class GanttGraph extends Graph {
|
|||||||
for( $j=0; $j < $n; ++$j ) {
|
for( $j=0; $j < $n; ++$j ) {
|
||||||
|
|
||||||
if( empty($progress[$j]) || (count($progress[$j]) != 2) ) {
|
if( empty($progress[$j]) || (count($progress[$j]) != 2) ) {
|
||||||
JpGraphError::Raise("Invalid format for Progress parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Progress)");
|
JpGraphError::RaiseL(6004,$j);
|
||||||
|
//("Invalid format for Progress parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Progress)");
|
||||||
}
|
}
|
||||||
if( $progress[$j][0]==$data[$i][0] ) {
|
if( $progress[$j][0]==$data[$i][0] ) {
|
||||||
$a->progress->Set($progress[$j][1]);
|
$a->progress->Set($progress[$j][1]);
|
||||||
$a->progress->SetHeight(0.5);
|
|
||||||
$a->progress->SetPattern($this->iSimpleProgressStyle,
|
$a->progress->SetPattern($this->iSimpleProgressStyle,
|
||||||
$this->iSimpleProgressColor);
|
$this->iSimpleProgressColor);
|
||||||
$a->progress->SetFillColor($this->iSimpleProgressBkgColor);
|
$a->progress->SetFillColor($this->iSimpleProgressBkgColor);
|
||||||
@ -490,8 +493,8 @@ class GanttGraph extends Graph {
|
|||||||
// Add a new Gantt object
|
// Add a new Gantt object
|
||||||
function Add($aObject) {
|
function Add($aObject) {
|
||||||
if( is_array($aObject) && count($aObject) > 0 ) {
|
if( is_array($aObject) && count($aObject) > 0 ) {
|
||||||
$cl = get_class($aObject[0]);
|
$cl = $aObject[0];
|
||||||
if( $cl == 'iconplot' ) {
|
if( class_exists('IconPlot',false) && ($cl instanceof IconPlot) ) {
|
||||||
$this->AddIcon($aObject);
|
$this->AddIcon($aObject);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -501,8 +504,7 @@ class GanttGraph extends Graph {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$cl = get_class($aObject);
|
if( class_exists('IconPlot',false) && ($aObject instanceof IconPlot) ) {
|
||||||
if( $cl == 'iconplot' ) {
|
|
||||||
$this->AddIcon($aObject);
|
$this->AddIcon($aObject);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -512,8 +514,9 @@ class GanttGraph extends Graph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Override inherit method from Graph and give a warning message
|
// Override inherit method from Graph and give a warning message
|
||||||
function SetScale() {
|
function SetScale($aAxisType,$aYMin=1,$aYMax=1,$aXMin=1,$aXMax=1) {
|
||||||
JpGraphError::Raise("SetScale() is not meaningfull with Gantt charts.");
|
JpGraphError::RaiseL(6005);
|
||||||
|
//("SetScale() is not meaningfull with Gantt charts.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specify the date range for Gantt graphs (if this is not set it will be
|
// Specify the date range for Gantt graphs (if this is not set it will be
|
||||||
@ -533,12 +536,11 @@ class GanttGraph extends Graph {
|
|||||||
// multiple columns in the label section. When this was first written
|
// multiple columns in the label section. When this was first written
|
||||||
// it only supported a single label, hence the name.
|
// it only supported a single label, hence the name.
|
||||||
function GetMaxLabelWidth() {
|
function GetMaxLabelWidth() {
|
||||||
$m=50;
|
$m=10;
|
||||||
if( $this->iObj != null ) {
|
if( $this->iObj != null ) {
|
||||||
$marg = $this->scale->actinfo->iLeftColMargin+$this->scale->actinfo->iRightColMargin;
|
$marg = $this->scale->actinfo->iLeftColMargin+$this->scale->actinfo->iRightColMargin;
|
||||||
$m = $this->iObj[0]->title->GetWidth($this->img)+$marg;
|
|
||||||
$n = count($this->iObj);
|
$n = count($this->iObj);
|
||||||
for($i=1; $i < $n; ++$i) {
|
for($i=0; $i < $n; ++$i) {
|
||||||
if( !empty($this->iObj[$i]->title) ) {
|
if( !empty($this->iObj[$i]->title) ) {
|
||||||
if( $this->iObj[$i]->title->HasTabs() ) {
|
if( $this->iObj[$i]->title->HasTabs() ) {
|
||||||
list($tot,$w) = $this->iObj[$i]->title->GetWidth($this->img,true);
|
list($tot,$w) = $this->iObj[$i]->title->GetWidth($this->img,true);
|
||||||
@ -554,11 +556,10 @@ class GanttGraph extends Graph {
|
|||||||
|
|
||||||
// Get the maximum height of the titles for the bars
|
// Get the maximum height of the titles for the bars
|
||||||
function GetMaxLabelHeight() {
|
function GetMaxLabelHeight() {
|
||||||
$m=0;
|
$m=10;
|
||||||
if( $this->iObj != null ) {
|
if( $this->iObj != null ) {
|
||||||
$m = $this->iObj[0]->title->GetHeight($this->img);
|
|
||||||
$n = count($this->iObj);
|
$n = count($this->iObj);
|
||||||
for($i=1; $i < $n; ++$i) {
|
for($i=0; $i < $n; ++$i) {
|
||||||
if( !empty($this->iObj[$i]->title) ) {
|
if( !empty($this->iObj[$i]->title) ) {
|
||||||
$m=max($m,$this->iObj[$i]->title->GetHeight($this->img));
|
$m=max($m,$this->iObj[$i]->title->GetHeight($this->img));
|
||||||
}
|
}
|
||||||
@ -581,7 +582,7 @@ class GanttGraph extends Graph {
|
|||||||
|
|
||||||
// Get the maximum used line number (vertical position) for bars
|
// Get the maximum used line number (vertical position) for bars
|
||||||
function GetBarMaxLineNumber() {
|
function GetBarMaxLineNumber() {
|
||||||
$m=0;
|
$m=1;
|
||||||
if( $this->iObj != null ) {
|
if( $this->iObj != null ) {
|
||||||
$m = $this->iObj[0]->GetLineNbr();
|
$m = $this->iObj[0]->GetLineNbr();
|
||||||
$n = count($this->iObj);
|
$n = count($this->iObj);
|
||||||
@ -596,11 +597,11 @@ class GanttGraph extends Graph {
|
|||||||
function GetBarMinMax() {
|
function GetBarMinMax() {
|
||||||
$start = 0 ;
|
$start = 0 ;
|
||||||
$n = count($this->iObj);
|
$n = count($this->iObj);
|
||||||
|
|
||||||
while( $start < $n && $this->iObj[$start]->GetMaxDate() === false )
|
while( $start < $n && $this->iObj[$start]->GetMaxDate() === false )
|
||||||
++$start;
|
++$start;
|
||||||
if( $start >= $n ) {
|
if( $start >= $n ) {
|
||||||
JpgraphError::Raise('Cannot autoscale Gantt chart. No dated activities exist. [GetBarMinMax() start >= n]');
|
JpgraphError::RaiseL(6006);
|
||||||
|
//('Cannot autoscale Gantt chart. No dated activities exist. [GetBarMinMax() start >= n]');
|
||||||
}
|
}
|
||||||
|
|
||||||
$max=$this->scale->NormalizeDate($this->iObj[$start]->GetMaxDate());
|
$max=$this->scale->NormalizeDate($this->iObj[$start]->GetMaxDate());
|
||||||
@ -626,6 +627,7 @@ class GanttGraph extends Graph {
|
|||||||
// the minimum width needed to display the headers. Some margins are
|
// the minimum width needed to display the headers. Some margins are
|
||||||
// also added to make it better looking.
|
// also added to make it better looking.
|
||||||
function AutoSize() {
|
function AutoSize() {
|
||||||
|
|
||||||
if( $this->img->img == null ) {
|
if( $this->img->img == null ) {
|
||||||
// The predefined left, right, top, bottom margins.
|
// The predefined left, right, top, bottom margins.
|
||||||
// Note that the top margin might incease depending on
|
// Note that the top margin might incease depending on
|
||||||
@ -842,14 +844,12 @@ class GanttGraph extends Graph {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has the user specified a width or do we need to
|
$cw = $this->GetMaxActInfoColWidth() ;
|
||||||
// determine it?
|
$this->scale->actinfo->SetMinColWidth($cw);
|
||||||
if( $this->img->width <= 0 ) {
|
if( $this->img->width <= 0 ) {
|
||||||
// Now determine the width for the activity titles column
|
// Now determine the width for the activity titles column
|
||||||
|
|
||||||
// Firdst find out the maximum width of each object column
|
// Firdst find out the maximum width of each object column
|
||||||
$cw = $this->GetMaxActInfoColWidth() ;
|
|
||||||
$this->scale->actinfo->SetMinColWidth($cw);
|
|
||||||
$titlewidth = max(max($this->GetMaxLabelWidth(),
|
$titlewidth = max(max($this->GetMaxLabelWidth(),
|
||||||
$this->scale->tableTitle->GetWidth($this->img)),
|
$this->scale->tableTitle->GetWidth($this->img)),
|
||||||
$this->scale->actinfo->GetWidth($this->img));
|
$this->scale->actinfo->GetWidth($this->img));
|
||||||
@ -863,15 +863,17 @@ class GanttGraph extends Graph {
|
|||||||
// into account
|
// into account
|
||||||
$width = $titlewidth + $nd*$fw + $lm+$rm;
|
$width = $titlewidth + $nd*$fw + $lm+$rm;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
$width = $this->img->width;
|
$width = $this->img->width;
|
||||||
|
}
|
||||||
|
|
||||||
$width = round($width);
|
$width = round($width);
|
||||||
$height = round($height);
|
$height = round($height);
|
||||||
|
// Make a sanity check on image size
|
||||||
if( $width > MAX_GANTTIMG_SIZE_W || $height > MAX_GANTTIMG_SIZE_H ) {
|
if( $width > MAX_GANTTIMG_SIZE_W || $height > MAX_GANTTIMG_SIZE_H ) {
|
||||||
JpgraphError::Raise("Sanity check for automatic Gantt chart size failed. Either the width (=$width) or height (=$height) is larger than MAX_GANTTIMG_SIZE. This could potentially be caused by a wrong date in one of the activities.");
|
JpgraphError::RaiseL(6007,$width,$height);
|
||||||
|
//("Sanity check for automatic Gantt chart size failed. Either the width (=$width) or height (=$height) is larger than MAX_GANTTIMG_SIZE. This could potentially be caused by a wrong date in one of the activities.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->img->CreateImgCanvas($width,$height);
|
$this->img->CreateImgCanvas($width,$height);
|
||||||
$this->img->SetMargin($lm,$rm,$tm,$bm);
|
$this->img->SetMargin($lm,$rm,$tm,$bm);
|
||||||
}
|
}
|
||||||
@ -903,7 +905,6 @@ class GanttGraph extends Graph {
|
|||||||
// Stroke the gantt chart
|
// Stroke the gantt chart
|
||||||
function Stroke($aStrokeFileName="") {
|
function Stroke($aStrokeFileName="") {
|
||||||
|
|
||||||
|
|
||||||
// If the filename is the predefined value = '_csim_special_'
|
// If the filename is the predefined value = '_csim_special_'
|
||||||
// we assume that the call to stroke only needs to do enough
|
// we assume that the call to stroke only needs to do enough
|
||||||
// to correctly generate the CSIM maps.
|
// to correctly generate the CSIM maps.
|
||||||
@ -914,6 +915,7 @@ class GanttGraph extends Graph {
|
|||||||
$_csim = ($aStrokeFileName===_CSIM_SPECIALFILE);
|
$_csim = ($aStrokeFileName===_CSIM_SPECIALFILE);
|
||||||
|
|
||||||
// Should we autoscale dates?
|
// Should we autoscale dates?
|
||||||
|
|
||||||
if( !$this->scale->IsRangeSet() ) {
|
if( !$this->scale->IsRangeSet() ) {
|
||||||
list($min,$max) = $this->GetBarMinMax();
|
list($min,$max) = $this->GetBarMinMax();
|
||||||
$this->scale->SetRange($min,$max);
|
$this->scale->SetRange($min,$max);
|
||||||
@ -972,13 +974,14 @@ class GanttGraph extends Graph {
|
|||||||
$this->StrokeConstrains();
|
$this->StrokeConstrains();
|
||||||
$this->footer->Stroke($this->img);
|
$this->footer->Stroke($this->img);
|
||||||
|
|
||||||
|
|
||||||
if( $this->iIconDepth == DEPTH_FRONT) {
|
if( $this->iIconDepth == DEPTH_FRONT) {
|
||||||
$this->StrokeIcons();
|
$this->StrokeIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should we do any final image transformation
|
// Should we do any final image transformation
|
||||||
if( $this->iImgTrans ) {
|
if( $this->iImgTrans ) {
|
||||||
if( !class_exists('ImgTrans') ) {
|
if( !class_exists('ImgTrans',false) ) {
|
||||||
require_once('jpgraph_imgtrans.php');
|
require_once('jpgraph_imgtrans.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1029,10 +1032,8 @@ class GanttGraph extends Graph {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( $targetobj == -1 ) {
|
if( $targetobj == -1 ) {
|
||||||
JpGraphError::Raise('You have specifed a constrain from row='.
|
JpGraphError::RaiseL(6008,$this->iObj[$i]->iVPos,$vpos);
|
||||||
$this->iObj[$i]->iVPos.
|
//('You have specifed a constrain from row='.$this->iObj[$i]->iVPos.' to row='.$vpos.' which does not have any activity.');
|
||||||
' to row='.$vpos.' which does not have any activity.');
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
$c2 = $this->iObj[$targetobj]->iConstrainPos;
|
$c2 = $this->iObj[$targetobj]->iConstrainPos;
|
||||||
if( count($c1) == 4 && count($c2 ) == 4) {
|
if( count($c1) == 4 && count($c2 ) == 4) {
|
||||||
@ -1074,9 +1075,8 @@ class GanttGraph extends Graph {
|
|||||||
$link->SetPath(3);
|
$link->SetPath(3);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise('Unknown constrain type specified from row='.
|
JpGraphError::RaiseL(6009,$this->iObj[$i]->iVPos,$vpos);
|
||||||
$this->iObj[$i]->iVPos.
|
//('Unknown constrain type specified from row='.$this->iObj[$i]->iVPos.' to row='.$vpos);
|
||||||
' to row='.$vpos);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1125,8 +1125,7 @@ DEFINE('GICON_FOLDER',11);
|
|||||||
DEFINE('GICON_TEXTIMPORTANT',12);
|
DEFINE('GICON_TEXTIMPORTANT',12);
|
||||||
|
|
||||||
class PredefIcons {
|
class PredefIcons {
|
||||||
var $iBuiltinIcon = null;
|
private $iBuiltinIcon = null, $iLen = -1 ;
|
||||||
var $iLen = -1 ;
|
|
||||||
|
|
||||||
function GetLen() {
|
function GetLen() {
|
||||||
return $this->iLen ;
|
return $this->iLen ;
|
||||||
@ -1134,7 +1133,8 @@ class PredefIcons {
|
|||||||
|
|
||||||
function GetImg($aIdx) {
|
function GetImg($aIdx) {
|
||||||
if( $aIdx < 0 || $aIdx >= $this->iLen ) {
|
if( $aIdx < 0 || $aIdx >= $this->iLen ) {
|
||||||
JpGraphError::Raise('Illegal icon index for Gantt builtin icon ['.$aIdx.']');
|
JpGraphError::RaiseL(6010,$aIdx);
|
||||||
|
//('Illegal icon index for Gantt builtin icon ['.$aIdx.']');
|
||||||
}
|
}
|
||||||
return Image::CreateFromString(base64_decode($this->iBuiltinIcon[$aIdx][1]));
|
return Image::CreateFromString(base64_decode($this->iBuiltinIcon[$aIdx][1]));
|
||||||
}
|
}
|
||||||
@ -1430,10 +1430,10 @@ $_gPredefIcons = new PredefIcons();
|
|||||||
// Description: Holds properties for an icon image
|
// Description: Holds properties for an icon image
|
||||||
//===================================================
|
//===================================================
|
||||||
class IconImage {
|
class IconImage {
|
||||||
var $iGDImage=null;
|
private $iGDImage=null;
|
||||||
var $iWidth,$iHeight;
|
private $iWidth,$iHeight;
|
||||||
var $ixalign='left',$iyalign='center';
|
private $ixalign='left',$iyalign='center';
|
||||||
var $iScale=1.0;
|
private $iScale=1.0;
|
||||||
|
|
||||||
function IconImage($aIcon,$aScale=1) {
|
function IconImage($aIcon,$aScale=1) {
|
||||||
GLOBAL $_gPredefIcons ;
|
GLOBAL $_gPredefIcons ;
|
||||||
@ -1445,7 +1445,8 @@ class IconImage {
|
|||||||
$this->iGDImage = $_gPredefIcons->GetImg($aIcon);
|
$this->iGDImage = $_gPredefIcons->GetImg($aIcon);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JpGraphError::Raise('Argument to IconImage must be string or integer');
|
JpGraphError::RaiseL(6011);
|
||||||
|
//('Argument to IconImage must be string or integer');
|
||||||
}
|
}
|
||||||
$this->iScale = $aScale;
|
$this->iScale = $aScale;
|
||||||
$this->iWidth = Image::GetWidth($this->iGDImage);
|
$this->iWidth = Image::GetWidth($this->iGDImage);
|
||||||
@ -1496,12 +1497,12 @@ class IconImage {
|
|||||||
// Description: Holds properties for a text
|
// Description: Holds properties for a text
|
||||||
//===================================================
|
//===================================================
|
||||||
class TextProperty {
|
class TextProperty {
|
||||||
var $iFFamily=FF_FONT1,$iFStyle=FS_NORMAL,$iFSize=10;
|
public $iShow=true;
|
||||||
var $iColor="black";
|
public $csimtarget='',$csimalt='';
|
||||||
var $iShow=true;
|
private $iFFamily=FF_FONT1,$iFStyle=FS_NORMAL,$iFSize=10;
|
||||||
var $iText="";
|
private $iColor="black";
|
||||||
var $iHAlign="left",$iVAlign="bottom";
|
private $iText="";
|
||||||
var $csimtarget='',$csimalt='';
|
private $iHAlign="left",$iVAlign="bottom";
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
@ -1581,14 +1582,14 @@ class TextProperty {
|
|||||||
// tabs then return both the total width as well as an array with a
|
// tabs then return both the total width as well as an array with a
|
||||||
// width for each column.
|
// width for each column.
|
||||||
function GetWidth($aImg,$aUseTabs=false,$aTabExtraMargin=1.1) {
|
function GetWidth($aImg,$aUseTabs=false,$aTabExtraMargin=1.1) {
|
||||||
$errmsg = 'Unknown type in Gantt object title specification';
|
|
||||||
$extra_margin=4;
|
$extra_margin=4;
|
||||||
$aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
|
$aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
|
||||||
if( is_string($this->iText) ) {
|
if( is_string($this->iText) ) {
|
||||||
if( strlen($this->iText) == 0 ) return 0;
|
if( strlen($this->iText) == 0 ) return 0;
|
||||||
$tmp = split("\t",$this->iText);
|
$tmp = split("\t",$this->iText);
|
||||||
if( count($tmp) <= 1 || !$aUseTabs ) {
|
if( count($tmp) <= 1 || !$aUseTabs ) {
|
||||||
return $aImg->GetTextWidth($this->iText)+2*$extra_margin;
|
$w = $aImg->GetTextWidth($this->iText);
|
||||||
|
return $w + 2*$extra_margin;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$tot=0;
|
$tot=0;
|
||||||
@ -1615,7 +1616,7 @@ class TextProperty {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( is_object($tmp) === false ) {
|
if( is_object($tmp) === false ) {
|
||||||
JpGraphError::Raise($errmsg);
|
JpGraphError::RaiseL(6012);
|
||||||
}
|
}
|
||||||
$w += $tmp->GetWidth()+$extra_margin;
|
$w += $tmp->GetWidth()+$extra_margin;
|
||||||
}
|
}
|
||||||
@ -1623,7 +1624,7 @@ class TextProperty {
|
|||||||
return $w;
|
return $w;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JpGraphError::Raise($errmsg);
|
JpGraphError::RaiseL(6012);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1631,7 +1632,6 @@ class TextProperty {
|
|||||||
// column individually. If there is no columns just return the width of the single
|
// column individually. If there is no columns just return the width of the single
|
||||||
// column as an array of one
|
// column as an array of one
|
||||||
function GetColWidth($aImg,$aMargin=0) {
|
function GetColWidth($aImg,$aMargin=0) {
|
||||||
$errmsg = 'Unknown type in Gantt object title specification';
|
|
||||||
$aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
|
$aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
|
||||||
if( is_array($this->iText) ) {
|
if( is_array($this->iText) ) {
|
||||||
$n = count($this->iText);
|
$n = count($this->iText);
|
||||||
@ -1642,7 +1642,7 @@ class TextProperty {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( is_object($tmp) === false ) {
|
if( is_object($tmp) === false ) {
|
||||||
JpGraphError::Raise($errmsg);
|
JpGraphError::RaiseL(6012);
|
||||||
}
|
}
|
||||||
$w[$i] = $tmp->GetWidth()+$aMargin;
|
$w[$i] = $tmp->GetWidth()+$aMargin;
|
||||||
}
|
}
|
||||||
@ -1726,15 +1726,16 @@ class TextProperty {
|
|||||||
// for each type of the scale headers
|
// for each type of the scale headers
|
||||||
//===================================================
|
//===================================================
|
||||||
class HeaderProperty {
|
class HeaderProperty {
|
||||||
var $iTitleVertMargin=3,$iFFamily=FF_FONT0,$iFStyle=FS_NORMAL,$iFSize=8;
|
public $grid;
|
||||||
var $iFrameColor="black",$iFrameWeight=1;
|
public $iShowLabels=true,$iShowGrid=true;
|
||||||
var $iShowLabels=true,$iShowGrid=true;
|
public $iTitleVertMargin=3,$iFFamily=FF_FONT0,$iFStyle=FS_NORMAL,$iFSize=8;
|
||||||
var $iBackgroundColor="white";
|
public $iStyle=0;
|
||||||
var $iWeekendBackgroundColor="lightgray",$iSundayTextColor="red"; // these are only used with day scale
|
public $iFrameColor="black",$iFrameWeight=1;
|
||||||
var $iTextColor="black";
|
public $iBackgroundColor="white";
|
||||||
var $iLabelFormStr="%d";
|
public $iWeekendBackgroundColor="lightgray",$iSundayTextColor="red"; // these are only used with day scale
|
||||||
var $grid,$iStyle=0;
|
public $iTextColor="black";
|
||||||
var $iIntervall = 1;
|
public $iLabelFormStr="%d";
|
||||||
|
public $iIntervall = 1;
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
@ -1830,31 +1831,32 @@ class HeaderProperty {
|
|||||||
// date headers (days, week, etc).
|
// date headers (days, week, etc).
|
||||||
//===================================================
|
//===================================================
|
||||||
class GanttScale {
|
class GanttScale {
|
||||||
var $minute,$hour,$day,$week,$month,$year;
|
public $minute,$hour,$day,$week,$month,$year;
|
||||||
var $divider,$dividerh,$tableTitle;
|
public $divider,$dividerh,$tableTitle;
|
||||||
var $iStartDate=-1,$iEndDate=-1;
|
public $iStartDate=-1,$iEndDate=-1;
|
||||||
// Number of gantt bar position (n.b not necessariliy the same as the number of bars)
|
// Number of gantt bar position (n.b not necessariliy the same as the number of bars)
|
||||||
// we could have on bar in position 1, and one bar in position 5 then there are two
|
// we could have on bar in position 1, and one bar in position 5 then there are two
|
||||||
// bars but the number of bar positions is 5
|
// bars but the number of bar positions is 5
|
||||||
var $iVertLines=-1;
|
public $actinfo;
|
||||||
|
public $iTopPlotMargin=10,$iBottomPlotMargin=15;
|
||||||
|
public $iVertLines=-1;
|
||||||
|
public $iVertHeaderSize=-1;
|
||||||
// The width of the labels (defaults to the widest of all labels)
|
// The width of the labels (defaults to the widest of all labels)
|
||||||
var $iLabelWidth;
|
private $iLabelWidth;
|
||||||
// Out image to stroke the scale to
|
// Out image to stroke the scale to
|
||||||
var $iImg;
|
private $iImg;
|
||||||
var $iTableHeaderBackgroundColor="white",$iTableHeaderFrameColor="black";
|
private $iTableHeaderBackgroundColor="white",$iTableHeaderFrameColor="black";
|
||||||
var $iTableHeaderFrameWeight=1;
|
private $iTableHeaderFrameWeight=1;
|
||||||
var $iAvailableHeight=-1,$iVertSpacing=-1,$iVertHeaderSize=-1;
|
private $iAvailableHeight=-1,$iVertSpacing=-1;
|
||||||
var $iDateLocale;
|
private $iDateLocale;
|
||||||
var $iVertLayout=GANTT_EVEN;
|
private $iVertLayout=GANTT_EVEN;
|
||||||
var $iTopPlotMargin=10,$iBottomPlotMargin=15;
|
private $iUsePlotWeekendBackground=true;
|
||||||
var $iUsePlotWeekendBackground=true;
|
private $iWeekStart = 1; // Default to have weekends start on Monday
|
||||||
var $iWeekStart = 1; // Default to have weekends start on Monday
|
|
||||||
var $actinfo;
|
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function GanttScale(&$aImg) {
|
function GanttScale($aImg) {
|
||||||
$this->iImg = &$aImg;
|
$this->iImg = $aImg;
|
||||||
$this->iDateLocale = new DateLocale();
|
$this->iDateLocale = new DateLocale();
|
||||||
|
|
||||||
$this->minute = new HeaderProperty();
|
$this->minute = new HeaderProperty();
|
||||||
@ -2212,7 +2214,8 @@ class GanttScale {
|
|||||||
$img=$this->iImg;
|
$img=$this->iImg;
|
||||||
$ph=$this->iAvailableHeight;
|
$ph=$this->iAvailableHeight;
|
||||||
if( $aPos > $this->iVertLines )
|
if( $aPos > $this->iVertLines )
|
||||||
JpGraphError::Raise("Illegal vertical position $aPos");
|
JpGraphError::RaiseL(6015,$aPos);
|
||||||
|
// 'Illegal vertical position %d'
|
||||||
if( $this->iVertLayout == GANTT_EVEN ) {
|
if( $this->iVertLayout == GANTT_EVEN ) {
|
||||||
// Position the top bar at 1 vert spacing from the scale
|
// Position the top bar at 1 vert spacing from the scale
|
||||||
return round($img->top_margin + $this->iVertHeaderSize + ($aPos+1)*$this->iVertSpacing);
|
return round($img->top_margin + $this->iVertHeaderSize + ($aPos+1)*$this->iVertSpacing);
|
||||||
@ -2234,14 +2237,16 @@ class GanttScale {
|
|||||||
if( is_string($aDate) ) {
|
if( is_string($aDate) ) {
|
||||||
$t = strtotime($aDate);
|
$t = strtotime($aDate);
|
||||||
if( $t === FALSE || $t === -1 ) {
|
if( $t === FALSE || $t === -1 ) {
|
||||||
JpGraphError::Raise("Date string ($aDate) specified for Gantt activity can not be interpretated. Please make sure it is a valid time string, e.g. 2005-04-23 13:30");
|
JpGraphError::RaiseL(6016,$aDate);
|
||||||
|
//("Date string ($aDate) specified for Gantt activity can not be interpretated. Please make sure it is a valid time string, e.g. 2005-04-23 13:30");
|
||||||
}
|
}
|
||||||
return $t;
|
return $t;
|
||||||
}
|
}
|
||||||
elseif( is_int($aDate) || is_float($aDate) )
|
elseif( is_int($aDate) || is_float($aDate) )
|
||||||
return $aDate;
|
return $aDate;
|
||||||
else
|
else
|
||||||
JpGraphError::Raise("Unknown date format in GanttScale ($aDate).");
|
JpGraphError::RaiseL(6017,$aDate);
|
||||||
|
//Unknown date format in GanttScale ($aDate).");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2285,7 +2290,8 @@ class GanttScale {
|
|||||||
$minint = $this->minute->GetIntervall() ;
|
$minint = $this->minute->GetIntervall() ;
|
||||||
|
|
||||||
if( 60 % $minint !== 0 ) {
|
if( 60 % $minint !== 0 ) {
|
||||||
JpGraphError::Raise('Intervall for minutes must divide the hour evenly, e.g. 1,5,10,12,15,20,30 etc You have specified an intervall of '.$minint.' minutes.');
|
JpGraphError::RaiseL(6018,$minint);
|
||||||
|
//'Intervall for minutes must divide the hour evenly, e.g. 1,5,10,12,15,20,30 etc You have specified an intervall of '.$minint.' minutes.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2294,7 +2300,8 @@ class GanttScale {
|
|||||||
$width = $this->GetHourWidth() / $n ;
|
$width = $this->GetHourWidth() / $n ;
|
||||||
if( $width < 8 ) {
|
if( $width < 8 ) {
|
||||||
// TO small width to draw minute scale
|
// TO small width to draw minute scale
|
||||||
JpGraphError::Raise('The available width ('.$width.') for minutes are to small for this scale to be displayed. Please use auto-sizing or increase the width of the graph.');
|
JpGraphError::RaiseL(6019,$width);
|
||||||
|
//('The available width ('.$width.') for minutes are to small for this scale to be displayed. Please use auto-sizing or increase the width of the graph.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$nh = ceil(24*60 / $this->TimeToMinutes($this->hour->GetIntervall()) );
|
$nh = ceil(24*60 / $this->TimeToMinutes($this->hour->GetIntervall()) );
|
||||||
@ -2379,7 +2386,8 @@ class GanttScale {
|
|||||||
$tmp = $this->hour->GetIntervall() ;
|
$tmp = $this->hour->GetIntervall() ;
|
||||||
$minint = $this->TimeToMinutes($tmp);
|
$minint = $this->TimeToMinutes($tmp);
|
||||||
if( 1440 % $minint !== 0 ) {
|
if( 1440 % $minint !== 0 ) {
|
||||||
JpGraphError::Raise('Intervall for hours must divide the day evenly, e.g. 0:30, 1:00, 1:30, 4:00 etc. You have specified an intervall of '.$tmp);
|
JpGraphError::RaiseL(6020,$tmp);
|
||||||
|
//('Intervall for hours must divide the day evenly, e.g. 0:30, 1:00, 1:30, 4:00 etc. You have specified an intervall of '.$tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
$n = ceil(24*60 / $minint );
|
$n = ceil(24*60 / $minint );
|
||||||
@ -2598,7 +2606,8 @@ class GanttScale {
|
|||||||
$txtOffset = 3;
|
$txtOffset = 3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
JpGraphError::Raise("Unknown formatting style for week.");
|
JpGraphError::RaiseL(6021);
|
||||||
|
//("Unknown formatting style for week.");
|
||||||
|
|
||||||
for($i=0; $i<$this->GetNumberOfDays()/7; ++$i, $x+=$weekwidth) {
|
for($i=0; $i<$this->GetNumberOfDays()/7; ++$i, $x+=$weekwidth) {
|
||||||
$img->PushColor($this->week->iTextColor);
|
$img->PushColor($this->week->iTextColor);
|
||||||
@ -2848,12 +2857,14 @@ class GanttScale {
|
|||||||
// Main entry point to stroke scale
|
// Main entry point to stroke scale
|
||||||
function Stroke() {
|
function Stroke() {
|
||||||
if( !$this->IsRangeSet() )
|
if( !$this->IsRangeSet() )
|
||||||
JpGraphError::Raise("Gantt scale has not been specified.");
|
JpGraphError::RaiseL(6022);
|
||||||
|
//("Gantt scale has not been specified.");
|
||||||
$img=$this->iImg;
|
$img=$this->iImg;
|
||||||
|
|
||||||
// If minutes are displayed then hour interval must be 1
|
// If minutes are displayed then hour interval must be 1
|
||||||
if( $this->IsDisplayMinute() && $this->hour->GetIntervall() > 1 ) {
|
if( $this->IsDisplayMinute() && $this->hour->GetIntervall() > 1 ) {
|
||||||
JpGraphError::Raise('If you display both hour and minutes the hour intervall must be 1 (Otherwise it doesn\' make sense to display minutes).');
|
JpGraphError::RaiseL(6023);
|
||||||
|
//('If you display both hour and minutes the hour intervall must be 1 (Otherwise it doesn\' make sense to display minutes).');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stroke all headers. As argument we supply the offset from the
|
// Stroke all headers. As argument we supply the offset from the
|
||||||
@ -2895,11 +2906,11 @@ class GanttScale {
|
|||||||
// Just a structure to store all the values for a constraint
|
// Just a structure to store all the values for a constraint
|
||||||
//===================================================
|
//===================================================
|
||||||
class GanttConstraint {
|
class GanttConstraint {
|
||||||
var $iConstrainType;
|
public $iConstrainRow;
|
||||||
var $iConstrainRow;
|
public $iConstrainType;
|
||||||
var $iConstrainColor;
|
public $iConstrainColor;
|
||||||
var $iConstrainArrowSize;
|
public $iConstrainArrowSize;
|
||||||
var $iConstrainArrowType;
|
public $iConstrainArrowType;
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
@ -2918,15 +2929,14 @@ class GanttConstraint {
|
|||||||
// The common signature for a Gantt object
|
// The common signature for a Gantt object
|
||||||
//===================================================
|
//===================================================
|
||||||
class GanttPlotObject {
|
class GanttPlotObject {
|
||||||
var $iVPos=0; // Vertical position
|
public $title,$caption;
|
||||||
var $iLabelLeftMargin=2; // Title margin
|
public $csimarea='',$csimtarget='',$csimalt='';
|
||||||
var $iStart=""; // Start date
|
public $constraints = array();
|
||||||
var $title,$caption;
|
public $iCaptionMargin=5;
|
||||||
var $iCaptionMargin=5;
|
public $iConstrainPos=array();
|
||||||
var $csimarea='',$csimtarget='',$csimalt='';
|
protected $iStart=""; // Start date
|
||||||
|
public $iVPos=0; // Vertical position
|
||||||
var $constraints = array();
|
protected $iLabelLeftMargin=2; // Title margin
|
||||||
var $iConstrainPos=array();
|
|
||||||
|
|
||||||
function GanttPlotObject() {
|
function GanttPlotObject() {
|
||||||
$this->title = new TextProperty();
|
$this->title = new TextProperty();
|
||||||
@ -2941,11 +2951,13 @@ class GanttPlotObject {
|
|||||||
function SetCSIMTarget($aTarget,$aAlt='') {
|
function SetCSIMTarget($aTarget,$aAlt='') {
|
||||||
if( !is_string($aTarget) ) {
|
if( !is_string($aTarget) ) {
|
||||||
$tv = substr(var_export($aTarget,true),0,40);
|
$tv = substr(var_export($aTarget,true),0,40);
|
||||||
JpGraphError::Raise('CSIM Target must be specified as a string.'."\nStart of target is:\n$tv");
|
JpGraphError::RaiseL(6024,$tv);
|
||||||
|
//('CSIM Target must be specified as a string.'."\nStart of target is:\n$tv");
|
||||||
}
|
}
|
||||||
if( !is_string($aAlt) ) {
|
if( !is_string($aAlt) ) {
|
||||||
$tv = substr(var_export($aAlt,true),0,40);
|
$tv = substr(var_export($aAlt,true),0,40);
|
||||||
JpGraphError::Raise('CSIM Alt text must be specified as a string.'."\nStart of alt text is:\n$tv");
|
JpGraphError::RaiseL(6025,$tv);
|
||||||
|
//('CSIM Alt text must be specified as a string.'."\nStart of alt text is:\n$tv");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->csimtarget=$aTarget;
|
$this->csimtarget=$aTarget;
|
||||||
@ -2955,7 +2967,8 @@ class GanttPlotObject {
|
|||||||
function SetCSIMAlt($aAlt) {
|
function SetCSIMAlt($aAlt) {
|
||||||
if( !is_string($aAlt) ) {
|
if( !is_string($aAlt) ) {
|
||||||
$tv = substr(var_export($aAlt,true),0,40);
|
$tv = substr(var_export($aAlt,true),0,40);
|
||||||
JpGraphError::Raise('CSIM Alt text must be specified as a string.'."\nStart of alt text is:\n$tv");
|
JpGraphError::RaiseL(6025,$tv);
|
||||||
|
//('CSIM Alt text must be specified as a string.'."\nStart of alt text is:\n$tv");
|
||||||
}
|
}
|
||||||
$this->csimalt=$aAlt;
|
$this->csimalt=$aAlt;
|
||||||
}
|
}
|
||||||
@ -3011,13 +3024,15 @@ class GanttPlotObject {
|
|||||||
// displyed within a bar
|
// displyed within a bar
|
||||||
//===================================================
|
//===================================================
|
||||||
class Progress {
|
class Progress {
|
||||||
var $iProgress=-1, $iColor="black", $iFillColor='black';
|
public $iProgress=-1;
|
||||||
var $iPattern=GANTT_SOLID;
|
public $iPattern=GANTT_SOLID;
|
||||||
var $iDensity=98, $iHeight=0.65;
|
public $iColor="black", $iFillColor='black';
|
||||||
|
public $iDensity=98, $iHeight=0.65;
|
||||||
|
|
||||||
function Set($aProg) {
|
function Set($aProg) {
|
||||||
if( $aProg < 0.0 || $aProg > 1.0 )
|
if( $aProg < 0.0 || $aProg > 1.0 )
|
||||||
JpGraphError::Raise("Progress value must in range [0, 1]");
|
JpGraphError::RaiseL(6027);
|
||||||
|
//("Progress value must in range [0, 1]");
|
||||||
$this->iProgress = $aProg;
|
$this->iProgress = $aProg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3044,11 +3059,11 @@ DEFINE('GANTT_HGRID2',1);
|
|||||||
// Responsible for drawinf horizontal gridlines and filled alternatibg rows
|
// Responsible for drawinf horizontal gridlines and filled alternatibg rows
|
||||||
//===================================================
|
//===================================================
|
||||||
class HorizontalGridLine {
|
class HorizontalGridLine {
|
||||||
var $iGraph=NULL;
|
private $iGraph=NULL;
|
||||||
var $iRowColor1 = '', $iRowColor2 = '';
|
private $iRowColor1 = '', $iRowColor2 = '';
|
||||||
var $iShow=false;
|
private $iShow=false;
|
||||||
var $line=null;
|
private $line=null;
|
||||||
var $iStart=0; // 0=from left margin, 1=just along header
|
private $iStart=0; // 0=from left margin, 1=just along header
|
||||||
|
|
||||||
function HorizontalGridLine() {
|
function HorizontalGridLine() {
|
||||||
$this->line = new LineProperty();
|
$this->line = new LineProperty();
|
||||||
@ -3123,13 +3138,13 @@ class HorizontalGridLine {
|
|||||||
// Responsible for formatting individual gantt bars
|
// Responsible for formatting individual gantt bars
|
||||||
//===================================================
|
//===================================================
|
||||||
class GanttBar extends GanttPlotObject {
|
class GanttBar extends GanttPlotObject {
|
||||||
var $iEnd;
|
public $progress;
|
||||||
var $iHeightFactor=0.5;
|
public $leftMark,$rightMark;
|
||||||
var $iFillColor="white",$iFrameColor="black";
|
private $iEnd;
|
||||||
var $iShadow=false,$iShadowColor="darkgray",$iShadowWidth=1,$iShadowFrame="black";
|
private $iHeightFactor=0.5;
|
||||||
var $iPattern=GANTT_RDIAG,$iPatternColor="blue",$iPatternDensity=95;
|
private $iFillColor="white",$iFrameColor="black";
|
||||||
var $leftMark,$rightMark;
|
private $iShadow=false,$iShadowColor="darkgray",$iShadowWidth=1,$iShadowFrame="black";
|
||||||
var $progress;
|
private $iPattern=GANTT_RDIAG,$iPatternColor="blue",$iPatternDensity=95;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function GanttBar($aPos,$aLabel,$aStart,$aEnd,$aCaption="",$aHeightFactor=0.6) {
|
function GanttBar($aPos,$aLabel,$aStart,$aEnd,$aCaption="",$aHeightFactor=0.6) {
|
||||||
@ -3215,7 +3230,8 @@ class GanttBar extends GanttPlotObject {
|
|||||||
elseif(is_int($this->iHeightFactor) && $this->iHeightFactor>2 && $this->iHeightFactor < 200 )
|
elseif(is_int($this->iHeightFactor) && $this->iHeightFactor>2 && $this->iHeightFactor < 200 )
|
||||||
$vs = $this->iHeightFactor;
|
$vs = $this->iHeightFactor;
|
||||||
else
|
else
|
||||||
JpGraphError::Raise("Specified height (".$this->iHeightFactor.") for gantt bar is out of range.");
|
JpGraphError::RaiseL(6028,$this->iHeightFactor);
|
||||||
|
//("Specified height (".$this->iHeightFactor.") for gantt bar is out of range.");
|
||||||
|
|
||||||
// Clip date to min max dates to show
|
// Clip date to min max dates to show
|
||||||
$st = $aScale->NormalizeDate($this->iStart);
|
$st = $aScale->NormalizeDate($this->iStart);
|
||||||
@ -3353,7 +3369,7 @@ class GanttBar extends GanttPlotObject {
|
|||||||
// Responsible for formatting individual milestones
|
// Responsible for formatting individual milestones
|
||||||
//===================================================
|
//===================================================
|
||||||
class MileStone extends GanttPlotObject {
|
class MileStone extends GanttPlotObject {
|
||||||
var $mark;
|
public $mark;
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
@ -3443,7 +3459,7 @@ class TextPropertyBelow extends TextProperty {
|
|||||||
parent::TextProperty($aTxt);
|
parent::TextProperty($aTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetColWidth($aImg,$margin) {
|
function GetColWidth($aImg,$aMargin=0) {
|
||||||
// Since we are not stroking the title in the columns
|
// Since we are not stroking the title in the columns
|
||||||
// but rather under the graph we want this to return 0.
|
// but rather under the graph we want this to return 0.
|
||||||
return array(0);
|
return array(0);
|
||||||
@ -3452,8 +3468,7 @@ class TextPropertyBelow extends TextProperty {
|
|||||||
|
|
||||||
class GanttVLine extends GanttPlotObject {
|
class GanttVLine extends GanttPlotObject {
|
||||||
|
|
||||||
var $iLine,$title_margin=3;
|
private $iLine,$title_margin=3, $iDayOffset=1;
|
||||||
var $iDayOffset=1; // Defult to right edge of day
|
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
@ -3473,7 +3488,8 @@ class GanttVLine extends GanttPlotObject {
|
|||||||
|
|
||||||
function SetDayOffset($aOff=0.5) {
|
function SetDayOffset($aOff=0.5) {
|
||||||
if( $aOff < 0.0 || $aOff > 1.0 )
|
if( $aOff < 0.0 || $aOff > 1.0 )
|
||||||
JpGraphError::Raise("Offset for vertical line must be in range [0,1]");
|
JpGraphError::RaiseL(6029);
|
||||||
|
//("Offset for vertical line must be in range [0,1]");
|
||||||
$this->iDayOffset = $aOff;
|
$this->iDayOffset = $aOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3501,11 +3517,11 @@ class GanttVLine extends GanttPlotObject {
|
|||||||
// Handles the drawing of a an arrow
|
// Handles the drawing of a an arrow
|
||||||
//===================================================
|
//===================================================
|
||||||
class LinkArrow {
|
class LinkArrow {
|
||||||
var $ix,$iy;
|
private $ix,$iy;
|
||||||
var $isizespec = array(
|
private $isizespec = array(
|
||||||
array(2,3),array(3,5),array(3,8),array(6,15),array(8,22));
|
array(2,3),array(3,5),array(3,8),array(6,15),array(8,22));
|
||||||
var $iDirection=ARROW_DOWN,$iType=ARROWT_SOLID,$iSize=ARROW_S2;
|
private $iDirection=ARROW_DOWN,$iType=ARROWT_SOLID,$iSize=ARROW_S2;
|
||||||
var $iColor='black';
|
private $iColor='black';
|
||||||
|
|
||||||
function LinkArrow($x,$y,$aDirection,$aType=ARROWT_SOLID,$aSize=ARROW_S2) {
|
function LinkArrow($x,$y,$aDirection,$aType=ARROWT_SOLID,$aSize=ARROW_S2) {
|
||||||
$this->iDirection = $aDirection;
|
$this->iDirection = $aDirection;
|
||||||
@ -3545,7 +3561,8 @@ class LinkArrow {
|
|||||||
$c = array($x,$y,$x-$dy,$y-$dx,$x-$dy,$y+$dx,$x,$y);
|
$c = array($x,$y,$x-$dy,$y-$dx,$x-$dy,$y+$dx,$x,$y);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise('Unknown arrow direction for link.');
|
JpGraphError::RaiseL(6030);
|
||||||
|
//('Unknown arrow direction for link.');
|
||||||
die();
|
die();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3558,7 +3575,8 @@ class LinkArrow {
|
|||||||
$aImg->Polygon($c);
|
$aImg->Polygon($c);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise('Unknown arrow type for link.');
|
JpGraphError::RaiseL(6031);
|
||||||
|
//('Unknown arrow type for link.');
|
||||||
die();
|
die();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3571,10 +3589,10 @@ class LinkArrow {
|
|||||||
//===================================================
|
//===================================================
|
||||||
|
|
||||||
class GanttLink {
|
class GanttLink {
|
||||||
var $ix1,$ix2,$iy1,$iy2;
|
private $ix1,$ix2,$iy1,$iy2;
|
||||||
var $iPathType=2,$iPathExtend=15;
|
private $iPathType=2,$iPathExtend=15;
|
||||||
var $iColor='black',$iWeight=1;
|
private $iColor='black',$iWeight=1;
|
||||||
var $iArrowSize=ARROW_S2,$iArrowType=ARROWT_SOLID;
|
private $iArrowSize=ARROW_S2,$iArrowType=ARROWT_SOLID;
|
||||||
|
|
||||||
function GanttLink($x1=0,$y1=0,$x2=0,$y2=0) {
|
function GanttLink($x1=0,$y1=0,$x2=0,$y2=0) {
|
||||||
$this->ix1 = $x1;
|
$this->ix1 = $x1;
|
||||||
@ -3643,7 +3661,8 @@ class GanttLink {
|
|||||||
$c = array($x1,$y1,$x2,$y1,$x2,$y2);
|
$c = array($x1,$y1,$x2,$y1,$x2,$y2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise('Internal error: Unknown path type (='.$this->iPathType .') specified for link.');
|
JpGraphError::RaiseL(6032,$this->iPathType);
|
||||||
|
//('Internal error: Unknown path type (='.$this->iPathType .') specified for link.');
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3676,7 +3695,8 @@ class GanttLink {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise('Internal error: Unknown path type specified for link.');
|
JpGraphError::RaiseL(6032,$this->iPathType);
|
||||||
|
//('Internal error: Unknown path type specified for link.');
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3703,7 +3723,8 @@ class GanttLink {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise('Internal error: Unknown path type specified for link.');
|
JpGraphError::RaiseL(6032,$this->iPathType);
|
||||||
|
//('Internal error: Unknown path type specified for link.');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3731,8 +3752,8 @@ class GanttLink {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise('Internal error: Unknown path type specified for link.');
|
JpGraphError::RaiseL(6032,$this->iPathType);
|
||||||
exit(1);
|
//('Internal error: Unknown path type specified for link.');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: PHP4 Graph Plotting library. Chinese font conversions
|
// Description: PHP4 Graph Plotting library. Chinese font conversions
|
||||||
// Created: 2003-05-30
|
// Created: 2003-05-30
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_gb2312.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_gb2312.php 20 2005-05-30 20:34:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -15,7 +15,7 @@ class GB2312toUTF8 {
|
|||||||
// This code table is used to translate GB2312 code (key) to
|
// This code table is used to translate GB2312 code (key) to
|
||||||
// it's corresponding Unicode value (data)
|
// it's corresponding Unicode value (data)
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
var $codetable = array(
|
private $codetable = array(
|
||||||
8481 => 12288, 8482 => 12289, 8483 => 12290, 8484 => 12539, 8485 => 713,
|
8481 => 12288, 8482 => 12289, 8483 => 12290, 8484 => 12539, 8485 => 713,
|
||||||
8486 => 711, 8487 => 168, 8488 => 12291, 8489 => 12293, 8490 => 8213,
|
8486 => 711, 8487 => 168, 8488 => 12291, 8489 => 12293, 8490 => 8213,
|
||||||
8491 => 65374, 8492 => 8214, 8493 => 8230, 8494 => 8216, 8495 => 8217,
|
8491 => 65374, 8492 => 8214, 8493 => 8230, 8494 => 8216, 8495 => 8217,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Create a color gradient
|
// Description: Create a color gradient
|
||||||
// Created: 2003-02-01
|
// Created: 2003-02-01
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_gradient.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_gradient.php 630 2006-05-26 00:09:30Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -22,7 +22,7 @@ DEFINE("GRAD_WIDE_MIDHOR",7);
|
|||||||
DEFINE("GRAD_LEFT_REFLECTION",8);
|
DEFINE("GRAD_LEFT_REFLECTION",8);
|
||||||
DEFINE("GRAD_RIGHT_REFLECTION",9);
|
DEFINE("GRAD_RIGHT_REFLECTION",9);
|
||||||
DEFINE("GRAD_RAISED_PANEL",10);
|
DEFINE("GRAD_RAISED_PANEL",10);
|
||||||
|
DEFINE("GRAD_DIAGONAL",11);
|
||||||
|
|
||||||
//===================================================
|
//===================================================
|
||||||
// CLASS Gradient
|
// CLASS Gradient
|
||||||
@ -30,8 +30,7 @@ DEFINE("GRAD_RAISED_PANEL",10);
|
|||||||
// considered a "friend" class of Class Image.
|
// considered a "friend" class of Class Image.
|
||||||
//===================================================
|
//===================================================
|
||||||
class Gradient {
|
class Gradient {
|
||||||
var $img=null;
|
private $img=null, $numcolors=100;
|
||||||
var $numcolors=100;
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function Gradient(&$img) {
|
function Gradient(&$img) {
|
||||||
@ -269,8 +268,57 @@ class Gradient {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GRAD_DIAGONAL:
|
||||||
|
// use the longer dimension to determine the required number of steps.
|
||||||
|
// first loop draws from one corner to the mid-diagonal and the second
|
||||||
|
// loop draws from the mid-diagonal to the opposing corner.
|
||||||
|
if($xr-$xl > $yb - $yt) {
|
||||||
|
// width is greater than height -> use x-dimension for steps
|
||||||
|
$steps = $xr-$xl;
|
||||||
|
$delta = $xr>=$xl ? 1 : -1;
|
||||||
|
$this->GetColArray($from_color,$to_color,$steps*2,$colors,$this->numcolors);
|
||||||
|
$n = count($colors);
|
||||||
|
|
||||||
|
for($x=$xl, $i=0; $i < $steps && $i < $n; ++$i) {
|
||||||
|
$this->img->current_color = $colors[$i];
|
||||||
|
$y = $yt+($i/$steps)*($yb-$yt)*$delta;
|
||||||
|
$this->img->Line($x,$yt,$xl,$y);
|
||||||
|
$x += $delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
for($x=$xl, $i = 0; $i < $steps && $i < $n; ++$i) {
|
||||||
|
$this->img->current_color = $colors[$steps+$i];
|
||||||
|
$y = $yt+($i/$steps)*($yb-$yt)*$delta;
|
||||||
|
$this->img->Line($x,$yb,$xr,$y);
|
||||||
|
$x += $delta;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// height is greater than width -> use y-dimension for steps
|
||||||
|
$steps = $yb-$yt;
|
||||||
|
$delta = $yb>=$yt ? 1 : -1;
|
||||||
|
$this->GetColArray($from_color,$to_color,$steps*2,$colors,$this->numcolors);
|
||||||
|
$n = count($colors);
|
||||||
|
|
||||||
|
for($y=$yt, $i=0; $i < $steps && $i < $n; ++$i) {
|
||||||
|
$this->img->current_color = $colors[$i];
|
||||||
|
$x = $xl+($i/$steps)*($xr-$xl)*$delta;
|
||||||
|
$this->img->Line($x,$yt,$xl,$y);
|
||||||
|
$y += $delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
for($y=$yt, $i = 0; $i < $steps && $i < $n; ++$i) {
|
||||||
|
$this->img->current_color = $colors[$steps+$i];
|
||||||
|
$x = $xl+($i/$steps)*($xr-$xl)*$delta;
|
||||||
|
$this->img->Line($x,$yb,$xr,$y);
|
||||||
|
$x += $delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise("Unknown gradient style (=$style).");
|
JpGraphError::RaiseL(7001,$style);
|
||||||
|
//("Unknown gradient style (=$style).");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: PHP4 Graph Plotting library. Extension module.
|
// Description: PHP4 Graph Plotting library. Extension module.
|
||||||
// Created: 2004-02-18
|
// Created: 2004-02-18
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_iconplot.php 184 2005-08-31 16:17:19Z ljp $
|
// Ver: $Id: jpgraph_iconplot.php 575 2006-03-04 11:04:59Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -16,14 +16,14 @@
|
|||||||
// to the graph
|
// to the graph
|
||||||
//===================================================
|
//===================================================
|
||||||
class IconPlot {
|
class IconPlot {
|
||||||
var $iHorAnchor='left',$iVertAnchor='top';
|
public $iX=0,$iY=0,$iScale=1.0,$iMix=100;
|
||||||
var $iX=0,$iY=0;
|
private $iHorAnchor='left',$iVertAnchor='top';
|
||||||
var $iFile='';
|
private $iFile='';
|
||||||
var $iScale=1.0,$iMix=100;
|
private $iAnchors = array('left','right','top','bottom','center');
|
||||||
var $iAnchors = array('left','right','top','bottom','center');
|
private $iCountryFlag='',$iCountryStdSize=3;
|
||||||
var $iCountryFlag='',$iCountryStdSize=3;
|
private $iScalePosY=null,$iScalePosX=null;
|
||||||
var $iScalePosY=null,$iScalePosX=null;
|
private $iImgString='';
|
||||||
var $iImgString='';
|
|
||||||
|
|
||||||
function IconPlot($aFile="",$aX=0,$aY=0,$aScale=1.0,$aMix=100) {
|
function IconPlot($aFile="",$aX=0,$aY=0,$aScale=1.0,$aMix=100) {
|
||||||
$this->iFile = $aFile;
|
$this->iFile = $aFile;
|
||||||
@ -31,22 +31,18 @@ class IconPlot {
|
|||||||
$this->iY=$aY;
|
$this->iY=$aY;
|
||||||
$this->iScale= $aScale;
|
$this->iScale= $aScale;
|
||||||
if( $aMix < 0 || $aMix > 100 ) {
|
if( $aMix < 0 || $aMix > 100 ) {
|
||||||
JpGraphError::Raise('Mix value for icon must be between 0 and 100.');
|
JpGraphError::RaiseL(8001); //('Mix value for icon must be between 0 and 100.');
|
||||||
}
|
}
|
||||||
$this->iMix = $aMix ;
|
$this->iMix = $aMix ;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateFromString($aStr) {
|
|
||||||
$this->iImgString = $aStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function SetCountryFlag($aFlag,$aX=0,$aY=0,$aScale=1.0,$aMix=100,$aStdSize=3) {
|
function SetCountryFlag($aFlag,$aX=0,$aY=0,$aScale=1.0,$aMix=100,$aStdSize=3) {
|
||||||
$this->iCountryFlag = $aFlag;
|
$this->iCountryFlag = $aFlag;
|
||||||
$this->iX=$aX;
|
$this->iX=$aX;
|
||||||
$this->iY=$aY;
|
$this->iY=$aY;
|
||||||
$this->iScale= $aScale;
|
$this->iScale= $aScale;
|
||||||
if( $aMix < 0 || $aMix > 100 ) {
|
if( $aMix < 0 || $aMix > 100 ) {
|
||||||
JpGraphError::Raise('Mix value for icon must be between 0 and 100.');
|
JpGraphError::RaiseL(8001);//'Mix value for icon must be between 0 and 100.');
|
||||||
}
|
}
|
||||||
$this->iMix = $aMix;
|
$this->iMix = $aMix;
|
||||||
$this->iCountryStdSize = $aStdSize;
|
$this->iCountryStdSize = $aStdSize;
|
||||||
@ -57,6 +53,10 @@ class IconPlot {
|
|||||||
$this->iY=$aY;
|
$this->iY=$aY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CreateFromString($aStr) {
|
||||||
|
$this->iImgString = $aStr;
|
||||||
|
}
|
||||||
|
|
||||||
function SetScalePos($aX,$aY) {
|
function SetScalePos($aX,$aY) {
|
||||||
$this->iScalePosX = $aX;
|
$this->iScalePosX = $aX;
|
||||||
$this->iScalePosY = $aY;
|
$this->iScalePosY = $aY;
|
||||||
@ -68,7 +68,7 @@ class IconPlot {
|
|||||||
|
|
||||||
function SetMix($aMix) {
|
function SetMix($aMix) {
|
||||||
if( $aMix < 0 || $aMix > 100 ) {
|
if( $aMix < 0 || $aMix > 100 ) {
|
||||||
JpGraphError::Raise('Mix value for icon must be between 0 and 100.');
|
JpGraphError::RaiseL(8001);//('Mix value for icon must be between 0 and 100.');
|
||||||
}
|
}
|
||||||
$this->iMix = $aMix ;
|
$this->iMix = $aMix ;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ class IconPlot {
|
|||||||
function SetAnchor($aXAnchor='left',$aYAnchor='center') {
|
function SetAnchor($aXAnchor='left',$aYAnchor='center') {
|
||||||
if( !in_array($aXAnchor,$this->iAnchors) ||
|
if( !in_array($aXAnchor,$this->iAnchors) ||
|
||||||
!in_array($aYAnchor,$this->iAnchors) ) {
|
!in_array($aYAnchor,$this->iAnchors) ) {
|
||||||
JpGraphError::Raise("Anchor position for icons must be one of 'top', 'bottom', 'left', 'right' or 'center'");
|
JpGraphError::RaiseL(8002);//("Anchor position for icons must be one of 'top', 'bottom', 'left', 'right' or 'center'");
|
||||||
}
|
}
|
||||||
$this->iHorAnchor=$aXAnchor;
|
$this->iHorAnchor=$aXAnchor;
|
||||||
$this->iVertAnchor=$aYAnchor;
|
$this->iVertAnchor=$aYAnchor;
|
||||||
@ -128,10 +128,14 @@ class IconPlot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GetWidthHeight() {
|
||||||
|
$dummy=0;
|
||||||
|
return $this->_Stroke($dummy,null,null,true);
|
||||||
|
}
|
||||||
|
|
||||||
function _Stroke($aImg,$x=null,$y=null) {
|
function _Stroke($aImg,$x=null,$y=null,$aReturnWidthHeight=false) {
|
||||||
if( $this->iFile != '' && $this->iCountryFlag != '' ) {
|
if( $this->iFile != '' && $this->iCountryFlag != '' ) {
|
||||||
JpGraphError::Raise('It is not possible to specify both an image file and a country flag for the same icon.');
|
JpGraphError::RaiseL(8003);//('It is not possible to specify both an image file and a country flag for the same icon.');
|
||||||
}
|
}
|
||||||
if( $this->iFile != '' ) {
|
if( $this->iFile != '' ) {
|
||||||
$gdimg = Graph::LoadBkgImage('',$this->iFile);
|
$gdimg = Graph::LoadBkgImage('',$this->iFile);
|
||||||
@ -139,14 +143,23 @@ class IconPlot {
|
|||||||
elseif( $this->iImgString != '') {
|
elseif( $this->iImgString != '') {
|
||||||
$gdimg = Image::CreateFromString($this->iImgString);
|
$gdimg = Image::CreateFromString($this->iImgString);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
if( ! class_exists('FlagImages') ) {
|
if( ! class_exists('FlagImages',false) ) {
|
||||||
JpGraphError::Raise('In order to use Country flags as icons you must include the "jpgraph_flags.php" file.');
|
JpGraphError::RaiseL(8004);//('In order to use Country flags as icons you must include the "jpgraph_flags.php" file.');
|
||||||
}
|
}
|
||||||
$fobj = new FlagImages($this->iCountryStdSize);
|
$fobj = new FlagImages($this->iCountryStdSize);
|
||||||
$dummy='';
|
$dummy='';
|
||||||
$gdimg = $fobj->GetImgByName($this->iCountryFlag,$dummy);
|
$gdimg = $fobj->GetImgByName($this->iCountryFlag,$dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$iconw = imagesx($gdimg);
|
||||||
|
$iconh = imagesy($gdimg);
|
||||||
|
|
||||||
|
if( $aReturnWidthHeight ) {
|
||||||
|
return array(round($iconw*$this->iScale),round($iconh*$this->iScale));
|
||||||
|
}
|
||||||
|
|
||||||
if( $x !== null && $y !== null ) {
|
if( $x !== null && $y !== null ) {
|
||||||
$this->iX = $x; $this->iY = $y;
|
$this->iX = $x; $this->iY = $y;
|
||||||
}
|
}
|
||||||
@ -158,8 +171,6 @@ class IconPlot {
|
|||||||
$h = imagesy($aImg->img);
|
$h = imagesy($aImg->img);
|
||||||
$this->iY = round($h*$this->iY);
|
$this->iY = round($h*$this->iY);
|
||||||
}
|
}
|
||||||
$iconw = imagesx($gdimg);
|
|
||||||
$iconh = imagesy($gdimg);
|
|
||||||
|
|
||||||
if( $this->iHorAnchor == 'center' )
|
if( $this->iHorAnchor == 'center' )
|
||||||
$this->iX -= round($iconw*$this->iScale/2);
|
$this->iX -= round($iconw*$this->iScale/2);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Extension for JpGraph to do some simple img transformations
|
// Description: Extension for JpGraph to do some simple img transformations
|
||||||
// Created: 2003-09-06
|
// Created: 2003-09-06
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_imgtrans.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_imgtrans.php 478 2006-02-04 12:17:06Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -14,7 +14,7 @@
|
|||||||
// Perform some simple image transformations.
|
// Perform some simple image transformations.
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
class ImgTrans {
|
class ImgTrans {
|
||||||
var $gdImg=null;
|
private $gdImg=null;
|
||||||
|
|
||||||
function ImgTrans($aGdImg) {
|
function ImgTrans($aGdImg) {
|
||||||
// Constructor
|
// Constructor
|
||||||
@ -30,7 +30,8 @@ class ImgTrans {
|
|||||||
|
|
||||||
// Parameter check
|
// Parameter check
|
||||||
if( $aHorizonPos < 0 || $aHorizonPos > 1.0 ) {
|
if( $aHorizonPos < 0 || $aHorizonPos > 1.0 ) {
|
||||||
JpGraphError::Raise("Value for image transformation out of bounds.\nVanishing point on horizon must be specified as a value between 0 and 1.");
|
JpGraphError::RaiseL(9001);
|
||||||
|
//("Value for image transformation out of bounds.\nVanishing point on horizon must be specified as a value between 0 and 1.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$w = imagesx($aGdImg);
|
$w = imagesx($aGdImg);
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
// Description: Line plot extension for JpGraph
|
// Description: Line plot extension for JpGraph
|
||||||
// Created: 2001-01-08
|
// Created: 2001-01-08
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_line.php 222 2005-11-04 04:31:40Z ljp $
|
// Ver: $Id: jpgraph_line.php 456 2006-02-04 12:02:41Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once ('jpgraph_plotmark.inc');
|
require_once ('jpgraph_plotmark.inc.php');
|
||||||
|
|
||||||
// constants for the (filled) area
|
// constants for the (filled) area
|
||||||
DEFINE("LP_AREA_FILLED", true);
|
DEFINE("LP_AREA_FILLED", true);
|
||||||
@ -23,20 +23,20 @@ DEFINE("LP_AREA_NO_BORDER",true);
|
|||||||
// Description:
|
// Description:
|
||||||
//===================================================
|
//===================================================
|
||||||
class LinePlot extends Plot{
|
class LinePlot extends Plot{
|
||||||
var $filled=false;
|
public $mark=null;
|
||||||
var $fill_color='blue';
|
protected $filled=false;
|
||||||
var $mark=null;
|
protected $fill_color='blue';
|
||||||
var $step_style=false, $center=false;
|
protected $step_style=false, $center=false;
|
||||||
var $line_style=1; // Default to solid
|
protected $line_style=1; // Default to solid
|
||||||
var $filledAreas = array(); // array of arrays(with min,max,col,filled in them)
|
protected $filledAreas = array(); // array of arrays(with min,max,col,filled in them)
|
||||||
var $barcenter=false; // When we mix line and bar. Should we center the line in the bar.
|
public $barcenter=false; // When we mix line and bar. Should we center the line in the bar.
|
||||||
var $fillFromMin = false ;
|
protected $fillFromMin = false ;
|
||||||
var $fillgrad=false,$fillgrad_fromcolor='navy',$fillgrad_tocolor='silver',$fillgrad_numcolors=100;
|
protected $fillgrad=false,$fillgrad_fromcolor='navy',$fillgrad_tocolor='silver',$fillgrad_numcolors=100;
|
||||||
var $iFastStroke=false;
|
protected $iFastStroke=false;
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function LinePlot(&$datay,$datax=false) {
|
function LinePlot($datay,$datax=false) {
|
||||||
$this->Plot($datay,$datax);
|
$this->Plot($datay,$datax);
|
||||||
$this->mark = new PlotMark() ;
|
$this->mark = new PlotMark() ;
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ class LinePlot extends Plot{
|
|||||||
|
|
||||||
// Set style, filled or open
|
// Set style, filled or open
|
||||||
function SetFilled($aFlag=true) {
|
function SetFilled($aFlag=true) {
|
||||||
JpGraphError::Raise('LinePlot::SetFilled() is deprecated. Use SetFillColor()');
|
JpGraphError::RaiseL(10001);//('LinePlot::SetFilled() is deprecated. Use SetFillColor()');
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetBarCenter($aFlag=true) {
|
function SetBarCenter($aFlag=true) {
|
||||||
@ -81,7 +81,7 @@ class LinePlot extends Plot{
|
|||||||
$this->fillgrad = true;
|
$this->fillgrad = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Legend(&$graph) {
|
function Legend($graph) {
|
||||||
if( $this->legend!="" ) {
|
if( $this->legend!="" ) {
|
||||||
if( $this->filled && !$this->fillgrad ) {
|
if( $this->filled && !$this->fillgrad ) {
|
||||||
$graph->legend->Add($this->legend,
|
$graph->legend->Add($this->legend,
|
||||||
@ -93,8 +93,7 @@ class LinePlot extends Plot{
|
|||||||
// In order to differentiate between gradients and cooors specified as an RGB triple
|
// In order to differentiate between gradients and cooors specified as an RGB triple
|
||||||
$graph->legend->Add($this->legend,$color,"",-2 /* -GRAD_HOR */,
|
$graph->legend->Add($this->legend,$color,"",-2 /* -GRAD_HOR */,
|
||||||
$this->legendcsimtarget,$this->legendcsimalt);
|
$this->legendcsimtarget,$this->legendcsimalt);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$graph->legend->Add($this->legend,
|
$graph->legend->Add($this->legend,
|
||||||
$this->color,$this->mark,$this->line_style,
|
$this->color,$this->mark,$this->line_style,
|
||||||
$this->legendcsimtarget,$this->legendcsimalt);
|
$this->legendcsimtarget,$this->legendcsimalt);
|
||||||
@ -113,7 +112,7 @@ class LinePlot extends Plot{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gets called before any axis are stroked
|
// Gets called before any axis are stroked
|
||||||
function PreStrokeAdjust(&$graph) {
|
function PreStrokeAdjust($graph) {
|
||||||
|
|
||||||
// If another plot type have already adjusted the
|
// If another plot type have already adjusted the
|
||||||
// offset we don't touch it.
|
// offset we don't touch it.
|
||||||
@ -137,7 +136,7 @@ class LinePlot extends Plot{
|
|||||||
$this->iFastStroke = $aFlg;
|
$this->iFastStroke = $aFlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
function FastStroke(&$img,&$xscale,&$yscale,$aStartPoint=0,$exist_x=true) {
|
function FastStroke($img,$xscale,$yscale,$aStartPoint=0,$exist_x=true) {
|
||||||
// An optimized stroke for many data points with no extra
|
// An optimized stroke for many data points with no extra
|
||||||
// features but 60% faster. You can't have values or line styles, or null
|
// features but 60% faster. You can't have values or line styles, or null
|
||||||
// values in plots.
|
// values in plots.
|
||||||
@ -164,21 +163,21 @@ class LinePlot extends Plot{
|
|||||||
// Just ignore
|
// Just ignore
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JpGraphError::Raise('Plot too complicated for fast line Stroke. Use standard Stroke()');
|
JpGraphError::RaiseL(10002);//('Plot too complicated for fast line Stroke. Use standard Stroke()');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
++$pnts;
|
++$pnts;
|
||||||
} // WHILE
|
} // WHILE
|
||||||
|
|
||||||
$img->Polygon($cord,false,true);
|
$img->Polygon($cord,false,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
|
$idx=0;
|
||||||
$numpoints=count($this->coords[0]);
|
$numpoints=count($this->coords[0]);
|
||||||
if( isset($this->coords[1]) ) {
|
if( isset($this->coords[1]) ) {
|
||||||
if( count($this->coords[1])!=$numpoints )
|
if( count($this->coords[1])!=$numpoints )
|
||||||
JpGraphError::Raise("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
JpGraphError::RaiseL(2003,count($this->coords[1]),$numpoints);
|
||||||
|
//("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
||||||
else
|
else
|
||||||
$exist_x = true;
|
$exist_x = true;
|
||||||
}
|
}
|
||||||
@ -212,18 +211,21 @@ class LinePlot extends Plot{
|
|||||||
$img->SetStartPoint($xscale->Translate($xs),
|
$img->SetStartPoint($xscale->Translate($xs),
|
||||||
$yscale->Translate($this->coords[0][$startpoint]));
|
$yscale->Translate($this->coords[0][$startpoint]));
|
||||||
|
|
||||||
|
|
||||||
if( $this->filled ) {
|
if( $this->filled ) {
|
||||||
$cord[] = $xscale->Translate($xs);
|
|
||||||
$min = $yscale->GetMinVal();
|
$min = $yscale->GetMinVal();
|
||||||
if( $min > 0 || $this->fillFromMin )
|
if( $min > 0 || $this->fillFromMin )
|
||||||
$cord[] = $yscale->Translate($min);
|
$fillmin = $yscale->scale_abs[0];//Translate($min);
|
||||||
else
|
else
|
||||||
$cord[] = $yscale->Translate(0);
|
$fillmin = $yscale->Translate(0);
|
||||||
|
|
||||||
|
$cord[$idx++] = $xscale->Translate($xs);
|
||||||
|
$cord[$idx++] = $fillmin;
|
||||||
}
|
}
|
||||||
$xt = $xscale->Translate($xs);
|
$xt = $xscale->Translate($xs);
|
||||||
$yt = $yscale->Translate($this->coords[0][$startpoint]);
|
$yt = $yscale->Translate($this->coords[0][$startpoint]);
|
||||||
$cord[] = $xt;
|
$cord[$idx++] = $xt;
|
||||||
$cord[] = $yt;
|
$cord[$idx++] = $yt;
|
||||||
$yt_old = $yt;
|
$yt_old = $yt;
|
||||||
$xt_old = $xt;
|
$xt_old = $xt;
|
||||||
$y_old = $this->coords[0][$startpoint];
|
$y_old = $this->coords[0][$startpoint];
|
||||||
@ -261,10 +263,10 @@ class LinePlot extends Plot{
|
|||||||
$yt_old = $yt;
|
$yt_old = $yt;
|
||||||
$xt_old = $xt;
|
$xt_old = $xt;
|
||||||
}
|
}
|
||||||
$cord[] = $xt;
|
$cord[$idx++] = $xt;
|
||||||
$cord[] = $yt_old;
|
$cord[$idx++] = $yt_old;
|
||||||
$cord[] = $xt;
|
$cord[$idx++] = $xt;
|
||||||
$cord[] = $yt;
|
$cord[$idx++] = $yt;
|
||||||
}
|
}
|
||||||
elseif( $firstnonumeric==false ) {
|
elseif( $firstnonumeric==false ) {
|
||||||
$firstnonumeric = true;
|
$firstnonumeric = true;
|
||||||
@ -273,19 +275,39 @@ class LinePlot extends Plot{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( is_numeric($y) || (is_string($y) && $y != "-") ) {
|
$tmp1=$y;
|
||||||
$tmp1=$this->coords[0][$pnts];
|
$prev=$this->coords[0][$pnts-1];
|
||||||
$tmp2=$this->coords[0][$pnts-1];
|
if( $tmp1==='' || $tmp1===NULL || $tmp1==='X' ) $tmp1 = 'x';
|
||||||
if( is_numeric($tmp1) && (is_numeric($tmp2) || $tmp2=="-" ) ) {
|
if( $prev==='' || $prev===null || $prev==='X' ) $prev = 'x';
|
||||||
|
|
||||||
|
if( is_numeric($y) || (is_string($y) && $y != '-') ) {
|
||||||
|
if( is_numeric($y) && (is_numeric($prev) || $prev === '-' ) ) {
|
||||||
$img->StyleLineTo($xt,$yt);
|
$img->StyleLineTo($xt,$yt);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img->SetStartPoint($xt,$yt);
|
$img->SetStartPoint($xt,$yt);
|
||||||
}
|
}
|
||||||
if( is_numeric($tmp1) &&
|
}
|
||||||
(is_numeric($tmp2) || $tmp2=="-" || ($this->filled && $tmp2=='') ) ) {
|
if( $this->filled && $tmp1 !== '-' ) {
|
||||||
$cord[] = $xt;
|
if( $tmp1 === 'x' ) {
|
||||||
$cord[] = $yt;
|
$cord[$idx++] = $cord[$idx-3];
|
||||||
|
$cord[$idx++] = $fillmin;
|
||||||
|
}
|
||||||
|
elseif( $prev === 'x' ) {
|
||||||
|
$cord[$idx++] = $xt;
|
||||||
|
$cord[$idx++] = $fillmin;
|
||||||
|
$cord[$idx++] = $xt;
|
||||||
|
$cord[$idx++] = $yt;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$cord[$idx++] = $xt;
|
||||||
|
$cord[$idx++] = $yt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( is_numeric($tmp1) && (is_numeric($prev) || $prev === '-' ) ) {
|
||||||
|
$cord[$idx++] = $xt;
|
||||||
|
$cord[$idx++] = $yt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,11 +321,11 @@ class LinePlot extends Plot{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( $this->filled ) {
|
if( $this->filled ) {
|
||||||
$cord[] = $xt;
|
$cord[$idx++] = $xt;
|
||||||
if( $min > 0 || $this->fillFromMin )
|
if( $min > 0 || $this->fillFromMin )
|
||||||
$cord[] = $yscale->Translate($min);
|
$cord[$idx++] = $yscale->Translate($min);
|
||||||
else
|
else
|
||||||
$cord[] = $yscale->Translate(0);
|
$cord[$idx++] = $yscale->Translate(0);
|
||||||
if( $this->fillgrad ) {
|
if( $this->fillgrad ) {
|
||||||
$img->SetLineWeight(1);
|
$img->SetLineWeight(1);
|
||||||
$grad = new Gradient($img);
|
$grad = new Gradient($img);
|
||||||
@ -385,8 +407,6 @@ class LinePlot extends Plot{
|
|||||||
$this->StrokeDataValue($img,$this->coords[0][$pnts],$xt,$yt);
|
$this->StrokeDataValue($img,$this->coords[0][$pnts],$xt,$yt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} // Class
|
} // Class
|
||||||
|
|
||||||
@ -396,8 +416,8 @@ class LinePlot extends Plot{
|
|||||||
// Description:
|
// Description:
|
||||||
//===================================================
|
//===================================================
|
||||||
class AccLinePlot extends Plot {
|
class AccLinePlot extends Plot {
|
||||||
var $plots=null,$nbrplots=0,$numpoints=0;
|
protected $plots=null,$nbrplots=0;
|
||||||
var $iStartEndZero=true;
|
private $iStartEndZero=true;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function AccLinePlot($plots) {
|
function AccLinePlot($plots) {
|
||||||
@ -412,10 +432,9 @@ class AccLinePlot extends Plot {
|
|||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
function Legend(&$graph) {
|
function Legend($graph) {
|
||||||
$n=count($this->plots);
|
foreach( $this->plots as $p )
|
||||||
for($i=0; $i < $n; ++$i )
|
$p->DoLegend($graph);
|
||||||
$this->plots[$i]->DoLegend($graph);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Max() {
|
function Max() {
|
||||||
@ -472,7 +491,7 @@ class AccLinePlot extends Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gets called before any axis are stroked
|
// Gets called before any axis are stroked
|
||||||
function PreStrokeAdjust(&$graph) {
|
function PreStrokeAdjust($graph) {
|
||||||
|
|
||||||
// If another plot type have already adjusted the
|
// If another plot type have already adjusted the
|
||||||
// offset we don't touch it.
|
// offset we don't touch it.
|
||||||
@ -569,7 +588,7 @@ class AccLinePlot extends Plot {
|
|||||||
// it wouldn't be possible to create an acc line plot
|
// it wouldn't be possible to create an acc line plot
|
||||||
// with the same graphs, i.e AccLinePlot(array($pl,$pl,$pl));
|
// with the same graphs, i.e AccLinePlot(array($pl,$pl,$pl));
|
||||||
// since this method would have a side effect.
|
// since this method would have a side effect.
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
$img->SetLineWeight($this->weight);
|
$img->SetLineWeight($this->weight);
|
||||||
$this->numpoints = count($this->plots[0]->coords[0]);
|
$this->numpoints = count($this->plots[0]->coords[0]);
|
||||||
// Allocate array
|
// Allocate array
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Log scale plot extension for JpGraph
|
// Description: Log scale plot extension for JpGraph
|
||||||
// Created: 2001-01-08
|
// Created: 2001-01-08
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_log.php 56 2005-06-06 20:14:44Z ljp $
|
// Ver: $Id: jpgraph_log.php 480 2006-02-04 12:17:57Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -36,11 +36,13 @@ class LogScale extends LinearScale {
|
|||||||
function Translate($a) {
|
function Translate($a) {
|
||||||
if( !is_numeric($a) ) {
|
if( !is_numeric($a) ) {
|
||||||
if( $a != '' && $a != '-' && $a != 'x' )
|
if( $a != '' && $a != '-' && $a != 'x' )
|
||||||
JpGraphError::Raise('Your data contains non-numeric values.');
|
JpGraphError::RaiseL(11001);
|
||||||
|
//('Your data contains non-numeric values.');
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if( $a < 0 ) {
|
if( $a < 0 ) {
|
||||||
JpGraphError::Raise("Negative data values can not be used in a log scale.");
|
JpGraphError::RaiseL(11002);
|
||||||
|
//("Negative data values can not be used in a log scale.");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if( $a==0 ) $a=1;
|
if( $a==0 ) $a=1;
|
||||||
@ -53,7 +55,8 @@ class LogScale extends LinearScale {
|
|||||||
function RelTranslate($a) {
|
function RelTranslate($a) {
|
||||||
if( !is_numeric($a) ) {
|
if( !is_numeric($a) ) {
|
||||||
if( $a != '' && $a != '-' && $a != 'x' )
|
if( $a != '' && $a != '-' && $a != 'x' )
|
||||||
JpGraphError::Raise('Your data contains non-numeric values.');
|
JpGraphError::RaiseL(11001);
|
||||||
|
//('Your data contains non-numeric values.');
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if( $a==0 ) $a=1;
|
if( $a==0 ) $a=1;
|
||||||
@ -81,11 +84,12 @@ class LogScale extends LinearScale {
|
|||||||
// Note that for log autoscale the "maxstep" the fourth argument
|
// Note that for log autoscale the "maxstep" the fourth argument
|
||||||
// isn't used. This is just included to give the method the same
|
// isn't used. This is just included to give the method the same
|
||||||
// signature as the linear counterpart.
|
// signature as the linear counterpart.
|
||||||
function AutoScale(&$img,$min,$max,$dummy) {
|
function AutoScale($img,$min,$max,$maxsteps,$majend=true) {
|
||||||
if( $min==0 ) $min=1;
|
if( $min==0 ) $min=1;
|
||||||
|
|
||||||
if( $max <= 0 ) {
|
if( $max <= 0 ) {
|
||||||
JpGraphError::Raise('Scale error for logarithmic scale. You have a problem with your data values. The max value must be greater than 0. It is mathematically impossible to have 0 in a logarithmic scale.');
|
JpGraphError::RaiseL(11004);
|
||||||
|
//('Scale error for logarithmic scale. You have a problem with your data values. The max value must be greater than 0. It is mathematically impossible to have 0 in a logarithmic scale.');
|
||||||
}
|
}
|
||||||
$smin = floor(log10($min));
|
$smin = floor(log10($min));
|
||||||
$smax = ceil(log10($max));
|
$smax = ceil(log10($max));
|
||||||
@ -100,7 +104,7 @@ class LogScale extends LinearScale {
|
|||||||
// Description:
|
// Description:
|
||||||
//===================================================
|
//===================================================
|
||||||
class LogTicks extends Ticks{
|
class LogTicks extends Ticks{
|
||||||
var $label_logtype=LOGLABELS_MAGNITUDE;
|
private $label_logtype=LOGLABELS_MAGNITUDE;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function LogTicks() {
|
function LogTicks() {
|
||||||
@ -123,7 +127,8 @@ class LogTicks extends Ticks{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SetTextLabelStart($aStart) {
|
function SetTextLabelStart($aStart) {
|
||||||
JpGraphError::Raise('Specifying tick interval for a logarithmic scale is undefined. Remove any calls to SetTextLabelStart() or SetTextTickInterval() on the logarithmic scale.');
|
JpGraphError::RaiseL(11005);
|
||||||
|
//('Specifying tick interval for a logarithmic scale is undefined. Remove any calls to SetTextLabelStart() or SetTextTickInterval() on the logarithmic scale.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetXLabelOffset($dummy) {
|
function SetXLabelOffset($dummy) {
|
||||||
@ -134,7 +139,7 @@ class LogTicks extends Ticks{
|
|||||||
// position in the image is specified in pos, i.e. for an x-axis
|
// position in the image is specified in pos, i.e. for an x-axis
|
||||||
// it specifies the absolute y-coord and for Y-ticks it specified the
|
// it specifies the absolute y-coord and for Y-ticks it specified the
|
||||||
// absolute x-position.
|
// absolute x-position.
|
||||||
function Stroke(&$img,&$scale,$pos) {
|
function Stroke($img,$scale,$pos) {
|
||||||
$start = $scale->GetMinVal();
|
$start = $scale->GetMinVal();
|
||||||
$limit = $scale->GetMaxVal();
|
$limit = $scale->GetMaxVal();
|
||||||
$nextMajor = 10*$start;
|
$nextMajor = 10*$start;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Pie plot extension for JpGraph
|
// Description: Pie plot extension for JpGraph
|
||||||
// Created: 2001-02-14
|
// Created: 2001-02-14
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_pie.php 88 2005-08-07 17:18:51Z ljp $
|
// Ver: $Id: jpgraph_pie.php 575 2006-03-04 11:04:59Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -23,36 +23,37 @@ DEFINE("PIE_VALUE_ADJPER",2);
|
|||||||
// Description: Draws a pie plot
|
// Description: Draws a pie plot
|
||||||
//===================================================
|
//===================================================
|
||||||
class PiePlot {
|
class PiePlot {
|
||||||
var $posx=0.5,$posy=0.5;
|
public $posx=0.5,$posy=0.5;
|
||||||
var $radius=0.3;
|
protected $radius=0.3;
|
||||||
var $explode_radius=array(),$explode_all=false,$explode_r=20;
|
protected $explode_radius=array(),$explode_all=false,$explode_r=20;
|
||||||
var $labels=null, $legends=null;
|
protected $labels=null, $legends=null;
|
||||||
var $csimtargets=null; // Array of targets for CSIM
|
protected $csimtargets=null; // Array of targets for CSIM
|
||||||
var $csimareas=''; // Generated CSIM text
|
protected $csimareas=''; // Generated CSIM text
|
||||||
var $csimalts=null; // ALT tags for corresponding target
|
protected $csimalts=null; // ALT tags for corresponding target
|
||||||
var $data=null;
|
protected $data=null;
|
||||||
var $title;
|
public $title;
|
||||||
var $startangle=0;
|
protected $startangle=0;
|
||||||
var $weight=1, $color="black";
|
protected $weight=1, $color="black";
|
||||||
var $legend_margin=6,$show_labels=true;
|
protected $legend_margin=6,$show_labels=true;
|
||||||
var $themearr = array(
|
protected $themearr = array(
|
||||||
"earth" => array(136,34,40,45,46,62,63,134,74,10,120,136,141,168,180,77,209,218,346,395,89,430),
|
"earth" => array(136,34,40,45,46,62,63,134,74,10,120,136,141,168,180,77,209,218,346,395,89,430),
|
||||||
"pastel" => array(27,415,128,59,66,79,105,110,42,147,152,230,236,240,331,337,405,38),
|
"pastel" => array(27,415,128,59,66,79,105,110,42,147,152,230,236,240,331,337,405,38),
|
||||||
"water" => array(8,370,24,40,335,56,213,237,268,14,326,387,10,388),
|
"water" => array(8,370,24,40,335,56,213,237,268,14,326,387,10,388),
|
||||||
"sand" => array(27,168,34,170,19,50,65,72,131,209,46,393));
|
"sand" => array(27,168,34,170,19,50,65,72,131,209,46,393));
|
||||||
var $theme="earth";
|
protected $theme="earth";
|
||||||
var $setslicecolors=array();
|
protected $setslicecolors=array();
|
||||||
var $labeltype=0; // Default to percentage
|
protected $labeltype=0; // Default to percentage
|
||||||
var $pie_border=true,$pie_interior_border=true;
|
protected $pie_border=true,$pie_interior_border=true;
|
||||||
var $value;
|
public $value;
|
||||||
var $ishadowcolor='',$ishadowdrop=4;
|
protected $ishadowcolor='',$ishadowdrop=4;
|
||||||
var $ilabelposadj=1;
|
protected $ilabelposadj=1;
|
||||||
var $legendcsimtargets = array();
|
protected $legendcsimtargets = array();
|
||||||
var $legendcsimalts = array();
|
protected $legendcsimalts = array();
|
||||||
var $adjusted_data = array();
|
protected $adjusted_data = array();
|
||||||
var $guideline = null,$guidelinemargin=10;
|
public $guideline = null;
|
||||||
var $iShowGuideLineForSingle = false;
|
protected $guidelinemargin=10,$iShowGuideLineForSingle = false;
|
||||||
var $iGuideLineCurve = false,$iGuideVFactor=1.4,$iGuideLineRFactor=0.8;
|
protected $iGuideLineCurve = false,$iGuideVFactor=1.4,$iGuideLineRFactor=0.8;
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function PiePlot($data) {
|
function PiePlot($data) {
|
||||||
@ -109,7 +110,6 @@ class PiePlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function AddSliceToCSIM($i,$xc,$yc,$radius,$sa,$ea) {
|
function AddSliceToCSIM($i,$xc,$yc,$radius,$sa,$ea) {
|
||||||
|
|
||||||
//Slice number, ellipse centre (x,y), height, width, start angle, end angle
|
//Slice number, ellipse centre (x,y), height, width, start angle, end angle
|
||||||
while( $sa > 2*M_PI ) $sa = $sa - 2*M_PI;
|
while( $sa > 2*M_PI ) $sa = $sa - 2*M_PI;
|
||||||
while( $ea > 2*M_PI ) $ea = $ea - 2*M_PI;
|
while( $ea > 2*M_PI ) $ea = $ea - 2*M_PI;
|
||||||
@ -131,10 +131,11 @@ class PiePlot {
|
|||||||
$xp = floor(($radius*cos($ea))+$xc);
|
$xp = floor(($radius*cos($ea))+$xc);
|
||||||
$yp = floor($yc-$radius*sin($ea));
|
$yp = floor($yc-$radius*sin($ea));
|
||||||
$coords.= ", $xp, $yp";
|
$coords.= ", $xp, $yp";
|
||||||
|
|
||||||
//add coordinates every 0.2 radians
|
//add coordinates every 0.2 radians
|
||||||
$a=$ea+0.2;
|
$a=$ea+0.2;
|
||||||
|
|
||||||
// If we cross the 260-limit with a slice we need to handle
|
// If we cross the 360-limit with a slice we need to handle
|
||||||
// the fact that end angle is smaller than start
|
// the fact that end angle is smaller than start
|
||||||
if( $sa < $ea ) {
|
if( $sa < $ea ) {
|
||||||
while ($a <= 2*M_PI) {
|
while ($a <= 2*M_PI) {
|
||||||
@ -146,6 +147,7 @@ class PiePlot {
|
|||||||
$a -= 2*M_PI;
|
$a -= 2*M_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while ($a < $sa) {
|
while ($a < $sa) {
|
||||||
$xp = floor($radius*cos($a)+$xc);
|
$xp = floor($radius*cos($a)+$xc);
|
||||||
$yp = floor($yc-$radius*sin($a));
|
$yp = floor($yc-$radius*sin($a));
|
||||||
@ -173,12 +175,12 @@ class PiePlot {
|
|||||||
if( in_array($aTheme,array_keys($this->themearr)) )
|
if( in_array($aTheme,array_keys($this->themearr)) )
|
||||||
$this->theme = $aTheme;
|
$this->theme = $aTheme;
|
||||||
else
|
else
|
||||||
JpGraphError::Raise("PiePLot::SetTheme() Unknown theme: $aTheme");
|
JpGraphError::RaiseL(15001,$aTheme);//("PiePLot::SetTheme() Unknown theme: $aTheme");
|
||||||
}
|
}
|
||||||
|
|
||||||
function ExplodeSlice($e,$radius=20) {
|
function ExplodeSlice($e,$radius=20) {
|
||||||
if( ! is_integer($e) )
|
if( ! is_integer($e) )
|
||||||
JpGraphError::Raise('Argument to PiePlot::ExplodeSlice() must be an integer');
|
JpGraphError::RaiseL(15002);//('Argument to PiePlot::ExplodeSlice() must be an integer');
|
||||||
$this->explode_radius[$e]=$radius;
|
$this->explode_radius[$e]=$radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,21 +191,22 @@ class PiePlot {
|
|||||||
|
|
||||||
function Explode($aExplodeArr) {
|
function Explode($aExplodeArr) {
|
||||||
if( !is_array($aExplodeArr) ) {
|
if( !is_array($aExplodeArr) ) {
|
||||||
JpGraphError::Raise("Argument to PiePlot::Explode() must be an array with integer distances.");
|
JpGraphError::RaiseL(15003);
|
||||||
|
//("Argument to PiePlot::Explode() must be an array with integer distances.");
|
||||||
}
|
}
|
||||||
$this->explode_radius = $aExplodeArr;
|
$this->explode_radius = $aExplodeArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetStartAngle($aStart) {
|
function SetStartAngle($aStart) {
|
||||||
if( $aStart < 0 || $aStart > 360 ) {
|
if( $aStart < 0 || $aStart > 360 ) {
|
||||||
JpGraphError::Raise('Slice start angle must be between 0 and 360 degrees.');
|
JpGraphError::RaiseL(15004);//('Slice start angle must be between 0 and 360 degrees.');
|
||||||
}
|
}
|
||||||
$this->startangle = 360-$aStart;
|
$this->startangle = 360-$aStart;
|
||||||
$this->startangle *= M_PI/180;
|
$this->startangle *= M_PI/180;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetFont($family,$style=FS_NORMAL,$size=10) {
|
function SetFont($family,$style=FS_NORMAL,$size=10) {
|
||||||
JpGraphError::Raise('PiePlot::SetFont() is deprecated. Use PiePlot->value->SetFont() instead.');
|
JpGraphError::RaiseL(15005);//('PiePlot::SetFont() is deprecated. Use PiePlot->value->SetFont() instead.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size in percentage
|
// Size in percentage
|
||||||
@ -211,13 +214,13 @@ class PiePlot {
|
|||||||
if( ($aSize>0 && $aSize<=0.5) || ($aSize>10 && $aSize<1000) )
|
if( ($aSize>0 && $aSize<=0.5) || ($aSize>10 && $aSize<1000) )
|
||||||
$this->radius = $aSize;
|
$this->radius = $aSize;
|
||||||
else
|
else
|
||||||
JpGraphError::Raise("PiePlot::SetSize() Radius for pie must either be specified as a fraction
|
JpGraphError::RaiseL(15006);
|
||||||
[0, 0.5] of the size of the image or as an absolute size in pixels
|
//("PiePlot::SetSize() Radius for pie must either be specified as a fraction [0, 0.5] of the size of the image or as an absolute size in pixels in the range [10, 1000]");
|
||||||
in the range [10, 1000]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetFontColor($aColor) {
|
function SetFontColor($aColor) {
|
||||||
JpGraphError::Raise('PiePlot::SetFontColor() is deprecated. Use PiePlot->value->SetColor() instead.');
|
JpGraphError::RaiseL(15007);
|
||||||
|
//('PiePlot::SetFontColor() is deprecated. Use PiePlot->value->SetColor() instead.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set label arrays
|
// Set label arrays
|
||||||
@ -238,7 +241,8 @@ class PiePlot {
|
|||||||
// Should we display actual value or percentage?
|
// Should we display actual value or percentage?
|
||||||
function SetLabelType($t) {
|
function SetLabelType($t) {
|
||||||
if( $t < 0 || $t > 2 )
|
if( $t < 0 || $t > 2 )
|
||||||
JpGraphError::Raise("PiePlot::SetLabelType() Type for pie plots must be 0 or 1 (not $t).");
|
JpGraphError::RaiseL(15008,$t);
|
||||||
|
//("PiePlot::SetLabelType() Type for pie plots must be 0 or 1 (not $t).");
|
||||||
$this->labeltype=$t;
|
$this->labeltype=$t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,8 +257,8 @@ class PiePlot {
|
|||||||
$this->pie_interior_border = $interior;
|
$this->pie_interior_border = $interior;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the legends (Framework method)
|
// Setup the legends
|
||||||
function Legend(&$graph) {
|
function Legend($graph) {
|
||||||
$colors = array_keys($graph->img->rgb->rgb_table);
|
$colors = array_keys($graph->img->rgb->rgb_table);
|
||||||
sort($colors);
|
sort($colors);
|
||||||
$ta=$this->themearr[$this->theme];
|
$ta=$this->themearr[$this->theme];
|
||||||
@ -262,14 +266,14 @@ class PiePlot {
|
|||||||
|
|
||||||
if( $this->setslicecolors==null ) {
|
if( $this->setslicecolors==null ) {
|
||||||
$numcolors=count($ta);
|
$numcolors=count($ta);
|
||||||
if( get_class($this)==='pieplot3d' ) {
|
if( class_exists('PiePlot3D',false) && ($this instanceof PiePlot3D) ) {
|
||||||
$ta = array_reverse(array_slice($ta,0,$n));
|
$ta = array_reverse(array_slice($ta,0,$n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->setslicecolors = array_slice($this->setslicecolors,0,$n);
|
$this->setslicecolors = array_slice($this->setslicecolors,0,$n);
|
||||||
$numcolors=count($this->setslicecolors);
|
$numcolors=count($this->setslicecolors);
|
||||||
if( $graph->pieaa && get_class($this)==='pieplot' ) {
|
if( $graph->pieaa && ($this instanceof PiePlot) ) {
|
||||||
$this->setslicecolors = array_reverse($this->setslicecolors);
|
$this->setslicecolors = array_reverse($this->setslicecolors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,7 +284,7 @@ class PiePlot {
|
|||||||
|
|
||||||
// Bail out with error if the sum is 0
|
// Bail out with error if the sum is 0
|
||||||
if( $sum==0 )
|
if( $sum==0 )
|
||||||
JpGraphError::Raise("Illegal pie plot. Sum of all data is zero for Pie!");
|
JpGraphError::RaiseL(15009);//("Illegal pie plot. Sum of all data is zero for Pie!");
|
||||||
|
|
||||||
// Make sure we don't plot more values than data points
|
// Make sure we don't plot more values than data points
|
||||||
// (in case the user added more legends than data points)
|
// (in case the user added more legends than data points)
|
||||||
@ -371,7 +375,7 @@ class PiePlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Stroke(&$img,$aaoption=0) {
|
function Stroke($img,$aaoption=0) {
|
||||||
// aaoption is used to handle antialias
|
// aaoption is used to handle antialias
|
||||||
// aaoption == 0 a normal pie
|
// aaoption == 0 a normal pie
|
||||||
// aaoption == 1 just the body
|
// aaoption == 1 just the body
|
||||||
@ -395,12 +399,19 @@ class PiePlot {
|
|||||||
$numcolors=count($ta);
|
$numcolors=count($ta);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->setslicecolors = array_reverse(array_slice($this->setslicecolors,0,$n));
|
// We need to create an array of colors as long as the data
|
||||||
|
// since we need to reverse it to get the colors in the right order
|
||||||
$numcolors=count($this->setslicecolors);
|
$numcolors=count($this->setslicecolors);
|
||||||
$tt = array_slice($this->setslicecolors,$n % $numcolors);
|
if( $n > $numcolors ) {
|
||||||
$tt2 = array_slice($this->setslicecolors,0,$n % $numcolors);
|
$i = 2*$numcolors;
|
||||||
$tt2 = array_merge($tt, $tt2);
|
while( $n > $i ) {
|
||||||
$this->setslicecolors = $tt + $tt2;
|
$this->setslicecolors = array_merge($this->setslicecolors,$this->setslicecolors);
|
||||||
|
$i += $n;
|
||||||
|
}
|
||||||
|
$tt = array_slice($this->setslicecolors,0,$n % $numcolors);
|
||||||
|
$this->setslicecolors = array_merge($this->setslicecolors,$tt);
|
||||||
|
$this->setslicecolors = array_reverse($this->setslicecolors);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the slices
|
// Draw the slices
|
||||||
@ -410,7 +421,7 @@ class PiePlot {
|
|||||||
|
|
||||||
// Bail out with error if the sum is 0
|
// Bail out with error if the sum is 0
|
||||||
if( $sum==0 )
|
if( $sum==0 )
|
||||||
JpGraphError::Raise("Sum of all data is 0 for Pie.");
|
JpGraphError::RaiseL(15009);//("Sum of all data is 0 for Pie.");
|
||||||
|
|
||||||
// Set up the pie-circle
|
// Set up the pie-circle
|
||||||
if( $this->radius <= 1 )
|
if( $this->radius <= 1 )
|
||||||
@ -524,13 +535,13 @@ class PiePlot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
If( $this->value->show && $aaoption !== 1 ) {
|
if( $this->value->show && $aaoption !== 1 ) {
|
||||||
$this->StrokeAllLabels($img,$xc,$yc,$radius);
|
$this->StrokeAllLabels($img,$xc,$yc,$radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust title position
|
// Adjust title position
|
||||||
if( $aaoption !== 1 ) {
|
if( $aaoption !== 1 ) {
|
||||||
$this->title->Pos($xc,
|
$this->title->SetPos($xc,
|
||||||
$yc-$this->title->GetFontHeight($img)-$radius-$this->title->margin,
|
$yc-$this->title->GetFontHeight($img)-$radius-$this->title->margin,
|
||||||
"center","bottom");
|
"center","bottom");
|
||||||
$this->title->Stroke($img);
|
$this->title->Stroke($img);
|
||||||
@ -693,7 +704,7 @@ class PiePlot {
|
|||||||
|
|
||||||
// We use the font height as the base factor for how far we need to
|
// We use the font height as the base factor for how far we need to
|
||||||
// spread the labels in the Y-direction.
|
// spread the labels in the Y-direction.
|
||||||
$img->SetFont($this->value->ff,$this->value->fs,$this->value->fsize);
|
$this->value->ApplyFont($img);
|
||||||
$fh = $img->GetFontHeight();
|
$fh = $img->GetFontHeight();
|
||||||
$origvstep=$fh*$this->iGuideVFactor;
|
$origvstep=$fh*$this->iGuideVFactor;
|
||||||
$this->value->SetMargin(0);
|
$this->value->SetMargin(0);
|
||||||
@ -846,12 +857,11 @@ class PiePlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Position the labels of each slice
|
// Position the labels of each slice
|
||||||
function StrokeLabel($label,$img,$xc,$yc,$a,$radius) {
|
function StrokeLabel($label,$img,$xc,$yc,$a,$r) {
|
||||||
|
|
||||||
// Default value
|
// Default value
|
||||||
if( $this->ilabelposadj === 'auto' )
|
if( $this->ilabelposadj === 'auto' )
|
||||||
$this->ilabelposadj = 0.65;
|
$this->ilabelposadj = 0.65;
|
||||||
$r = $radius;
|
|
||||||
|
|
||||||
// We position the values diferently depending on if they are inside
|
// We position the values diferently depending on if they are inside
|
||||||
// or outside the pie
|
// or outside the pie
|
||||||
@ -876,7 +886,7 @@ class PiePlot {
|
|||||||
// that intersects with the extension of the corresponding axis. The code looks a little
|
// that intersects with the extension of the corresponding axis. The code looks a little
|
||||||
// bit messy but this is really the only way of having a reasonable position of the
|
// bit messy but this is really the only way of having a reasonable position of the
|
||||||
// axis titles.
|
// axis titles.
|
||||||
$img->SetFont($this->value->ff,$this->value->fs,$this->value->fsize);
|
$this->value->ApplyFont($img);
|
||||||
$h=$img->GetTextHeight($label);
|
$h=$img->GetTextHeight($label);
|
||||||
// For numeric values the format of the display value
|
// For numeric values the format of the display value
|
||||||
// must be taken into account
|
// must be taken into account
|
||||||
@ -888,6 +898,7 @@ class PiePlot {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
$w=$img->GetTextWidth($label);
|
$w=$img->GetTextWidth($label);
|
||||||
|
|
||||||
if( $this->ilabelposadj > 1.0 && $this->ilabelposadj < 5.0) {
|
if( $this->ilabelposadj > 1.0 && $this->ilabelposadj < 5.0) {
|
||||||
$r *= $this->ilabelposadj;
|
$r *= $this->ilabelposadj;
|
||||||
}
|
}
|
||||||
@ -924,10 +935,10 @@ class PiePlot {
|
|||||||
// filled circle in the center
|
// filled circle in the center
|
||||||
//===================================================
|
//===================================================
|
||||||
class PiePlotC extends PiePlot {
|
class PiePlotC extends PiePlot {
|
||||||
var $imidsize=0.5; // Fraction of total width
|
private $imidsize=0.5; // Fraction of total width
|
||||||
var $imidcolor='white';
|
private $imidcolor='white';
|
||||||
var $midtitle='';
|
public $midtitle='';
|
||||||
var $middlecsimtarget="",$middlecsimalt="";
|
private $middlecsimtarget="",$middlecsimalt="";
|
||||||
|
|
||||||
function PiePlotC($data,$aCenterTitle='') {
|
function PiePlotC($data,$aCenterTitle='') {
|
||||||
parent::PiePlot($data);
|
parent::PiePlot($data);
|
||||||
@ -960,7 +971,6 @@ class PiePlotC extends PiePlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function AddSliceToCSIM($i,$xc,$yc,$radius,$sa,$ea) {
|
function AddSliceToCSIM($i,$xc,$yc,$radius,$sa,$ea) {
|
||||||
|
|
||||||
//Slice number, ellipse centre (x,y), radius, start angle, end angle
|
//Slice number, ellipse centre (x,y), radius, start angle, end angle
|
||||||
while( $sa > 2*M_PI ) $sa = $sa - 2*M_PI;
|
while( $sa > 2*M_PI ) $sa = $sa - 2*M_PI;
|
||||||
while( $ea > 2*M_PI ) $ea = $ea - 2*M_PI;
|
while( $ea > 2*M_PI ) $ea = $ea - 2*M_PI;
|
||||||
@ -982,7 +992,7 @@ class PiePlotC extends PiePlot {
|
|||||||
//add coordinates every 0.25 radians
|
//add coordinates every 0.25 radians
|
||||||
$a=$ea+0.25;
|
$a=$ea+0.25;
|
||||||
|
|
||||||
// If we cross the 260-limit with a slice we need to handle
|
// If we cross the 360-limit with a slice we need to handle
|
||||||
// the fact that end angle is smaller than start
|
// the fact that end angle is smaller than start
|
||||||
if( $sa < $ea ) {
|
if( $sa < $ea ) {
|
||||||
while ($a <= 2*M_PI) {
|
while ($a <= 2*M_PI) {
|
||||||
@ -1079,7 +1089,7 @@ class PiePlotC extends PiePlot {
|
|||||||
|
|
||||||
if( $this->value->show && $aaoption !== 1) {
|
if( $this->value->show && $aaoption !== 1) {
|
||||||
$this->StrokeAllLabels($img,$xc,$yc,$radius);
|
$this->StrokeAllLabels($img,$xc,$yc,$radius);
|
||||||
$this->midtitle->Pos($xc,$yc,'center','center');
|
$this->midtitle->SetPos($xc,$yc,'center','center');
|
||||||
$this->midtitle->Stroke($img);
|
$this->midtitle->Stroke($img);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1113,10 +1123,10 @@ class PiePlotC extends PiePlot {
|
|||||||
// Description:
|
// Description:
|
||||||
//===================================================
|
//===================================================
|
||||||
class PieGraph extends Graph {
|
class PieGraph extends Graph {
|
||||||
var $posx, $posy, $radius;
|
private $posx, $posy, $radius;
|
||||||
var $legends=array();
|
private $legends=array();
|
||||||
var $plots=array();
|
public $plots=array();
|
||||||
var $pieaa = false ;
|
public $pieaa = false ;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function PieGraph($width=300,$height=200,$cachedName="",$timeout=0,$inline=1) {
|
function PieGraph($width=300,$height=200,$cachedName="",$timeout=0,$inline=1) {
|
||||||
@ -1131,13 +1141,13 @@ class PieGraph extends Graph {
|
|||||||
function Add($aObj) {
|
function Add($aObj) {
|
||||||
|
|
||||||
if( is_array($aObj) && count($aObj) > 0 )
|
if( is_array($aObj) && count($aObj) > 0 )
|
||||||
$cl = get_class($aObj[0]);
|
$cl = $aObj[0];
|
||||||
else
|
else
|
||||||
$cl = get_class($aObj);
|
$cl = $aObj;
|
||||||
|
|
||||||
if( $cl == 'text' )
|
if( $cl instanceof Text )
|
||||||
$this->AddText($aObj);
|
$this->AddText($aObj);
|
||||||
elseif( $cl == 'iconplot' )
|
elseif( class_exists('IconPlot',false) && ($cl instanceof IconPlot) )
|
||||||
$this->AddIcon($aObj);
|
$this->AddIcon($aObj);
|
||||||
else {
|
else {
|
||||||
if( is_array($aObj) ) {
|
if( is_array($aObj) ) {
|
||||||
@ -1160,6 +1170,7 @@ class PieGraph extends Graph {
|
|||||||
$this->SetMarginColor($c);
|
$this->SetMarginColor($c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function DisplayCSIMAreas() {
|
function DisplayCSIMAreas() {
|
||||||
$csim="";
|
$csim="";
|
||||||
foreach($this->plots as $p ) {
|
foreach($this->plots as $p ) {
|
||||||
@ -1217,6 +1228,7 @@ class PieGraph extends Graph {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->StrokeFrame();
|
$this->StrokeFrame();
|
||||||
|
$this->StrokeBackgroundGrad();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1235,7 +1247,12 @@ class PieGraph extends Graph {
|
|||||||
$ni = count($this->iIcons);
|
$ni = count($this->iIcons);
|
||||||
for($i=0; $i < $ni; ++$i) {
|
for($i=0; $i < $ni; ++$i) {
|
||||||
$this->iIcons[$i]->iScale *= 2 ;
|
$this->iIcons[$i]->iScale *= 2 ;
|
||||||
|
if( $this->iIcons[$i]->iX > 1 )
|
||||||
|
$this->iIcons[$i]->iX *= 2 ;
|
||||||
|
if( $this->iIcons[$i]->iY > 1 )
|
||||||
|
$this->iIcons[$i]->iY *= 2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->StrokeIcons();
|
$this->StrokeIcons();
|
||||||
|
|
||||||
for($i=0; $i < $n; ++$i) {
|
for($i=0; $i < $n; ++$i) {
|
||||||
@ -1306,7 +1323,7 @@ class PieGraph extends Graph {
|
|||||||
|
|
||||||
// Should we do any final image transformation
|
// Should we do any final image transformation
|
||||||
if( $this->iImgTrans ) {
|
if( $this->iImgTrans ) {
|
||||||
if( !class_exists('ImgTrans') ) {
|
if( !class_exists('ImgTrans',false) ) {
|
||||||
require_once('jpgraph_imgtrans.php');
|
require_once('jpgraph_imgtrans.php');
|
||||||
//JpGraphError::Raise('In order to use image transformation you must include the file jpgraph_imgtrans.php in your script.');
|
//JpGraphError::Raise('In order to use image transformation you must include the file jpgraph_imgtrans.php in your script.');
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: 3D Pie plot extension for JpGraph
|
// Description: 3D Pie plot extension for JpGraph
|
||||||
// Created: 2001-03-24
|
// Created: 2001-03-24
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_pie3d.php 332 2005-12-14 18:21:37Z ljp $
|
// Ver: $Id: jpgraph_pie3d.php 571 2006-03-04 10:28:00Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -16,14 +16,14 @@
|
|||||||
// angle between 20 and 70 degrees.
|
// angle between 20 and 70 degrees.
|
||||||
//===================================================
|
//===================================================
|
||||||
class PiePlot3D extends PiePlot {
|
class PiePlot3D extends PiePlot {
|
||||||
var $labelhintcolor="red",$showlabelhint=true;
|
private $labelhintcolor="red",$showlabelhint=true;
|
||||||
var $angle=50;
|
private $angle=50;
|
||||||
var $edgecolor="", $edgeweight=1;
|
private $edgecolor="", $edgeweight=1;
|
||||||
var $iThickness=false;
|
private $iThickness=false;
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function PiePlot3d(&$data) {
|
function PiePlot3d($data) {
|
||||||
$this->radius = 0.5;
|
$this->radius = 0.5;
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
$this->title = new Text("");
|
$this->title = new Text("");
|
||||||
@ -45,7 +45,7 @@ class PiePlot3D extends PiePlot {
|
|||||||
$this->setslicecolors = $aColors;
|
$this->setslicecolors = $aColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Legend(&$aGraph) {
|
function Legend($aGraph) {
|
||||||
parent::Legend($aGraph);
|
parent::Legend($aGraph);
|
||||||
$aGraph->legend->txtcol = array_reverse($aGraph->legend->txtcol);
|
$aGraph->legend->txtcol = array_reverse($aGraph->legend->txtcol);
|
||||||
}
|
}
|
||||||
@ -57,21 +57,28 @@ class PiePlot3D extends PiePlot {
|
|||||||
|
|
||||||
// Should the slices be separated by a line? If color is specified as "" no line
|
// Should the slices be separated by a line? If color is specified as "" no line
|
||||||
// will be used to separate pie slices.
|
// will be used to separate pie slices.
|
||||||
function SetEdge($aColor,$aWeight=1) {
|
function SetEdge($aColor='black',$aWeight=1) {
|
||||||
$this->edgecolor = $aColor;
|
$this->edgecolor = $aColor;
|
||||||
$this->edgeweight = $aWeight;
|
$this->edgeweight = $aWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dummy function to make Pie3D behave in a similair way to 2D
|
||||||
|
function ShowBorder($exterior=true,$interior=true) {
|
||||||
|
JpGraphError::RaiseL(14001);
|
||||||
|
//('Pie3D::ShowBorder() . Deprecated function. Use Pie3D::SetEdge() to control the edges around slices.');
|
||||||
|
}
|
||||||
|
|
||||||
// Specify projection angle for 3D in degrees
|
// Specify projection angle for 3D in degrees
|
||||||
// Must be between 20 and 70 degrees
|
// Must be between 20 and 70 degrees
|
||||||
function SetAngle($a) {
|
function SetAngle($a) {
|
||||||
if( $a<5 || $a>90 )
|
if( $a<5 || $a>90 )
|
||||||
JpGraphError::Raise("PiePlot3D::SetAngle() 3D Pie projection angle must be between 5 and 85 degrees.");
|
JpGraphError::RaiseL(14002);
|
||||||
|
//("PiePlot3D::SetAngle() 3D Pie projection angle must be between 5 and 85 degrees.");
|
||||||
else
|
else
|
||||||
$this->angle = $a;
|
$this->angle = $a;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddSliceToCSIM($i,$xc,$yc,$height,$width,$thick,$sa,$ea) { //Slice number, ellipse centre (x,y), height, width, start angle, end angle
|
function Add3DSliceToCSIM($i,$xc,$yc,$height,$width,$thick,$sa,$ea) { //Slice number, ellipse centre (x,y), height, width, start angle, end angle
|
||||||
|
|
||||||
$sa *= M_PI/180;
|
$sa *= M_PI/180;
|
||||||
$ea *= M_PI/180;
|
$ea *= M_PI/180;
|
||||||
@ -175,7 +182,7 @@ class PiePlot3D extends PiePlot {
|
|||||||
// pie ellipse. Hence, no slice will cross 90 or 270
|
// pie ellipse. Hence, no slice will cross 90 or 270
|
||||||
// point.
|
// point.
|
||||||
if( ($sa < 90 && $ea > 90) || ( ($sa > 90 && $sa < 270) && $ea > 270) ) {
|
if( ($sa < 90 && $ea > 90) || ( ($sa > 90 && $sa < 270) && $ea > 270) ) {
|
||||||
JpGraphError::Raise('Internal assertion failed. Pie3D::Pie3DSlice');
|
JpGraphError::RaiseL(14003);//('Internal assertion failed. Pie3D::Pie3DSlice');
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +385,7 @@ class PiePlot3D extends PiePlot {
|
|||||||
|
|
||||||
function SetStartAngle($aStart) {
|
function SetStartAngle($aStart) {
|
||||||
if( $aStart < 0 || $aStart > 360 ) {
|
if( $aStart < 0 || $aStart > 360 ) {
|
||||||
JpGraphError::Raise('Slice start angle must be between 0 and 360 degrees.');
|
JpGraphError::RaiseL(14004);//('Slice start angle must be between 0 and 360 degrees.');
|
||||||
}
|
}
|
||||||
$this->startangle = $aStart;
|
$this->startangle = $aStart;
|
||||||
}
|
}
|
||||||
@ -572,7 +579,8 @@ class PiePlot3D extends PiePlot {
|
|||||||
$j=0;
|
$j=0;
|
||||||
}
|
}
|
||||||
if( $cnt > $n ) {
|
if( $cnt > $n ) {
|
||||||
JpGraphError::Raise("Pie3D Internal error (#1). Trying to wrap twice when looking for start index");
|
JpGraphError::RaiseL(14005);
|
||||||
|
//("Pie3D Internal error (#1). Trying to wrap twice when looking for start index");
|
||||||
}
|
}
|
||||||
++$cnt;
|
++$cnt;
|
||||||
}
|
}
|
||||||
@ -598,7 +606,8 @@ class PiePlot3D extends PiePlot {
|
|||||||
$j++;
|
$j++;
|
||||||
if( $j >= $n ) $j=0;
|
if( $j >= $n ) $j=0;
|
||||||
if( $cnt > $n ) {
|
if( $cnt > $n ) {
|
||||||
JpGraphError::Raise("Pie3D Internal Error: Z-Sorting algorithm for 3D Pies is not working properly (2). Trying to wrap twice while stroking.");
|
JpGraphError::RaiseL(14006);
|
||||||
|
//("Pie3D Internal Error: Z-Sorting algorithm for 3D Pies is not working properly (2). Trying to wrap twice while stroking.");
|
||||||
}
|
}
|
||||||
++$cnt;
|
++$cnt;
|
||||||
}
|
}
|
||||||
@ -618,7 +627,8 @@ class PiePlot3D extends PiePlot {
|
|||||||
$z,$adjcolors[$j],$shadow);
|
$z,$adjcolors[$j],$shadow);
|
||||||
$j--;
|
$j--;
|
||||||
if( $cnt > $n ) {
|
if( $cnt > $n ) {
|
||||||
JpGraphError::Raise("Pie3D Internal Error: Z-Sorting algorithm for 3D Pies is not working properly (2). Trying to wrap twice while stroking.");
|
JpGraphError::RaiseL(14006);
|
||||||
|
//("Pie3D Internal Error: Z-Sorting algorithm for 3D Pies is not working properly (2). Trying to wrap twice while stroking.");
|
||||||
}
|
}
|
||||||
if($j<0) $j=$n-1;
|
if($j<0) $j=$n-1;
|
||||||
$cnt++;
|
$cnt++;
|
||||||
@ -636,13 +646,15 @@ class PiePlot3D extends PiePlot {
|
|||||||
|
|
||||||
if( $aaoption !== 1 ) {
|
if( $aaoption !== 1 ) {
|
||||||
// Now print possible labels and add csim
|
// Now print possible labels and add csim
|
||||||
$img->SetFont($this->value->ff,$this->value->fs);
|
$this->value->ApplyFont($img);
|
||||||
$margin = $img->GetFontHeight()/2 + $this->value->margin ;
|
$margin = $img->GetFontHeight()/2 + $this->value->margin ;
|
||||||
for($i=0; $i < count($data); ++$i ) {
|
for($i=0; $i < count($data); ++$i ) {
|
||||||
$la = $labeldata[$i][0];
|
$la = $labeldata[$i][0];
|
||||||
$x = $labeldata[$i][1] + cos($la*M_PI/180)*($d+$margin);
|
$x = $labeldata[$i][1] + cos($la*M_PI/180)*($d+$margin)*$this->ilabelposadj;
|
||||||
$y = $labeldata[$i][2] - sin($la*M_PI/180)*($h+$margin);
|
$y = $labeldata[$i][2] - sin($la*M_PI/180)*($h+$margin)*$this->ilabelposadj;
|
||||||
|
if( $this->ilabelposadj >= 1.0 ) {
|
||||||
if( $la > 180 && $la < 360 ) $y += $z;
|
if( $la > 180 && $la < 360 ) $y += $z;
|
||||||
|
}
|
||||||
if( $this->labeltype == 0 ) {
|
if( $this->labeltype == 0 ) {
|
||||||
if( $sum > 0 )
|
if( $sum > 0 )
|
||||||
$l = 100*$data[$i]/$sum;
|
$l = 100*$data[$i]/$sum;
|
||||||
@ -660,7 +672,7 @@ class PiePlot3D extends PiePlot {
|
|||||||
|
|
||||||
$this->StrokeLabels($l,$img,$labeldata[$i][0]*M_PI/180,$x,$y,$z);
|
$this->StrokeLabels($l,$img,$labeldata[$i][0]*M_PI/180,$x,$y,$z);
|
||||||
|
|
||||||
$this->AddSliceToCSIM($i,$labeldata[$i][1],$labeldata[$i][2],$h*2,$d*2,$z,
|
$this->Add3DSliceToCSIM($i,$labeldata[$i][1],$labeldata[$i][2],$h*2,$d*2,$z,
|
||||||
$originalangles[$i][0],$originalangles[$i][1]);
|
$originalangles[$i][0],$originalangles[$i][1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -801,8 +813,7 @@ class PiePlot3D extends PiePlot {
|
|||||||
|
|
||||||
// Add a sanity check for width
|
// Add a sanity check for width
|
||||||
if( $width < 1 ) {
|
if( $width < 1 ) {
|
||||||
JpGraphError::Raise("Width for 3D Pie is 0. Specify a size > 0");
|
JpGraphError::RaiseL(14007);//("Width for 3D Pie is 0. Specify a size > 0");
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establish a thickness. By default the thickness is a fifth of the
|
// Establish a thickness. By default the thickness is a fifth of the
|
||||||
@ -839,7 +850,7 @@ class PiePlot3D extends PiePlot {
|
|||||||
|
|
||||||
// Adjust title position
|
// Adjust title position
|
||||||
if( $aaoption != 1 ) {
|
if( $aaoption != 1 ) {
|
||||||
$this->title->Pos($xc,$yc-$this->title->GetFontHeight($img)-$width/2-$this->title->margin, "center","bottom");
|
$this->title->SetPos($xc,$yc-$this->title->GetFontHeight($img)-$width/2-$this->title->margin, "center","bottom");
|
||||||
$this->title->Stroke($img);
|
$this->title->Stroke($img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -857,7 +868,7 @@ class PiePlot3D extends PiePlot {
|
|||||||
// that intersects with the extension of the corresponding axis. The code looks a little
|
// that intersects with the extension of the corresponding axis. The code looks a little
|
||||||
// bit messy but this is really the only way of having a reasonable position of the
|
// bit messy but this is really the only way of having a reasonable position of the
|
||||||
// axis titles.
|
// axis titles.
|
||||||
$img->SetFont($this->value->ff,$this->value->fs,$this->value->fsize);
|
$this->value->ApplyFont($img);
|
||||||
$h=$img->GetTextHeight($label);
|
$h=$img->GetTextHeight($label);
|
||||||
// For numeric values the format of the display value
|
// For numeric values the format of the display value
|
||||||
// must be taken into account
|
// must be taken into account
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: PHP4 Graph Plotting library. Extension module.
|
// Description: PHP4 Graph Plotting library. Extension module.
|
||||||
// Created: 2004-02-18
|
// Created: 2004-02-18
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_plotband.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_plotband.php 484 2006-02-04 12:20:01Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -22,8 +22,8 @@ DEFINE("BAND_DIAGCROSS",8); // Diagonal crosses
|
|||||||
|
|
||||||
// Utility class to hold coordinates for a rectangle
|
// Utility class to hold coordinates for a rectangle
|
||||||
class Rectangle {
|
class Rectangle {
|
||||||
var $x,$y,$w,$h;
|
public $x,$y,$w,$h;
|
||||||
var $xe, $ye;
|
public $xe, $ye;
|
||||||
function Rectangle($aX,$aY,$aWidth,$aHeight) {
|
function Rectangle($aX,$aY,$aWidth,$aHeight) {
|
||||||
$this->x=$aX;
|
$this->x=$aX;
|
||||||
$this->y=$aY;
|
$this->y=$aY;
|
||||||
@ -38,16 +38,16 @@ class Rectangle {
|
|||||||
// Class RectPattern
|
// Class RectPattern
|
||||||
// Base class for pattern hierarchi that is used to display patterned
|
// Base class for pattern hierarchi that is used to display patterned
|
||||||
// bands on the graph. Any subclass that doesn't override Stroke()
|
// bands on the graph. Any subclass that doesn't override Stroke()
|
||||||
// must at least implement method DoPattern(&$aImg) which is responsible
|
// must at least implement method DoPattern($aImg) which is responsible
|
||||||
// for drawing the pattern onto the graph.
|
// for drawing the pattern onto the graph.
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
class RectPattern {
|
class RectPattern {
|
||||||
var $color;
|
protected $color;
|
||||||
var $weight;
|
protected $weight;
|
||||||
var $rect=null;
|
protected $rect=null;
|
||||||
var $doframe=true;
|
protected $doframe=true;
|
||||||
var $linespacing; // Line spacing in pixels
|
protected $linespacing; // Line spacing in pixels
|
||||||
var $iBackgroundColor=-1; // Default is no background fill
|
protected $iBackgroundColor=-1; // Default is no background fill
|
||||||
|
|
||||||
function RectPattern($aColor,$aWeight=1) {
|
function RectPattern($aColor,$aWeight=1) {
|
||||||
$this->color = $aColor;
|
$this->color = $aColor;
|
||||||
@ -58,7 +58,7 @@ class RectPattern {
|
|||||||
$this->iBackgroundColor=$aBackgroundColor;
|
$this->iBackgroundColor=$aBackgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetPos(&$aRect) {
|
function SetPos($aRect) {
|
||||||
$this->rect = $aRect;
|
$this->rect = $aRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,16 +68,18 @@ class RectPattern {
|
|||||||
|
|
||||||
function SetDensity($aDens) {
|
function SetDensity($aDens) {
|
||||||
if( $aDens < 1 || $aDens > 100 )
|
if( $aDens < 1 || $aDens > 100 )
|
||||||
JpGraphError::Raise(" Desity for pattern must be between 1 and 100. (You tried $aDens)");
|
JpGraphError::RaiseL(16001,$aDens);
|
||||||
|
//(" Desity for pattern must be between 1 and 100. (You tried $aDens)");
|
||||||
// 1% corresponds to linespacing=50
|
// 1% corresponds to linespacing=50
|
||||||
// 100 % corresponds to linespacing 1
|
// 100 % corresponds to linespacing 1
|
||||||
$this->linespacing = floor(((100-$aDens)/100.0)*50)+1;
|
$this->linespacing = floor(((100-$aDens)/100.0)*50)+1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke(&$aImg) {
|
function Stroke($aImg) {
|
||||||
if( $this->rect == null )
|
if( $this->rect == null )
|
||||||
JpGraphError::Raise(" No positions specified for pattern.");
|
JpGraphError::RaiseL(16002);
|
||||||
|
//(" No positions specified for pattern.");
|
||||||
|
|
||||||
if( !(is_numeric($this->iBackgroundColor) && $this->iBackgroundColor==-1) ) {
|
if( !(is_numeric($this->iBackgroundColor) && $this->iBackgroundColor==-1) ) {
|
||||||
$aImg->SetColor($this->iBackgroundColor);
|
$aImg->SetColor($this->iBackgroundColor);
|
||||||
@ -108,7 +110,7 @@ class RectPatternSolid extends RectPattern {
|
|||||||
parent::RectPattern($aColor,$aWeight);
|
parent::RectPattern($aColor,$aWeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoPattern(&$aImg) {
|
function DoPattern($aImg) {
|
||||||
$aImg->SetColor($this->color);
|
$aImg->SetColor($this->color);
|
||||||
$aImg->FilledRectangle($this->rect->x,$this->rect->y,
|
$aImg->FilledRectangle($this->rect->x,$this->rect->y,
|
||||||
$this->rect->xe,$this->rect->ye);
|
$this->rect->xe,$this->rect->ye);
|
||||||
@ -126,7 +128,7 @@ class RectPatternHor extends RectPattern {
|
|||||||
$this->linespacing = $aLineSpacing;
|
$this->linespacing = $aLineSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoPattern(&$aImg) {
|
function DoPattern($aImg) {
|
||||||
$x0 = $this->rect->x;
|
$x0 = $this->rect->x;
|
||||||
$x1 = $this->rect->xe;
|
$x1 = $this->rect->xe;
|
||||||
$y = $this->rect->y;
|
$y = $this->rect->y;
|
||||||
@ -142,7 +144,6 @@ class RectPatternHor extends RectPattern {
|
|||||||
// Implements vertical line pattern
|
// Implements vertical line pattern
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
class RectPatternVert extends RectPattern {
|
class RectPatternVert extends RectPattern {
|
||||||
var $linespacing=10; // Line spacing in pixels
|
|
||||||
|
|
||||||
function RectPatternVert($aColor="black",$aWeight=1,$aLineSpacing=7) {
|
function RectPatternVert($aColor="black",$aWeight=1,$aLineSpacing=7) {
|
||||||
parent::RectPattern($aColor,$aWeight);
|
parent::RectPattern($aColor,$aWeight);
|
||||||
@ -152,7 +153,7 @@ class RectPatternVert extends RectPattern {
|
|||||||
//--------------------
|
//--------------------
|
||||||
// Private methods
|
// Private methods
|
||||||
//
|
//
|
||||||
function DoPattern(&$aImg) {
|
function DoPattern($aImg) {
|
||||||
$x = $this->rect->x;
|
$x = $this->rect->x;
|
||||||
$y0 = $this->rect->y;
|
$y0 = $this->rect->y;
|
||||||
$y1 = $this->rect->ye;
|
$y1 = $this->rect->ye;
|
||||||
@ -169,14 +170,13 @@ class RectPatternVert extends RectPattern {
|
|||||||
// Implements right diagonal pattern
|
// Implements right diagonal pattern
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
class RectPatternRDiag extends RectPattern {
|
class RectPatternRDiag extends RectPattern {
|
||||||
var $linespacing; // Line spacing in pixels
|
|
||||||
|
|
||||||
function RectPatternRDiag($aColor="black",$aWeight=1,$aLineSpacing=12) {
|
function RectPatternRDiag($aColor="black",$aWeight=1,$aLineSpacing=12) {
|
||||||
parent::RectPattern($aColor,$aWeight);
|
parent::RectPattern($aColor,$aWeight);
|
||||||
$this->linespacing = $aLineSpacing;
|
$this->linespacing = $aLineSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoPattern(&$aImg) {
|
function DoPattern($aImg) {
|
||||||
// --------------------
|
// --------------------
|
||||||
// | / / / / /|
|
// | / / / / /|
|
||||||
// |/ / / / / |
|
// |/ / / / / |
|
||||||
@ -239,14 +239,13 @@ class RectPatternRDiag extends RectPattern {
|
|||||||
// Implements left diagonal pattern
|
// Implements left diagonal pattern
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
class RectPatternLDiag extends RectPattern {
|
class RectPatternLDiag extends RectPattern {
|
||||||
var $linespacing; // Line spacing in pixels
|
|
||||||
|
|
||||||
function RectPatternLDiag($aColor="black",$aWeight=1,$aLineSpacing=12) {
|
function RectPatternLDiag($aColor="black",$aWeight=1,$aLineSpacing=12) {
|
||||||
$this->linespacing = $aLineSpacing;
|
$this->linespacing = $aLineSpacing;
|
||||||
parent::RectPattern($aColor,$aWeight);
|
parent::RectPattern($aColor,$aWeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoPattern(&$aImg) {
|
function DoPattern($aImg) {
|
||||||
// --------------------
|
// --------------------
|
||||||
// |\ \ \ \ \ |
|
// |\ \ \ \ \ |
|
||||||
// | \ \ \ \ \|
|
// | \ \ \ \ \|
|
||||||
@ -304,7 +303,7 @@ class RectPatternLDiag extends RectPattern {
|
|||||||
// Implements "3D" plane pattern
|
// Implements "3D" plane pattern
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
class RectPattern3DPlane extends RectPattern {
|
class RectPattern3DPlane extends RectPattern {
|
||||||
var $alpha=50; // Parameter that specifies the distance
|
private $alpha=50; // Parameter that specifies the distance
|
||||||
// to "simulated" horizon in pixel from the
|
// to "simulated" horizon in pixel from the
|
||||||
// top of the band. Specifies how fast the lines
|
// top of the band. Specifies how fast the lines
|
||||||
// converge.
|
// converge.
|
||||||
@ -318,7 +317,7 @@ class RectPattern3DPlane extends RectPattern {
|
|||||||
$this->alpha=$aHorizon;
|
$this->alpha=$aHorizon;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoPattern(&$aImg) {
|
function DoPattern($aImg) {
|
||||||
// "Fake" a nice 3D grid-effect.
|
// "Fake" a nice 3D grid-effect.
|
||||||
$x0 = $this->rect->x + $this->rect->w/2;
|
$x0 = $this->rect->x + $this->rect->w/2;
|
||||||
$y0 = $this->rect->y;
|
$y0 = $this->rect->y;
|
||||||
@ -421,8 +420,8 @@ class RectPattern3DPlane extends RectPattern {
|
|||||||
// Vert/Hor crosses
|
// Vert/Hor crosses
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
class RectPatternCross extends RectPattern {
|
class RectPatternCross extends RectPattern {
|
||||||
var $vert=null;
|
private $vert=null;
|
||||||
var $hor=null;
|
private $hor=null;
|
||||||
function RectPatternCross($aColor="black",$aWeight=1) {
|
function RectPatternCross($aColor="black",$aWeight=1) {
|
||||||
parent::RectPattern($aColor,$aWeight);
|
parent::RectPattern($aColor,$aWeight);
|
||||||
$this->vert = new RectPatternVert($aColor,$aWeight);
|
$this->vert = new RectPatternVert($aColor,$aWeight);
|
||||||
@ -434,7 +433,7 @@ class RectPatternCross extends RectPattern {
|
|||||||
$this->hor->SetOrder($aDepth);
|
$this->hor->SetOrder($aDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetPos(&$aRect) {
|
function SetPos($aRect) {
|
||||||
parent::SetPos($aRect);
|
parent::SetPos($aRect);
|
||||||
$this->vert->SetPos($aRect);
|
$this->vert->SetPos($aRect);
|
||||||
$this->hor->SetPos($aRect);
|
$this->hor->SetPos($aRect);
|
||||||
@ -445,7 +444,7 @@ class RectPatternCross extends RectPattern {
|
|||||||
$this->hor->SetDensity($aDens);
|
$this->hor->SetDensity($aDens);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoPattern(&$aImg) {
|
function DoPattern($aImg) {
|
||||||
$this->vert->DoPattern($aImg);
|
$this->vert->DoPattern($aImg);
|
||||||
$this->hor->DoPattern($aImg);
|
$this->hor->DoPattern($aImg);
|
||||||
}
|
}
|
||||||
@ -457,8 +456,8 @@ class RectPatternCross extends RectPattern {
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
|
|
||||||
class RectPatternDiagCross extends RectPattern {
|
class RectPatternDiagCross extends RectPattern {
|
||||||
var $left=null;
|
private $left=null;
|
||||||
var $right=null;
|
private $right=null;
|
||||||
function RectPatternDiagCross($aColor="black",$aWeight=1) {
|
function RectPatternDiagCross($aColor="black",$aWeight=1) {
|
||||||
parent::RectPattern($aColor,$aWeight);
|
parent::RectPattern($aColor,$aWeight);
|
||||||
$this->right = new RectPatternRDiag($aColor,$aWeight);
|
$this->right = new RectPatternRDiag($aColor,$aWeight);
|
||||||
@ -470,7 +469,7 @@ class RectPatternDiagCross extends RectPattern {
|
|||||||
$this->right->SetOrder($aDepth);
|
$this->right->SetOrder($aDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetPos(&$aRect) {
|
function SetPos($aRect) {
|
||||||
parent::SetPos($aRect);
|
parent::SetPos($aRect);
|
||||||
$this->left->SetPos($aRect);
|
$this->left->SetPos($aRect);
|
||||||
$this->right->SetPos($aRect);
|
$this->right->SetPos($aRect);
|
||||||
@ -481,7 +480,7 @@ class RectPatternDiagCross extends RectPattern {
|
|||||||
$this->right->SetDensity($aDens);
|
$this->right->SetDensity($aDens);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoPattern(&$aImg) {
|
function DoPattern($aImg) {
|
||||||
$this->left->DoPattern($aImg);
|
$this->left->DoPattern($aImg);
|
||||||
$this->right->DoPattern($aImg);
|
$this->right->DoPattern($aImg);
|
||||||
}
|
}
|
||||||
@ -523,7 +522,8 @@ class RectPatternFactory {
|
|||||||
$obj = new RectPatternDiagCross($aColor,$aWeight);
|
$obj = new RectPatternDiagCross($aColor,$aWeight);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise(" Unknown pattern specification ($aPattern)");
|
JpGraphError::RaiseL(16003,$aPattern);
|
||||||
|
//(" Unknown pattern specification ($aPattern)");
|
||||||
}
|
}
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
@ -537,15 +537,16 @@ class RectPatternFactory {
|
|||||||
// concrete class.
|
// concrete class.
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
class PlotBand {
|
class PlotBand {
|
||||||
var $prect=null;
|
public $depth; // Determine if band should be over or under the plots
|
||||||
var $depth;
|
private $prect=null;
|
||||||
var $dir, $min, $max;
|
private $dir, $min, $max;
|
||||||
|
|
||||||
function PlotBand($aDir,$aPattern,$aMin,$aMax,$aColor="black",$aWeight=1,$aDepth=DEPTH_BACK) {
|
function PlotBand($aDir,$aPattern,$aMin,$aMax,$aColor="black",$aWeight=1,$aDepth=DEPTH_BACK) {
|
||||||
$f = new RectPatternFactory();
|
$f = new RectPatternFactory();
|
||||||
$this->prect = $f->Create($aPattern,$aColor,$aWeight);
|
$this->prect = $f->Create($aPattern,$aColor,$aWeight);
|
||||||
if( is_numeric($aMin) && is_numeric($aMax) && ($aMin > $aMax) )
|
if( is_numeric($aMin) && is_numeric($aMax) && ($aMin > $aMax) )
|
||||||
JpGraphError::Raise('Min value for plotband is larger than specified max value. Please correct.');
|
JpGraphError::RaiseL(16004);
|
||||||
|
//('Min value for plotband is larger than specified max value. Please correct.');
|
||||||
$this->dir = $aDir;
|
$this->dir = $aDir;
|
||||||
$this->min = $aMin;
|
$this->min = $aMin;
|
||||||
$this->max = $aMax;
|
$this->max = $aMax;
|
||||||
@ -553,7 +554,7 @@ class PlotBand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set position. aRect contains absolute image coordinates
|
// Set position. aRect contains absolute image coordinates
|
||||||
function SetPos(&$aRect) {
|
function SetPos($aRect) {
|
||||||
assert( $this->prect != null ) ;
|
assert( $this->prect != null ) ;
|
||||||
$this->prect->SetPos($aRect);
|
$this->prect->SetPos($aRect);
|
||||||
}
|
}
|
||||||
@ -583,8 +584,12 @@ class PlotBand {
|
|||||||
return $this->max;
|
return $this->max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PreStrokeAdjust($aGraph) {
|
||||||
|
// Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
// Display band
|
// Display band
|
||||||
function Stroke(&$aImg,&$aXScale,&$aYScale) {
|
function Stroke($aImg,$aXScale,$aYScale) {
|
||||||
assert( $this->prect != null ) ;
|
assert( $this->prect != null ) ;
|
||||||
if( $this->dir == HORIZONTAL ) {
|
if( $this->dir == HORIZONTAL ) {
|
||||||
if( $this->min === 'min' ) $this->min = $aYScale->GetMinVal();
|
if( $this->min === 'min' ) $this->min = $aYScale->GetMinVal();
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
// Description: Polar plot extension for JpGraph
|
// Description: Polar plot extension for JpGraph
|
||||||
// Created: 2003-02-02
|
// Created: 2003-02-02
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_polar.php 21 2005-05-30 20:35:34Z ljp $
|
// Ver: $Id: jpgraph_polar.php 488 2006-02-04 12:26:03Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once ('jpgraph_plotmark.inc');
|
require_once ('jpgraph_plotmark.inc.php');
|
||||||
|
|
||||||
|
|
||||||
require_once "jpgraph_log.php";
|
require_once "jpgraph_log.php";
|
||||||
@ -35,22 +35,24 @@ DEFINE('POLAR_180',2);
|
|||||||
// class PolarPlot
|
// class PolarPlot
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
class PolarPlot {
|
class PolarPlot {
|
||||||
var $numpoints=0;
|
public $line_style='solid',$mark;
|
||||||
var $iColor='navy',$iFillColor='';
|
public $legendcsimtarget='';
|
||||||
var $iLineWeight=1;
|
public $legendcsimalt='';
|
||||||
var $coord=null;
|
public $legend="";
|
||||||
var $legendcsimtarget='';
|
public $csimtargets=array(); // Array of targets for CSIM
|
||||||
var $legendcsimalt='';
|
public $csimareas=""; // Resultant CSIM area tags
|
||||||
var $legend="";
|
public $csimalts=null; // ALT:s for corresponding target
|
||||||
var $csimtargets=array(); // Array of targets for CSIM
|
public $scale=null;
|
||||||
var $csimareas=""; // Resultant CSIM area tags
|
private $numpoints=0;
|
||||||
var $csimalts=null; // ALT:s for corresponding target
|
private $iColor='navy',$iFillColor='';
|
||||||
var $line_style='solid',$mark;
|
private $iLineWeight=1;
|
||||||
|
private $coord=null;
|
||||||
|
|
||||||
function PolarPlot($aData) {
|
function PolarPlot($aData) {
|
||||||
$n = count($aData);
|
$n = count($aData);
|
||||||
if( $n & 1 ) {
|
if( $n & 1 ) {
|
||||||
JpGraphError::Raise('Polar plots must have an even number of data point. Each data point is a tuple (angle,radius).');
|
JpGraphError::RaiseL(17001);
|
||||||
|
//('Polar plots must have an even number of data point. Each data point is a tuple (angle,radius).');
|
||||||
}
|
}
|
||||||
$this->numpoints = $n/2;
|
$this->numpoints = $n/2;
|
||||||
$this->coord = $aData;
|
$this->coord = $aData;
|
||||||
@ -97,7 +99,7 @@ class PolarPlot {
|
|||||||
|
|
||||||
// Private methods
|
// Private methods
|
||||||
|
|
||||||
function Legend(&$aGraph) {
|
function Legend($aGraph) {
|
||||||
$color = $this->iColor ;
|
$color = $this->iColor ;
|
||||||
if( $this->legend != "" ) {
|
if( $this->legend != "" ) {
|
||||||
if( $this->iFillColor!='' ) {
|
if( $this->iFillColor!='' ) {
|
||||||
@ -149,17 +151,17 @@ class PolarPlot {
|
|||||||
// class PolarAxis
|
// class PolarAxis
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
class PolarAxis extends Axis {
|
class PolarAxis extends Axis {
|
||||||
var $angle_step=15,$angle_color='lightgray',$angle_label_color='black';
|
private $angle_step=15,$angle_color='lightgray',$angle_label_color='black';
|
||||||
var $angle_fontfam=FF_FONT1,$angle_fontstyle=FS_NORMAL,$angle_fontsize=10;
|
private $angle_fontfam=FF_FONT1,$angle_fontstyle=FS_NORMAL,$angle_fontsize=10;
|
||||||
var $angle_fontcolor = 'navy';
|
private $angle_fontcolor = 'navy';
|
||||||
var $gridminor_color='lightgray',$gridmajor_color='lightgray';
|
private $gridminor_color='lightgray',$gridmajor_color='lightgray';
|
||||||
var $show_minor_grid = false, $show_major_grid = true ;
|
private $show_minor_grid = false, $show_major_grid = true ;
|
||||||
var $show_angle_mark=true, $show_angle_grid=true, $show_angle_label=true;
|
private $show_angle_mark=true, $show_angle_grid=true, $show_angle_label=true;
|
||||||
var $angle_tick_len=3, $angle_tick_len2=3, $angle_tick_color='black';
|
private $angle_tick_len=3, $angle_tick_len2=3, $angle_tick_color='black';
|
||||||
var $show_angle_tick=true;
|
private $show_angle_tick=true;
|
||||||
var $radius_tick_color='black';
|
private $radius_tick_color='black';
|
||||||
|
|
||||||
function PolarAxis(&$img,&$aScale) {
|
function PolarAxis($img,$aScale) {
|
||||||
parent::Axis($img,$aScale);
|
parent::Axis($img,$aScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +482,7 @@ class PolarAxis extends Axis {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke($pos) {
|
function Stroke($pos,$dummy=true) {
|
||||||
|
|
||||||
$this->img->SetLineWeight($this->weight);
|
$this->img->SetLineWeight($this->weight);
|
||||||
$this->img->SetColor($this->color);
|
$this->img->SetColor($this->color);
|
||||||
@ -490,16 +492,16 @@ class PolarAxis extends Axis {
|
|||||||
$this->img->width-$this->img->right_margin,$pos+$this->weight-1);
|
$this->img->width-$this->img->right_margin,$pos+$this->weight-1);
|
||||||
$y=$pos+$this->img->GetFontHeight()+$this->title_margin+$this->title->margin;
|
$y=$pos+$this->img->GetFontHeight()+$this->title_margin+$this->title->margin;
|
||||||
if( $this->title_adjust=="high" )
|
if( $this->title_adjust=="high" )
|
||||||
$this->title->Pos($this->img->width-$this->img->right_margin,$y,"right","top");
|
$this->title->SetPos($this->img->width-$this->img->right_margin,$y,"right","top");
|
||||||
elseif( $this->title_adjust=="middle" || $this->title_adjust=="center" )
|
elseif( $this->title_adjust=="middle" || $this->title_adjust=="center" )
|
||||||
$this->title->Pos(($this->img->width-$this->img->left_margin-
|
$this->title->SetPos(($this->img->width-$this->img->left_margin-
|
||||||
$this->img->right_margin)/2+$this->img->left_margin,
|
$this->img->right_margin)/2+$this->img->left_margin,
|
||||||
$y,"center","top");
|
$y,"center","top");
|
||||||
elseif($this->title_adjust=="low")
|
elseif($this->title_adjust=="low")
|
||||||
$this->title->Pos($this->img->left_margin,$y,"left","top");
|
$this->title->SetPos($this->img->left_margin,$y,"left","top");
|
||||||
else {
|
else {
|
||||||
JpGraphError::Raise('Unknown alignment specified for X-axis title. ('.
|
JpGraphError::RaiseL(17002,$this->title_adjust);
|
||||||
$this->title_adjust.')');
|
//('Unknown alignment specified for X-axis title. ('.$this->title_adjust.')');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -573,10 +575,11 @@ class PolarAxis extends Axis {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PolarScale extends LinearScale {
|
class PolarScale extends LinearScale {
|
||||||
var $graph;
|
private $graph;
|
||||||
function PolarScale($aMax=0,&$graph) {
|
|
||||||
|
function PolarScale($aMax=0,$graph) {
|
||||||
parent::LinearScale(0,$aMax,'x');
|
parent::LinearScale(0,$aMax,'x');
|
||||||
$this->graph = &$graph;
|
$this->graph = $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _Translate($v) {
|
function _Translate($v) {
|
||||||
@ -605,10 +608,10 @@ class PolarScale extends LinearScale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PolarLogScale extends LogScale {
|
class PolarLogScale extends LogScale {
|
||||||
var $graph;
|
private $graph;
|
||||||
function PolarLogScale($aMax=1,&$graph) {
|
function PolarLogScale($aMax=1,$graph) {
|
||||||
parent::LogScale(0,$aMax,'x');
|
parent::LogScale(0,$aMax,'x');
|
||||||
$this->graph = &$graph;
|
$this->graph = $graph;
|
||||||
$this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE);
|
$this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -637,9 +640,9 @@ class PolarLogScale extends LogScale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PolarGraph extends Graph {
|
class PolarGraph extends Graph {
|
||||||
var $scale;
|
public $scale;
|
||||||
var $iType=POLAR_360;
|
public $axis;
|
||||||
var $axis;
|
public $iType=POLAR_360;
|
||||||
|
|
||||||
function PolarGraph($aWidth=300,$aHeight=200,$aCachedName="",$aTimeOut=0,$aInline=true) {
|
function PolarGraph($aWidth=300,$aHeight=200,$aCachedName="",$aTimeOut=0,$aInline=true) {
|
||||||
parent::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline) ;
|
parent::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline) ;
|
||||||
@ -661,14 +664,14 @@ class PolarGraph extends Graph {
|
|||||||
//JpGraphError::Raise('Set90AndMargin() is not supported for polar graphs.');
|
//JpGraphError::Raise('Set90AndMargin() is not supported for polar graphs.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetScale($aScale,$rmax=0) {
|
function SetScale($aScale,$rmax=0,$dummy1=1,$dummy2=1,$dummy3=1) {
|
||||||
if( $aScale == 'lin' )
|
if( $aScale == 'lin' )
|
||||||
$this->scale = new PolarScale($rmax,$this);
|
$this->scale = new PolarScale($rmax,$this);
|
||||||
elseif( $aScale == 'log' ) {
|
elseif( $aScale == 'log' ) {
|
||||||
$this->scale = new PolarLogScale($rmax,$this);
|
$this->scale = new PolarLogScale($rmax,$this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JpGraphError::Raise('Unknown scale type for polar graph. Must be "lin" or "log"');
|
JpGraphError::RaiseL(17004);//('Unknown scale type for polar graph. Must be "lin" or "log"');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->axis = new PolarAxis($this->img,$this->scale);
|
$this->axis = new PolarAxis($this->img,$this->scale);
|
||||||
@ -690,7 +693,7 @@ class PolarGraph extends Graph {
|
|||||||
$m = $this->plots[0]->Max();
|
$m = $this->plots[0]->Max();
|
||||||
$i=1;
|
$i=1;
|
||||||
while($i < $n) {
|
while($i < $n) {
|
||||||
$m = max($this->plots[$i]->Max());
|
$m = max($this->plots[$i]->Max(),$m);
|
||||||
++$i;
|
++$i;
|
||||||
}
|
}
|
||||||
return $m;
|
return $m;
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
// Description: Radar plot extension for JpGraph
|
// Description: Radar plot extension for JpGraph
|
||||||
// Created: 2001-02-04
|
// Created: 2001-02-04
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_radar.php 213 2005-10-11 18:22:00Z ljp $
|
// Ver: $Id: jpgraph_radar.php 606 2006-03-23 18:37:57Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once('jpgraph_plotmark.inc');
|
require_once('jpgraph_plotmark.inc.php');
|
||||||
|
|
||||||
class RadarLogTicks extends Ticks {
|
class RadarLogTicks extends Ticks {
|
||||||
//---------------
|
//---------------
|
||||||
@ -21,7 +21,7 @@ class RadarLogTicks extends Ticks {
|
|||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
|
|
||||||
// TODO: Add Argument grid
|
// TODO: Add Argument grid
|
||||||
function Stroke(&$aImg,&$grid,$aPos,$aAxisAngle,&$aScale,&$aMajPos,&$aMajLabel) {
|
function Stroke($aImg,&$grid,$aPos,$aAxisAngle,$aScale,&$aMajPos,&$aMajLabel) {
|
||||||
$start = $aScale->GetMinVal();
|
$start = $aScale->GetMinVal();
|
||||||
$limit = $aScale->GetMaxVal();
|
$limit = $aScale->GetMaxVal();
|
||||||
$nextMajor = 10*$start;
|
$nextMajor = 10*$start;
|
||||||
@ -72,6 +72,7 @@ class RadarLogTicks extends Ticks {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
$l = $nextMajor;
|
$l = $nextMajor;
|
||||||
|
|
||||||
$aMajLabel[]=$l;
|
$aMajLabel[]=$l;
|
||||||
$nextMajor *= 10;
|
$nextMajor *= 10;
|
||||||
$step *= 10;
|
$step *= 10;
|
||||||
@ -87,7 +88,13 @@ class RadarLogTicks extends Ticks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class RadarLinearTicks extends LinearTicks {
|
class RadarLinearTicks extends Ticks { // extends LinearTicks {
|
||||||
|
|
||||||
|
private $minor_step=1, $major_step=2;
|
||||||
|
private $xlabel_offset=0,$xtick_offset=0;
|
||||||
|
private $maj_ticks_pos=array();
|
||||||
|
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function RadarLinearTicks() {
|
function RadarLinearTicks() {
|
||||||
@ -97,8 +104,36 @@ class RadarLinearTicks extends LinearTicks {
|
|||||||
//---------------
|
//---------------
|
||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
|
|
||||||
// TODO: Add argument grid
|
|
||||||
function Stroke(&$aImg,&$grid,$aPos,$aAxisAngle,&$aScale,&$aMajPos,&$aMajLabel) {
|
// Return major step size in world coordinates
|
||||||
|
function GetMajor() {
|
||||||
|
return $this->major_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return minor step size in world coordinates
|
||||||
|
function GetMinor() {
|
||||||
|
return $this->minor_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Minor and Major ticks (in world coordinates)
|
||||||
|
function Set($aMajStep,$aMinStep=false) {
|
||||||
|
if( $aMinStep==false )
|
||||||
|
$aMinStep=$aMajStep;
|
||||||
|
|
||||||
|
if( $aMajStep <= 0 || $aMinStep <= 0 ) {
|
||||||
|
JpGraphError::Raise(" Minor or major step size is 0. Check that you haven't
|
||||||
|
got an accidental SetTextTicks(0) in your code.<p>
|
||||||
|
If this is not the case you might have stumbled upon a bug in JpGraph.
|
||||||
|
Please report this and if possible include the data that caused the
|
||||||
|
problem.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->major_step=$aMajStep;
|
||||||
|
$this->minor_step=$aMinStep;
|
||||||
|
$this->is_set = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Stroke($aImg,&$grid,$aPos,$aAxisAngle,$aScale,&$aMajPos,&$aMajLabel) {
|
||||||
// Prepare to draw linear ticks
|
// Prepare to draw linear ticks
|
||||||
$maj_step_abs = abs($aScale->scale_factor*$this->major_step);
|
$maj_step_abs = abs($aScale->scale_factor*$this->major_step);
|
||||||
$min_step_abs = abs($aScale->scale_factor*$this->minor_step);
|
$min_step_abs = abs($aScale->scale_factor*$this->minor_step);
|
||||||
@ -113,7 +148,9 @@ class RadarLinearTicks extends LinearTicks {
|
|||||||
$label=$aScale->scale[0]+$this->major_step;
|
$label=$aScale->scale[0]+$this->major_step;
|
||||||
|
|
||||||
$aImg->SetLineWeight($this->weight);
|
$aImg->SetLineWeight($this->weight);
|
||||||
|
// NEW
|
||||||
|
$aMajPos = array();
|
||||||
|
$aMajLabel = array();
|
||||||
for($i=1; $i<=$nbrmaj; ++$i) {
|
for($i=1; $i<=$nbrmaj; ++$i) {
|
||||||
$xt=round($i*$maj_step_abs*cos($aAxisAngle))+$aScale->scale_abs[0];
|
$xt=round($i*$maj_step_abs*cos($aAxisAngle))+$aScale->scale_abs[0];
|
||||||
$yt=$aPos-round($i*$maj_step_abs*sin($aAxisAngle));
|
$yt=$aPos-round($i*$maj_step_abs*sin($aAxisAngle));
|
||||||
@ -161,12 +198,12 @@ class RadarLinearTicks extends LinearTicks {
|
|||||||
// CLASS RadarAxis
|
// CLASS RadarAxis
|
||||||
// Description: Implements axis for the radar graph
|
// Description: Implements axis for the radar graph
|
||||||
//===================================================
|
//===================================================
|
||||||
class RadarAxis extends Axis {
|
class RadarAxis extends AxisPrototype {
|
||||||
var $title_color="navy";
|
private $title_color="navy";
|
||||||
var $title=null;
|
public $title=null;
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function RadarAxis(&$img,&$aScale,$color=array(0,0,0)) {
|
function RadarAxis($img,$aScale,$color=array(0,0,0)) {
|
||||||
parent::Axis($img,$aScale,$color);
|
parent::Axis($img,$aScale,$color);
|
||||||
$this->len=$img->plotheight;
|
$this->len=$img->plotheight;
|
||||||
$this->title = new Text();
|
$this->title = new Text();
|
||||||
@ -175,8 +212,9 @@ class RadarAxis extends Axis {
|
|||||||
}
|
}
|
||||||
//---------------
|
//---------------
|
||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
function SetTickLabels($l) {
|
function SetTickLabels($aLabelArray,$aLabelColorArray=null) {
|
||||||
$this->ticks_label = $l;
|
$this->ticks_label = $aLabelArray;
|
||||||
|
$this->ticks_label_colors = $aLabelColorArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,18 +237,25 @@ class RadarAxis extends Axis {
|
|||||||
$this->img->Line($this->scale->scale_abs[0],$pos,$x,$y);
|
$this->img->Line($this->scale->scale_abs[0],$pos,$x,$y);
|
||||||
|
|
||||||
$this->scale->ticks->Stroke($this->img,$grid,$pos,$aAxisAngle,$this->scale,$majpos,$majlabel);
|
$this->scale->ticks->Stroke($this->img,$grid,$pos,$aAxisAngle,$this->scale,$majpos,$majlabel);
|
||||||
|
$ncolor=0;
|
||||||
|
if( isset($this->ticks_label_colors) )
|
||||||
|
$ncolor=count($this->ticks_label_colors);
|
||||||
|
|
||||||
// Draw labels
|
// Draw labels
|
||||||
if( $lf && !$this->hide ) {
|
if( $lf && !$this->hide ) {
|
||||||
$this->img->SetFont($this->font_family,$this->font_style,$this->font_size);
|
$this->img->SetFont($this->font_family,$this->font_style,$this->font_size);
|
||||||
$this->img->SetTextAlign("left","top");
|
$this->img->SetTextAlign("left","top");
|
||||||
$this->img->SetColor($this->color);
|
$this->img->SetColor($this->label_color);
|
||||||
|
|
||||||
// majpos contsins (x,y) coordinates for labels
|
// majpos contains (x,y) coordinates for labels
|
||||||
if( ! $this->hide_labels ) {
|
if( ! $this->hide_labels ) {
|
||||||
$n = floor(count($majpos)/2);
|
$n = floor(count($majpos)/2);
|
||||||
for($i=0; $i < $n; ++$i) {
|
for($i=0; $i < $n; ++$i) {
|
||||||
if( $this->ticks_label != null )
|
// Set specific label color if specified
|
||||||
|
if( $ncolor > 0 )
|
||||||
|
$this->img->SetColor($this->ticks_label_colors[$i % $ncolor]);
|
||||||
|
|
||||||
|
if( $this->ticks_label != null && isset($this->ticks_label[$i]) )
|
||||||
$this->img->StrokeText($majpos[$i*2],$majpos[$i*2+1],$this->ticks_label[$i]);
|
$this->img->StrokeText($majpos[$i*2],$majpos[$i*2+1],$this->ticks_label[$i]);
|
||||||
else
|
else
|
||||||
$this->img->StrokeText($majpos[$i*2],$majpos[$i*2+1],$majlabel[$i]);
|
$this->img->StrokeText($majpos[$i*2],$majpos[$i*2+1],$majlabel[$i]);
|
||||||
@ -239,8 +284,8 @@ class RadarAxis extends Axis {
|
|||||||
|
|
||||||
$h=$this->img->GetTextHeight($title)*1.2;
|
$h=$this->img->GetTextHeight($title)*1.2;
|
||||||
$w=$this->img->GetTextWidth($title)*1.2;
|
$w=$this->img->GetTextWidth($title)*1.2;
|
||||||
while( $aAxisAngle > 2*M_PI ) $aAxisAngle -= 2*M_PI;
|
|
||||||
|
|
||||||
|
while( $aAxisAngle > 2*M_PI ) $aAxisAngle -= 2*M_PI;
|
||||||
if( $aAxisAngle>=7*M_PI/4 || $aAxisAngle <= M_PI/4 ) $dx=0;
|
if( $aAxisAngle>=7*M_PI/4 || $aAxisAngle <= M_PI/4 ) $dx=0;
|
||||||
if( $aAxisAngle>=M_PI/4 && $aAxisAngle <= 3*M_PI/4 ) $dx=($aAxisAngle-M_PI/4)*2/M_PI;
|
if( $aAxisAngle>=M_PI/4 && $aAxisAngle <= 3*M_PI/4 ) $dx=($aAxisAngle-M_PI/4)*2/M_PI;
|
||||||
if( $aAxisAngle>=3*M_PI/4 && $aAxisAngle <= 5*M_PI/4 ) $dx=1;
|
if( $aAxisAngle>=3*M_PI/4 && $aAxisAngle <= 5*M_PI/4 ) $dx=1;
|
||||||
@ -265,15 +310,38 @@ class RadarAxis extends Axis {
|
|||||||
// CLASS RadarGrid
|
// CLASS RadarGrid
|
||||||
// Description: Draws grid for the radar graph
|
// Description: Draws grid for the radar graph
|
||||||
//===================================================
|
//===================================================
|
||||||
class RadarGrid extends Grid {
|
class RadarGrid { //extends Grid {
|
||||||
|
private $type='solid';
|
||||||
|
private $grid_color='#DDDDDD';
|
||||||
|
private $show=false, $weight=1;
|
||||||
|
|
||||||
//------------
|
//------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function RadarGrid() {
|
function RadarGrid() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PUBLIC METHODS
|
||||||
|
function SetColor($aMajColor) {
|
||||||
|
$this->grid_color = $aMajColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetWeight($aWeight) {
|
||||||
|
$this->weight=$aWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Specify if grid should be dashed, dotted or solid
|
||||||
|
function SetLineStyle($aType) {
|
||||||
|
$this->type = $aType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decide if both major and minor grid should be displayed
|
||||||
|
function Show($aShowMajor=true) {
|
||||||
|
$this->show=$aShowMajor;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------
|
//----------------
|
||||||
// PRIVATE METHODS
|
// PRIVATE METHODS
|
||||||
function Stroke(&$img,&$grid) {
|
function Stroke($img,$grid) {
|
||||||
if( !$this->show ) return;
|
if( !$this->show ) return;
|
||||||
$nbrticks = count($grid[0])/2;
|
$nbrticks = count($grid[0])/2;
|
||||||
$nbrpnts = count($grid);
|
$nbrpnts = count($grid);
|
||||||
@ -306,13 +374,13 @@ class RadarGrid extends Grid {
|
|||||||
// Description: Plot a radarplot
|
// Description: Plot a radarplot
|
||||||
//===================================================
|
//===================================================
|
||||||
class RadarPlot {
|
class RadarPlot {
|
||||||
var $data=array();
|
public $mark=null;
|
||||||
var $fill=false, $fill_color=array(200,170,180);
|
public $legend="";
|
||||||
var $color=array(0,0,0);
|
private $data=array();
|
||||||
var $legend="";
|
private $fill=false, $fill_color=array(200,170,180);
|
||||||
var $weight=1;
|
private $color=array(0,0,0);
|
||||||
var $linestyle='solid';
|
private $weight=1;
|
||||||
var $mark=null;
|
private $linestyle='solid';
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function RadarPlot($data) {
|
function RadarPlot($data) {
|
||||||
@ -360,10 +428,11 @@ class RadarPlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function GetCSIMareas() {
|
function GetCSIMareas() {
|
||||||
JpGraphError::Raise("Client side image maps not supported for RadarPlots.");
|
JpGraphError::RaiseL(18001);
|
||||||
|
//("Client side image maps not supported for RadarPlots.");
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke(&$img, $pos, &$scale, $startangle) {
|
function Stroke($img, $pos, $scale, $startangle) {
|
||||||
$nbrpnts = count($this->data);
|
$nbrpnts = count($this->data);
|
||||||
$astep=2*M_PI/$nbrpnts;
|
$astep=2*M_PI/$nbrpnts;
|
||||||
$a=$startangle;
|
$a=$startangle;
|
||||||
@ -410,7 +479,7 @@ class RadarPlot {
|
|||||||
return count($this->data);
|
return count($this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Legend(&$graph) {
|
function Legend($graph) {
|
||||||
if( $this->legend=="" ) return;
|
if( $this->legend=="" ) return;
|
||||||
if( $this->fill )
|
if( $this->fill )
|
||||||
$graph->legend->Add($this->legend,$this->fill_color,$this->mark);
|
$graph->legend->Add($this->legend,$this->fill_color,$this->mark);
|
||||||
@ -425,11 +494,10 @@ class RadarPlot {
|
|||||||
// Description: Main container for a radar graph
|
// Description: Main container for a radar graph
|
||||||
//===================================================
|
//===================================================
|
||||||
class RadarGraph extends Graph {
|
class RadarGraph extends Graph {
|
||||||
var $posx;
|
public $grid,$axis=null;
|
||||||
var $posy;
|
private $posx,$posy;
|
||||||
var $len;
|
private $len;
|
||||||
var $plots=null, $axis_title=null;
|
private $axis_title=null;
|
||||||
var $grid,$axis=null;
|
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function RadarGraph($width=300,$height=200,$cachedName="",$timeout=0,$inline=1) {
|
function RadarGraph($width=300,$height=200,$cachedName="",$timeout=0,$inline=1) {
|
||||||
@ -448,7 +516,8 @@ class RadarGraph extends Graph {
|
|||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
function SupressTickMarks($f=true) {
|
function SupressTickMarks($f=true) {
|
||||||
if( ERR_DEPRECATED )
|
if( ERR_DEPRECATED )
|
||||||
JpGraphError::Raise('RadarGraph::SupressTickMarks() is deprecated. Use HideTickMarks() instead.');
|
JpGraphError::RaiseL(18002);
|
||||||
|
//('RadarGraph::SupressTickMarks() is deprecated. Use HideTickMarks() instead.');
|
||||||
$this->axis->scale->ticks->SupressTickMarks($f);
|
$this->axis->scale->ticks->SupressTickMarks($f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,27 +529,29 @@ class RadarGraph extends Graph {
|
|||||||
$this->yscale->ticks->SupressMinorTickMarks(!$aFlag);
|
$this->yscale->ticks->SupressMinorTickMarks(!$aFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetScale($axtype,$ymin=1,$ymax=1) {
|
function SetScale($axtype,$ymin=1,$ymax=1,$dummy1=null,$dumy2=null) {
|
||||||
if( $axtype != "lin" && $axtype != "log" ) {
|
if( $axtype != "lin" && $axtype != "log" ) {
|
||||||
JpGraphError::Raise("Illegal scale for radarplot ($axtype). Must be \"lin\" or \"log\"");
|
JpGraphError::RaiseL(18003,$axtype);
|
||||||
|
//("Illegal scale for radarplot ($axtype). Must be \"lin\" or \"log\"");
|
||||||
}
|
}
|
||||||
if( $axtype=="lin" ) {
|
if( $axtype=="lin" ) {
|
||||||
$this->yscale = & new LinearScale($ymin,$ymax);
|
$this->yscale = new LinearScale($ymin,$ymax);
|
||||||
$this->yscale->ticks = & new RadarLinearTicks();
|
$this->yscale->ticks = new RadarLinearTicks();
|
||||||
$this->yscale->ticks->SupressMinorTickMarks();
|
$this->yscale->ticks->SupressMinorTickMarks();
|
||||||
}
|
}
|
||||||
elseif( $axtype=="log" ) {
|
elseif( $axtype=="log" ) {
|
||||||
$this->yscale = & new LogScale($ymin,$ymax);
|
$this->yscale = new LogScale($ymin,$ymax);
|
||||||
$this->yscale->ticks = & new RadarLogTicks();
|
$this->yscale->ticks = new RadarLogTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->axis = & new RadarAxis($this->img,$this->yscale);
|
$this->axis = new RadarAxis($this->img,$this->yscale);
|
||||||
$this->grid = & new RadarGrid();
|
$this->grid = new RadarGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetSize($aSize) {
|
function SetSize($aSize) {
|
||||||
if( $aSize < 0.1 || $aSize>1 )
|
if( $aSize < 0.1 || $aSize>1 )
|
||||||
JpGraphError::Raise("Radar Plot size must be between 0.1 and 1. (Your value=$s)");
|
JpGraphError::RaiseL(18004,$aSize);
|
||||||
|
//("Radar Plot size must be between 0.1 and 1. (Your value=$s)");
|
||||||
$this->len=min($this->img->width,$this->img->height)*$aSize/2;
|
$this->len=min($this->img->width,$this->img->height)*$aSize/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +559,7 @@ class RadarGraph extends Graph {
|
|||||||
$this->SetSize($aSize);
|
$this->SetSize($aSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetTickDensity($densy=TICKD_NORMAL) {
|
function SetTickDensity($densy=TICKD_NORMAL,$dummy1=null) {
|
||||||
$this->ytick_factor=25;
|
$this->ytick_factor=25;
|
||||||
switch( $densy ) {
|
switch( $densy ) {
|
||||||
case TICKD_DENSE:
|
case TICKD_DENSE:
|
||||||
@ -504,7 +575,8 @@ class RadarGraph extends Graph {
|
|||||||
$this->ytick_factor=70;
|
$this->ytick_factor=70;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JpGraphError::Raise("RadarPlot Unsupported Tick density: $densy");
|
JpGraphError::RaiseL(18005,$densy);
|
||||||
|
//("RadarPlot Unsupported Tick density: $densy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,19 +598,20 @@ class RadarGraph extends Graph {
|
|||||||
$this->axis_title = $title;
|
$this->axis_title = $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Add(&$splot) {
|
function Add($splot) {
|
||||||
$this->plots[]=$splot;
|
$this->plots[]=$splot;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetPlotsYMinMax() {
|
function GetPlotsYMinMax($aPlots) {
|
||||||
$min=$this->plots[0]->Min();
|
$min=$aPlots[0]->Min();
|
||||||
$max=$this->plots[0]->Max();
|
$max=$aPlots[0]->Max();
|
||||||
foreach( $this->plots as $p ) {
|
foreach( $this->plots as $p ) {
|
||||||
$max=max($max,$p->Max());
|
$max=max($max,$p->Max());
|
||||||
$min=min($min,$p->Min());
|
$min=min($min,$p->Min());
|
||||||
}
|
}
|
||||||
if( $min < 0 )
|
if( $min < 0 )
|
||||||
JpGraphError::Raise("Minimum data $min (Radar plots should only be used when all data points > 0)");
|
JpGraphError::RaiseL(18006,$min);
|
||||||
|
//("Minimum data $min (Radar plots should only be used when all data points > 0)");
|
||||||
return array($min,$max);
|
return array($min,$max);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,9 +620,23 @@ class RadarGraph extends Graph {
|
|||||||
$n = count($this->plots);
|
$n = count($this->plots);
|
||||||
// Set Y-scale
|
// Set Y-scale
|
||||||
if( !$this->yscale->IsSpecified() && count($this->plots)>0 ) {
|
if( !$this->yscale->IsSpecified() && count($this->plots)>0 ) {
|
||||||
list($min,$max) = $this->GetPlotsYMinMax();
|
list($min,$max) = $this->GetPlotsYMinMax($this->plots);
|
||||||
$this->yscale->AutoScale($this->img,0,$max,$this->len/$this->ytick_factor);
|
$this->yscale->AutoScale($this->img,0,$max,$this->len/$this->ytick_factor);
|
||||||
}
|
}
|
||||||
|
elseif( $this->yscale->IsSpecified() &&
|
||||||
|
( $this->yscale->auto_ticks || !$this->yscale->ticks->IsSpecified()) ) {
|
||||||
|
// The tick calculation will use the user suplied min/max values to determine
|
||||||
|
// the ticks. If auto_ticks is false the exact user specifed min and max
|
||||||
|
// values will be used for the scale.
|
||||||
|
// If auto_ticks is true then the scale might be slightly adjusted
|
||||||
|
// so that the min and max values falls on an even major step.
|
||||||
|
$min = $this->yscale->scale[0];
|
||||||
|
$max = $this->yscale->scale[1];
|
||||||
|
$this->yscale->AutoScale($this->img,$min,$max,
|
||||||
|
$this->len/$this->ytick_factor,
|
||||||
|
$this->yscale->auto_ticks);
|
||||||
|
}
|
||||||
|
|
||||||
// Set start position end length of scale (in absolute pixels)
|
// Set start position end length of scale (in absolute pixels)
|
||||||
$this->yscale->SetConstants($this->posx,$this->len);
|
$this->yscale->SetConstants($this->posx,$this->len);
|
||||||
|
|
||||||
@ -562,10 +649,12 @@ class RadarGraph extends Graph {
|
|||||||
$this->axis_title[$i] = $i+1;
|
$this->axis_title[$i] = $i+1;
|
||||||
}
|
}
|
||||||
elseif(count($this->axis_title)<$nbrpnts)
|
elseif(count($this->axis_title)<$nbrpnts)
|
||||||
JpGraphError::Raise("Number of titles does not match number of points in plot.");
|
JpGraphError::RaiseL(18007);
|
||||||
|
//("Number of titles does not match number of points in plot.");
|
||||||
for($i=0; $i < $n; ++$i )
|
for($i=0; $i < $n; ++$i )
|
||||||
if( $nbrpnts != $this->plots[$i]->GetCount() )
|
if( $nbrpnts != $this->plots[$i]->GetCount() )
|
||||||
JpGraphError::Raise("Each radar plot must have the same number of data points.");
|
JpGraphError::RaiseL(18008);
|
||||||
|
//("Each radar plot must have the same number of data points.");
|
||||||
|
|
||||||
if( $this->background_image != "" ) {
|
if( $this->background_image != "" ) {
|
||||||
$this->StrokeFrameBackground();
|
$this->StrokeFrameBackground();
|
||||||
@ -610,7 +699,7 @@ class RadarGraph extends Graph {
|
|||||||
|
|
||||||
// Should we do any final image transformation
|
// Should we do any final image transformation
|
||||||
if( $this->iImgTrans ) {
|
if( $this->iImgTrans ) {
|
||||||
if( !class_exists('ImgTrans') ) {
|
if( !class_exists('ImgTrans',false) ) {
|
||||||
require_once('jpgraph_imgtrans.php');
|
require_once('jpgraph_imgtrans.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Regression and statistical analysis helper classes
|
// Description: Regression and statistical analysis helper classes
|
||||||
// Created: 2002-12-01
|
// Created: 2002-12-01
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_regstat.php 327 2005-12-10 08:24:50Z ljp $
|
// Ver: $Id: jpgraph_regstat.php 614 2006-04-19 19:36:32Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -18,9 +18,9 @@
|
|||||||
class Spline {
|
class Spline {
|
||||||
// 3:rd degree polynom approximation
|
// 3:rd degree polynom approximation
|
||||||
|
|
||||||
var $xdata,$ydata; // Data vectors
|
private $xdata,$ydata; // Data vectors
|
||||||
var $y2; // 2:nd derivate of ydata
|
private $y2; // 2:nd derivate of ydata
|
||||||
var $n=0;
|
private $n=0;
|
||||||
|
|
||||||
function Spline($xdata,$ydata) {
|
function Spline($xdata,$ydata) {
|
||||||
$this->y2 = array();
|
$this->y2 = array();
|
||||||
@ -29,6 +29,10 @@ class Spline {
|
|||||||
|
|
||||||
$n = count($ydata);
|
$n = count($ydata);
|
||||||
$this->n = $n;
|
$this->n = $n;
|
||||||
|
if( $this->n !== count($xdata) ) {
|
||||||
|
JpGraphError::RaiseL(19001);
|
||||||
|
//('Spline: Number of X and Y coordinates must be the same');
|
||||||
|
}
|
||||||
|
|
||||||
// Natural spline 2:derivate == 0 at endpoints
|
// Natural spline 2:derivate == 0 at endpoints
|
||||||
$this->y2[0] = 0.0;
|
$this->y2[0] = 0.0;
|
||||||
@ -39,7 +43,8 @@ class Spline {
|
|||||||
for($i=1; $i < $n-1; ++$i) {
|
for($i=1; $i < $n-1; ++$i) {
|
||||||
$d = ($xdata[$i+1]-$xdata[$i-1]);
|
$d = ($xdata[$i+1]-$xdata[$i-1]);
|
||||||
if( $d == 0 ) {
|
if( $d == 0 ) {
|
||||||
JpGraphError::Raise('Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.');
|
JpGraphError::RaiseL(19002);
|
||||||
|
//('Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.');
|
||||||
}
|
}
|
||||||
$s = ($xdata[$i]-$xdata[$i-1])/$d;
|
$s = ($xdata[$i]-$xdata[$i-1])/$d;
|
||||||
$p = $s*$this->y2[$i-1]+2.0;
|
$p = $s*$this->y2[$i-1]+2.0;
|
||||||
@ -89,7 +94,8 @@ class Spline {
|
|||||||
$h = $this->xdata[$max]-$this->xdata[$min];
|
$h = $this->xdata[$max]-$this->xdata[$min];
|
||||||
|
|
||||||
if( $h == 0 ) {
|
if( $h == 0 ) {
|
||||||
JpGraphError::Raise('Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.');
|
JpGraphError::RaiseL(19002);
|
||||||
|
//('Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,22 +118,30 @@ class Bezier {
|
|||||||
* computed from control points data sets, based on Paul Bourke algorithm :
|
* computed from control points data sets, based on Paul Bourke algorithm :
|
||||||
* http://astronomy.swin.edu.au/~pbourke/curves/bezier/
|
* http://astronomy.swin.edu.au/~pbourke/curves/bezier/
|
||||||
*/
|
*/
|
||||||
var $datax = array();
|
private $datax = array();
|
||||||
var $datay = array();
|
private $datay = array();
|
||||||
|
private $n=0;
|
||||||
|
|
||||||
function Bezier($datax, $datay, $attraction_factor = 1) {
|
function Bezier($datax, $datay, $attraction_factor = 1) {
|
||||||
// Adding control point multiple time will raise their attraction power over the curve
|
// Adding control point multiple time will raise their attraction power over the curve
|
||||||
|
$this->n = count($datax);
|
||||||
|
if( $this->n !== count($datay) ) {
|
||||||
|
JpGraphError::RaiseL(19003);
|
||||||
|
//('Bezier: Number of X and Y coordinates must be the same');
|
||||||
|
}
|
||||||
|
$idx=0;
|
||||||
foreach($datax as $datumx) {
|
foreach($datax as $datumx) {
|
||||||
for ($i = 0; $i < $attraction_factor; $i++) {
|
for ($i = 0; $i < $attraction_factor; $i++) {
|
||||||
$this->datax[] = $datumx;
|
$this->datax[$idx++] = $datumx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$idx=0;
|
||||||
foreach($datay as $datumy) {
|
foreach($datay as $datumy) {
|
||||||
for ($i = 0; $i < $attraction_factor; $i++) {
|
for ($i = 0; $i < $attraction_factor; $i++) {
|
||||||
$this->datay[] = $datumy;
|
$this->datay[$idx++] = $datumy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->n *= $attraction_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get($steps) {
|
function Get($steps) {
|
||||||
@ -146,7 +160,7 @@ class Bezier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function GetPoint($mu) {
|
function GetPoint($mu) {
|
||||||
$n = count($this->datax)-1;
|
$n = $this->n - 1;
|
||||||
$k = 0;
|
$k = 0;
|
||||||
$kn = 0;
|
$kn = 0;
|
||||||
$nn = 0;
|
$nn = 0;
|
||||||
|
@ -4,22 +4,22 @@
|
|||||||
// Description: Scatter (and impuls) plot extension for JpGraph
|
// Description: Scatter (and impuls) plot extension for JpGraph
|
||||||
// Created: 2001-02-11
|
// Created: 2001-02-11
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_scatter.php 53 2005-06-06 18:12:54Z ljp $
|
// Ver: $Id: jpgraph_scatter.php 492 2006-02-04 12:29:02Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
*/
|
*/
|
||||||
require_once ('jpgraph_plotmark.inc');
|
require_once ('jpgraph_plotmark.inc.php');
|
||||||
|
|
||||||
//===================================================
|
//===================================================
|
||||||
// CLASS FieldArrow
|
// CLASS FieldArrow
|
||||||
// Description: Draw an arrow at (x,y) with angle a
|
// Description: Draw an arrow at (x,y) with angle a
|
||||||
//===================================================
|
//===================================================
|
||||||
class FieldArrow {
|
class FieldArrow {
|
||||||
var $iSize=10; // Length in pixels for arrow
|
public $iColor='black';
|
||||||
var $iArrowSize = 2;
|
public $iSize=10; // Length in pixels for arrow
|
||||||
var $iColor='black';
|
public $iArrowSize = 2;
|
||||||
var $isizespec = array(
|
private $isizespec = array(
|
||||||
array(2,1),array(3,2),array(4,3),array(6,4),array(7,4),array(8,5),array(10,6),array(12,7),array(16,8),array(20,10));
|
array(2,1),array(3,2),array(4,3),array(6,4),array(7,4),array(8,5),array(10,6),array(12,7),array(16,8),array(20,10));
|
||||||
function FieldArrow() {
|
function FieldArrow() {
|
||||||
}
|
}
|
||||||
@ -62,13 +62,13 @@ class FieldArrow {
|
|||||||
// Description: Render a field plot
|
// Description: Render a field plot
|
||||||
//===================================================
|
//===================================================
|
||||||
class FieldPlot extends Plot {
|
class FieldPlot extends Plot {
|
||||||
var $iAngles;
|
private $iAngles;
|
||||||
var $iCallback='';
|
private $iCallback='';
|
||||||
function FieldPlot($datay,$datax,$angles) {
|
function FieldPlot($datay,$datax,$angles) {
|
||||||
if( (count($datax) != count($datay)) )
|
if( (count($datax) != count($datay)) )
|
||||||
JpGraphError::Raise("Fieldplots must have equal number of X and Y points.");
|
JpGraphError::RaiseL(20001);//("Fieldplots must have equal number of X and Y points.");
|
||||||
if( (count($datax) != count($angles)) )
|
if( (count($datax) != count($angles)) )
|
||||||
JpGraphError::Raise("Fieldplots must have an angle specified for each X and Y points.");
|
JpGraphError::RaiseL(20002);//("Fieldplots must have an angle specified for each X and Y points.");
|
||||||
|
|
||||||
$this->iAngles = $angles;
|
$this->iAngles = $angles;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ class FieldPlot extends Plot {
|
|||||||
$this->iCallback = $aFunc;
|
$this->iCallback = $aFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
|
|
||||||
// Remeber base color and size
|
// Remeber base color and size
|
||||||
$bc = $this->arrow->iColor;
|
$bc = $this->arrow->iColor;
|
||||||
@ -116,7 +116,7 @@ class FieldPlot extends Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Framework function
|
// Framework function
|
||||||
function Legend(&$aGraph) {
|
function Legend($aGraph) {
|
||||||
if( $this->legend != "" ) {
|
if( $this->legend != "" ) {
|
||||||
$aGraph->legend->Add($this->legend,$this->mark->fill_color,$this->mark,0,
|
$aGraph->legend->Add($this->legend,$this->mark->fill_color,$this->mark,0,
|
||||||
$this->legendcsimtarget,$this->legendcsimalt);
|
$this->legendcsimtarget,$this->legendcsimalt);
|
||||||
@ -129,13 +129,13 @@ class FieldPlot extends Plot {
|
|||||||
// Description: Render X and Y plots
|
// Description: Render X and Y plots
|
||||||
//===================================================
|
//===================================================
|
||||||
class ScatterPlot extends Plot {
|
class ScatterPlot extends Plot {
|
||||||
var $impuls = false;
|
private $impuls = false;
|
||||||
var $linkpoints = false, $linkpointweight=1, $linkpointcolor="black";
|
private $linkpoints = false, $linkpointweight=1, $linkpointcolor="black";
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function ScatterPlot($datay,$datax=false) {
|
function ScatterPlot($datay,$datax=false) {
|
||||||
if( (count($datax) != count($datay)) && is_array($datax))
|
if( (count($datax) != count($datay)) && is_array($datax))
|
||||||
JpGraphError::Raise("Scatterplot must have equal number of X and Y points.");
|
JpGraphError::RaiseL(20003);//("Scatterplot must have equal number of X and Y points.");
|
||||||
$this->Plot($datay,$datax);
|
$this->Plot($datay,$datax);
|
||||||
$this->mark = new PlotMark();
|
$this->mark = new PlotMark();
|
||||||
$this->mark->SetType(MARK_SQUARE);
|
$this->mark->SetType(MARK_SQUARE);
|
||||||
@ -157,7 +157,7 @@ class ScatterPlot extends Plot {
|
|||||||
$this->linkpointweight=$aWeight;
|
$this->linkpointweight=$aWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stroke(&$img,&$xscale,&$yscale) {
|
function Stroke($img,$xscale,$yscale) {
|
||||||
|
|
||||||
$ymin=$yscale->scale_abs[0];
|
$ymin=$yscale->scale_abs[0];
|
||||||
if( $yscale->scale[0] < 0 )
|
if( $yscale->scale[0] < 0 )
|
||||||
@ -169,7 +169,7 @@ class ScatterPlot extends Plot {
|
|||||||
for( $i=0; $i<$this->numpoints; ++$i ) {
|
for( $i=0; $i<$this->numpoints; ++$i ) {
|
||||||
|
|
||||||
// Skip null values
|
// Skip null values
|
||||||
if( $this->coords[0][$i]==="" || $this->coords[0][$i]==='-' || $this->coords[0][$i]==='x')
|
if( $this->coords[0][$i]==='' || $this->coords[0][$i]==='-' || $this->coords[0][$i]==='x')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( isset($this->coords[1]) )
|
if( isset($this->coords[1]) )
|
||||||
@ -214,7 +214,7 @@ class ScatterPlot extends Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Framework function
|
// Framework function
|
||||||
function Legend(&$aGraph) {
|
function Legend($aGraph) {
|
||||||
if( $this->legend != "" ) {
|
if( $this->legend != "" ) {
|
||||||
$aGraph->legend->Add($this->legend,$this->mark->fill_color,$this->mark,0,
|
$aGraph->legend->Add($this->legend,$this->mark->fill_color,$this->mark,0,
|
||||||
$this->legendcsimtarget,$this->legendcsimalt);
|
$this->legendcsimtarget,$this->legendcsimalt);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Description: Stock plot extension for JpGraph
|
// Description: Stock plot extension for JpGraph
|
||||||
// Created: 2003-01-27
|
// Created: 2003-01-27
|
||||||
// Author: Johan Persson (johanp@aditus.nu)
|
// Author: Johan Persson (johanp@aditus.nu)
|
||||||
// Ver: $Id: jpgraph_stock.php 41 2005-06-06 10:46:10Z ljp $
|
// Ver: $Id: jpgraph_stock.php 494 2006-02-04 12:31:05Z ljp $
|
||||||
//
|
//
|
||||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -14,15 +14,16 @@
|
|||||||
// CLASS StockPlot
|
// CLASS StockPlot
|
||||||
//===================================================
|
//===================================================
|
||||||
class StockPlot extends Plot {
|
class StockPlot extends Plot {
|
||||||
var $iTupleSize = 4;
|
protected $iTupleSize = 4;
|
||||||
var $iWidth=9;
|
private $iWidth=9;
|
||||||
var $iEndLines=1;
|
private $iEndLines=1;
|
||||||
var $iStockColor1='white',$iStockColor2='darkred',$iStockColor3='darkred';
|
private $iStockColor1='white',$iStockColor2='darkred',$iStockColor3='darkred';
|
||||||
//---------------
|
//---------------
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
function StockPlot(&$datay,$datax=false) {
|
function StockPlot($datay,$datax=false) {
|
||||||
if( count($datay) % $this->iTupleSize ) {
|
if( count($datay) % $this->iTupleSize ) {
|
||||||
JpGraphError::Raise('Data values for Stock charts must contain an even multiple of '.$this->iTupleSize.' data points.');
|
JpGraphError::RaiseL(21001,$this->iTupleSize);
|
||||||
|
//('Data values for Stock charts must contain an even multiple of '.$this->iTupleSize.' data points.');
|
||||||
}
|
}
|
||||||
$this->Plot($datay,$datax);
|
$this->Plot($datay,$datax);
|
||||||
$this->numpoints /= $this->iTupleSize;
|
$this->numpoints /= $this->iTupleSize;
|
||||||
@ -47,7 +48,7 @@ class StockPlot extends Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gets called before any axis are stroked
|
// Gets called before any axis are stroked
|
||||||
function PreStrokeAdjust(&$graph) {
|
function PreStrokeAdjust($graph) {
|
||||||
if( $this->center ) {
|
if( $this->center ) {
|
||||||
$a=0.5; $b=0.5;
|
$a=0.5; $b=0.5;
|
||||||
$this->numpoints++;
|
$this->numpoints++;
|
||||||
@ -64,7 +65,8 @@ class StockPlot extends Plot {
|
|||||||
if( $this->center ) $n--;
|
if( $this->center ) $n--;
|
||||||
if( isset($this->coords[1]) ) {
|
if( isset($this->coords[1]) ) {
|
||||||
if( count($this->coords[1])!=$n )
|
if( count($this->coords[1])!=$n )
|
||||||
JpGraphError::Raise("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
JpGraphError::RaiseL(2003,count($this->coords[1]),$numpoints);
|
||||||
|
//("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
||||||
else
|
else
|
||||||
$exist_x = true;
|
$exist_x = true;
|
||||||
}
|
}
|
||||||
@ -156,7 +158,7 @@ class StockPlot extends Plot {
|
|||||||
// CLASS BoxPlot
|
// CLASS BoxPlot
|
||||||
//===================================================
|
//===================================================
|
||||||
class BoxPlot extends StockPlot {
|
class BoxPlot extends StockPlot {
|
||||||
var $iPColor='black',$iNColor='white';
|
private $iPColor='black',$iNColor='white';
|
||||||
function BoxPlot($datay,$datax=false) {
|
function BoxPlot($datay,$datax=false) {
|
||||||
$this->iTupleSize=5;
|
$this->iTupleSize=5;
|
||||||
parent::StockPlot($datay,$datax);
|
parent::StockPlot($datay,$datax);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user