NEW X-Axis on graph are show vertical when there is a lot of values.

This commit is contained in:
Laurent Destailleur 2020-02-29 01:26:24 +01:00
parent f0d458682d
commit dea8525a6c
6 changed files with 39 additions and 11 deletions

View File

@ -951,7 +951,11 @@ class DolGraph
$this->stringtoshow .= '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
return;
}
$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"></div>'."\n";
// Start the div that will contains all the graph
$dolxaxisvertical='';
if (count($this->data) > 20) $dolxaxisvertical='dol-xaxis-vertical';
$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($dolxaxisvertical)?'':' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"></div>'."\n";
$this->stringtoshow .= '<script id="'.$tag.'">'."\n";
$this->stringtoshow .= '$(function () {'."\n";

View File

@ -82,7 +82,7 @@ $arrayoftype = array(
'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"),
'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/class/facturerec.class.php", 'langs'=>'bills'),
'bom' => array('label' => 'BOM', 'ObjectClassName' => 'Bom', 'enabled' => $conf->bom->enabled),
'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mo->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/mrp/class/mo.class.php"),
'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/mrp/class/mo.class.php"),
'ticket' => array('label' => 'Ticket', 'ObjectClassName' => 'Ticket', 'enabled' => $conf->ticket->enabled),
'member' => array('label' => 'Adherent', 'ObjectClassName' => 'Adherent', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", 'langs'=>'members'),
'cotisation' => array('label' => 'Subscriptions', 'ObjectClassName' => 'Subscription', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/subscription.class.php", 'langs'=>'members'),
@ -269,9 +269,9 @@ foreach ($object->fields as $key => $val) {
if (preg_match('/^pass/', $key)) continue;
if (in_array($val['type'], array('html', 'text'))) continue;
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position']);
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position']);
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position']);
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position'].'-y');
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position'].'-m');
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position'].'-d');
} else {
$arrayofxaxis['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']);
}
@ -283,7 +283,8 @@ foreach ($object->fields as $key => $val) {
}
}
}
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position');
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 1);
$arrayofxaxislabel = array();
foreach ($arrayofxaxis as $key => $val) {
$arrayofxaxislabel[$key] = $val['label'];

View File

@ -97,7 +97,7 @@ class Mo extends CommonObject
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1', 'noteditable'=>1),
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'maxwidth300'),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300'),
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75'),
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'isameasure'=>1),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth300'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1,),

View File

@ -3134,8 +3134,8 @@ class Product extends CommonObject
for ($j = 0; $j < 12; $j++)
{
$idx = ucfirst(dol_trunc(dol_print_date(dol_mktime(12, 0, 0, $month, 1, $year), "%b"), 3, 'right', 'UTF-8', 1));
$monthnum = sprintf("%02s", $month);
//$idx = ucfirst(dol_trunc(dol_print_date(dol_mktime(12, 0, 0, $month, 1, $year), "%b"), 3, 'right', 'UTF-8', 1));
$idx = ucfirst(dol_trunc(dol_print_date(dol_mktime(12, 0, 0, $month, 1, $year), "%b"), 1, 'right', 'UTF-8', 1));
$result[$j] = array($idx, isset($tab[$year.$month]) ? $tab[$year.$month] : 0);
// $result[$j] = array($monthnum,isset($tab[$year.$month])?$tab[$year.$month]:0);

View File

@ -6024,6 +6024,18 @@ div.tabsElem a.tab {
}
/* ============================================================================== */
/* CSS style used for jFlot */
/* ============================================================================== */
.dol-xaxis-vertical .flot-x-axis .flot-tick-label.tickLabel {
text-orientation: sideways;
font-weight: 400;
writing-mode: vertical-rl;
white-space: nowrap;
}
/* ============================================================================== */
/* CSS style used for small screen */
@ -6259,6 +6271,7 @@ if (!empty($conf->global->THEME_CUSTOM_CSS)) print $conf->global->THEME_CUSTOM_C
?>
div.flot-text .flot-tick-label .tickLabel{
/* Must be at end */
div.flot-text .flot-tick-label .tickLabel {
color: unset;
}

View File

@ -6008,6 +6008,17 @@ border-top-right-radius: 6px;
}
/* ============================================================================== */
/* CSS style used for jFlot */
/* ============================================================================== */
.dol-xaxis-vertical .flot-x-axis .flot-tick-label.tickLabel {
text-orientation: sideways;
font-weight: 400;
writing-mode: vertical-rl;
white-space: nowrap;
}
/* ============================================================================== */
/* CSS style used for small screen */
@ -6172,7 +6183,6 @@ border-top-right-radius: 6px;
}
<?php
include dol_buildpath($path.'/theme/'.$theme.'/dropdown.inc.php', 0);
include dol_buildpath($path.'/theme/'.$theme.'/info-box.inc.php', 0);