From fc31680bd0289995caccfcb849d30d8056021f04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Mar 2020 02:55:06 +0100 Subject: [PATCH] Several fix for chart.js graphs --- htdocs/adherents/index.php | 2 +- htdocs/comm/propal/index.php | 2 +- htdocs/commande/index.php | 2 +- htdocs/contrat/index.php | 2 +- htdocs/core/boxes/box_graph_invoices_permonth.php | 1 + htdocs/core/class/conf.class.php | 2 ++ htdocs/core/class/dolgraph.class.php | 6 ++++-- htdocs/don/index.php | 2 +- htdocs/fichinter/index.php | 2 +- htdocs/product/index.php | 2 +- htdocs/projet/graph_opportunities.inc.php | 4 ++-- htdocs/societe/index.php | 2 +- htdocs/supplier_proposal/index.php | 2 +- htdocs/theme/eldy/global.inc.php | 4 ++-- htdocs/ticket/index.php | 8 ++++---- 15 files changed, 24 insertions(+), 19 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index cab3e002028..180fa2d4954 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -207,7 +207,7 @@ if ($conf->use_javascript_ajax) $dolgraph->setShowLegend(1); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); - $dolgraph->setWidth('100%'); + $dolgraph->setHeight('200'); $dolgraph->draw('idgraphstatus'); print $dolgraph->show($total ? 0 : 1); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 11bb4292036..1eff7f56520 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -144,7 +144,7 @@ if ($resql) $dolgraph->setShowLegend(1); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); - $dolgraph->setWidth('100%'); + $dolgraph->setHeight('200'); $dolgraph->draw('idgraphthirdparties'); print $dolgraph->show($total ? 0 : 1); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index b8866a7c487..fcd510282df 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -143,7 +143,7 @@ if ($resql) $dolgraph->setShowLegend(1); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); - $dolgraph->setWidth('100%'); + $dolgraph->setHeight('200'); $dolgraph->draw('idgraphstatus'); print $dolgraph->show($total ? 0 : 1); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 6dd6fc56e17..dccd02a86b6 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -212,7 +212,7 @@ if (!empty($conf->use_javascript_ajax)) $dolgraph->setShowLegend(1); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); - $dolgraph->setWidth('100%'); + $dolgraph->setHeight('200'); $dolgraph->draw('idgraphstatus'); print $dolgraph->show($total ? 0 : 1); diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 6c0a20bc6db..e78b6e235b1 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -160,6 +160,7 @@ class box_graph_invoices_permonth extends ModeleBoxes } $i++; } + $px1->SetLegend($legend); $px1->SetMaxValue($px1->GetCeilMaxValue()); $px1->SetWidth($WIDTH); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 87204294947..3500b2492fe 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -683,6 +683,8 @@ class Conf if (!isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0; + if (!isset($conf->global->MAIN_JS_GRAPH)) $conf->global->MAIN_JS_GRAPH = 'chart'; // Use chart.js library + if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567'; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 0035b4c813e..4dff7e50e76 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1025,7 +1025,7 @@ class DolGraph // No height for the pie grah $cssfordiv = 'dolgraphchart'; if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'pie' || $this->type[$firstlot] == 'polar')) $cssfordiv .= ' dolgraphcharpie'; - $this->stringtoshow .= '
'."\n"; + $this->stringtoshow .= '
'."\n"; $this->stringtoshow .= '