Skip to content

Commit

Permalink
NEW X-Axis on graph are show vertical when there is a lot of values.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 29, 2020
1 parent f0d4586 commit dea8525
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 11 deletions.
6 changes: 5 additions & 1 deletion htdocs/core/class/dolgraph.class.php
Expand Up @@ -951,7 +951,11 @@ private function draw_jflot($file, $fileurl)
$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";
Expand Down
11 changes: 6 additions & 5 deletions htdocs/core/customreports.php
Expand Up @@ -82,7 +82,7 @@
'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'),
Expand Down Expand Up @@ -269,9 +269,9 @@
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']);
}
Expand All @@ -283,7 +283,8 @@
}
}
}
$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'];
Expand Down
2 changes: 1 addition & 1 deletion htdocs/mrp/class/mo.class.php
Expand Up @@ -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,),
Expand Down
4 changes: 2 additions & 2 deletions htdocs/product/class/product.class.php
Expand Up @@ -3134,8 +3134,8 @@ private function _get_stats($sql, $mode, $year = 0)

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);
Expand Down
15 changes: 14 additions & 1 deletion htdocs/theme/eldy/global.inc.php
Expand Up @@ -6024,6 +6024,18 @@
}


/* ============================================================================== */
/* 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 */
Expand Down Expand Up @@ -6259,6 +6271,7 @@

?>

div.flot-text .flot-tick-label .tickLabel{
/* Must be at end */
div.flot-text .flot-tick-label .tickLabel {
color: unset;
}
12 changes: 11 additions & 1 deletion htdocs/theme/md/style.css.php
Expand Up @@ -6008,6 +6008,17 @@
}


/* ============================================================================== */
/* 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 */
Expand Down Expand Up @@ -6172,7 +6183,6 @@
}



<?php
include dol_buildpath($path.'/theme/'.$theme.'/dropdown.inc.php', 0);
include dol_buildpath($path.'/theme/'.$theme.'/info-box.inc.php', 0);
Expand Down

0 comments on commit dea8525

Please sign in to comment.