mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Several fix for chart.js graphs
This commit is contained in:
parent
f35f0ecf9d
commit
fc31680bd0
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$px1->SetLegend($legend);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
$px1->SetWidth($WIDTH);
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
||||
|
|
|
|||
|
|
@ -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 .= '<div id="placeholder_'.$tag.'" style="width:'.$this->width.(strpos($this->width, '%') > 0 ? '': 'px').';" class="'.$cssfordiv.' dolgraph'.(empty($dolxaxisvertical)?'':' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"><canvas id="canvas_'.$tag.'"></canvas></div>'."\n";
|
||||
$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="min-height: '.$this->height.(strpos($this->height, '%') > 0 ? '': 'px').'; width:'.$this->width.(strpos($this->width, '%') > 0 ? '': 'px').';" class="'.$cssfordiv.' dolgraph'.(empty($dolxaxisvertical)?'':' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"><canvas id="canvas_'.$tag.'"></canvas></div>'."\n";
|
||||
|
||||
$this->stringtoshow .= '<script id="'.$tag.'">'."\n";
|
||||
$i = $firstlot;
|
||||
|
|
@ -1135,12 +1135,14 @@ class DolGraph
|
|||
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) $type = 'line';
|
||||
|
||||
$this->stringtoshow .= '
|
||||
var options = { maintainAspectRatio: false, aspectRatio: 2.5 };
|
||||
|
||||
var ctx = document.getElementById("canvas_'.$tag.'").getContext("2d");
|
||||
var chart = new Chart(ctx, {
|
||||
// The type of chart we want to create
|
||||
type: \''.$type.'\',
|
||||
// Configuration options go here
|
||||
options: {},
|
||||
options: options,
|
||||
data: {
|
||||
labels: [';
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
$data = array('series'=>$dataseries);
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us
|
|||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowPercent(0);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
|||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->SetHeight(180);
|
||||
//$dolgraph->setWidth('100%');
|
||||
$dolgraph->SetHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($totaloppnb ? 0 : 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) +
|
|||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphthirdparties');
|
||||
print $dolgraph->show();
|
||||
print '</td></tr>'."\n";
|
||||
|
|
|
|||
|
|
@ -147,7 +147,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);
|
||||
|
||||
|
|
|
|||
|
|
@ -3403,7 +3403,7 @@ div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft
|
|||
background: -o-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%);
|
||||
background: -moz-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%);
|
||||
background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%);
|
||||
background: -ms-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%);
|
||||
/* background: -ms-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%); */
|
||||
}
|
||||
.noborder > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre),
|
||||
.noborder .oddeven.tagtr:nth-child(even):not(:last-child) .tagtd:not(.liste_titre)
|
||||
|
|
@ -3419,7 +3419,7 @@ div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft
|
|||
background: -o-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%);
|
||||
background: -moz-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%);
|
||||
background: -webkit-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%);
|
||||
background: -ms-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%);
|
||||
/* background: -ms-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%); */
|
||||
}
|
||||
.noborder > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre),
|
||||
.noborder .oddeven.tagtr:nth-child(odd):not(:last-child) .tagtd:not(.liste_titre)
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ if (empty($endyear)) {
|
|||
|
||||
$startyear = $endyear - 1;
|
||||
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '100%' : '80%';
|
||||
$HEIGHT = '228';
|
||||
$HEIGHT = '200';
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ if (!empty($dataseries) && count($dataseries) > 1) {
|
|||
$px1->SetType(array('pie'));
|
||||
$px1->SetLegend($legend);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
$px1->SetWidth($WIDTH);
|
||||
//$px1->SetWidth($WIDTH);
|
||||
$px1->SetHeight($HEIGHT);
|
||||
$px1->SetYLabel($langs->trans("TicketStatByStatus"));
|
||||
$px1->SetShading(3);
|
||||
|
|
@ -327,7 +327,7 @@ if ($result) {
|
|||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap">';
|
||||
print '<td class="nowraponall">';
|
||||
print $tickesupstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
|
||||
|
|
@ -356,7 +356,7 @@ if ($result) {
|
|||
print $objp->severity_label;
|
||||
print "</td>";
|
||||
|
||||
print '<td class="nowrap right">';
|
||||
print '<td class="nowraponall right">';
|
||||
print $tickesupstatic->getLibStatut(5);
|
||||
print "</td>";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user