Selaa lähdekoodia

NEW Can force position of legend of graph on right (instead of top)

Laurent Destailleur 5 vuotta sitten
vanhempi
commit
0bd2740779

+ 1 - 1
htdocs/adherents/index.php

@@ -204,7 +204,7 @@ if ($conf->use_javascript_ajax)
     $dolgraph = new DolGraph();
     $dolgraph->SetData($dataseries);
     $dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0));
-    $dolgraph->setShowLegend(1);
+    $dolgraph->setShowLegend(2);
     $dolgraph->setShowPercent(1);
     $dolgraph->SetType(array('pie'));
     $dolgraph->setHeight('200');

+ 1 - 1
htdocs/comm/propal/index.php

@@ -141,7 +141,7 @@ if ($resql)
         include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
         $dolgraph = new DolGraph();
         $dolgraph->SetData($dataseries);
-        $dolgraph->setShowLegend(1);
+        $dolgraph->setShowLegend(2);
         $dolgraph->setShowPercent(1);
         $dolgraph->SetType(array('pie'));
         $dolgraph->setHeight('200');

+ 1 - 1
htdocs/commande/index.php

@@ -140,7 +140,7 @@ if ($resql)
         include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
         $dolgraph = new DolGraph();
         $dolgraph->SetData($dataseries);
-        $dolgraph->setShowLegend(1);
+        $dolgraph->setShowLegend(2);
         $dolgraph->setShowPercent(1);
         $dolgraph->SetType(array('pie'));
         $dolgraph->setHeight('200');

+ 2 - 2
htdocs/compta/deplacement/index.php

@@ -115,10 +115,10 @@ if ($conf->use_javascript_ajax)
     include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
     $dolgraph = new DolGraph();
     $dolgraph->SetData($dataseries);
-    $dolgraph->setShowLegend(1);
+    $dolgraph->setShowLegend(2);
     $dolgraph->setShowPercent(1);
     $dolgraph->SetType(array('pie'));
-    $dolgraph->setWidth('100%');
+    $dolgraph->setHeight('200');
     $dolgraph->draw('idgraphstatus');
     print $dolgraph->show($totalnb?0:1);
 

+ 1 - 1
htdocs/contrat/index.php

@@ -209,7 +209,7 @@ if (!empty($conf->use_javascript_ajax))
     include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
     $dolgraph = new DolGraph();
     $dolgraph->SetData($dataseries);
-    $dolgraph->setShowLegend(1);
+    $dolgraph->setShowLegend(2);
     $dolgraph->setShowPercent(1);
     $dolgraph->SetType(array('pie'));
     $dolgraph->setHeight('200');

+ 6 - 3
htdocs/core/class/dolgraph.class.php

@@ -30,10 +30,10 @@
  *    $dolgraph->SetTitle($langs->transnoentities('MyTitle').'<br>'.$langs->transnoentities('MyTitlePercent').'%');
  *    $dolgraph->SetMaxValue(50);
  *    $dolgraph->SetData($data);
- *    $dolgraph->setShowLegend(1);
+ *    $dolgraph->setShowLegend(2);
  *    $dolgraph->setShowPercent(1);
  *    $dolgraph->SetType(array('pie'));
- *    $dolgraph->setWidth('100%');
+ *    $dolgraph->setHeight('200');
  *    $dolgraph->draw('idofgraph');
  *    print $dolgraph->show($total?0:1);
  */
@@ -422,7 +422,7 @@ class DolGraph
 	/**
 	 * Show legend or not
 	 *
-	 * @param	int		$showlegend		1=Show legend (default), 0=Hide legend
+	 * @param	int		$showlegend		1=Show legend (default), 0=Hide legend, 2=Show legend on right
 	 * @return	void
 	 */
     public function setShowLegend($showlegend)
@@ -957,6 +957,8 @@ class DolGraph
 			return;
 		}
 
+		$showlegend = $this->showlegend;
+
 		$legends = array();
 		$nblot = 0;
 		if (is_array($this->data) && is_array($this->data[0])) {
@@ -1040,6 +1042,7 @@ class DolGraph
 				$this->stringtoshow .= 'circumference: Math.PI,'."\n";
 				$this->stringtoshow .= 'rotation: -Math.PI,'."\n";
 			}
+			if ($showlegend) $this->stringtoshow .= 'legend: { position: \''.($showlegend == 2 ? 'right' : 'top').'\' },'."\n";
 			$this->stringtoshow .= 'elements: { arc: {'."\n";
 			// Color of earch arc
 			$this->stringtoshow .= 'backgroundColor: [';

+ 1 - 1
htdocs/don/index.php

@@ -137,7 +137,7 @@ if ($conf->use_javascript_ajax)
     include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
     $dolgraph = new DolGraph();
     $dolgraph->SetData($dataseries);
-    $dolgraph->setShowLegend(1);
+    $dolgraph->setShowLegend(2);
     $dolgraph->setShowPercent(1);
     $dolgraph->SetType(array('pie'));
     $dolgraph->setHeight('200');

+ 1 - 1
htdocs/expensereport/index.php

@@ -136,7 +136,7 @@ if ($conf->use_javascript_ajax)
     $dolgraph->SetData($dataseries);
     $dolgraph->setHeight(350);
     $dolgraph->combine = empty($conf->global->MAIN_EXPENSEREPORT_COMBINE_GRAPH_STAT) ? 0.05 : $conf->global->MAIN_EXPENSEREPORT_COMBINE_GRAPH_STAT;
-    $dolgraph->setShowLegend(1);
+    $dolgraph->setShowLegend(2);
     $dolgraph->setShowPercent(1);
     $dolgraph->SetType(array('pie'));
     $dolgraph->setHeight('200');

+ 1 - 1
htdocs/fichinter/index.php

@@ -140,7 +140,7 @@ if ($resql)
         include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
         $dolgraph = new DolGraph();
         $dolgraph->SetData($dataseries);
-        $dolgraph->setShowLegend(1);
+        $dolgraph->setShowLegend(2);
         $dolgraph->setShowPercent(1);
         $dolgraph->SetType(array('pie'));
         $dolgraph->setHeight('200');

+ 2 - 2
htdocs/fourn/commande/index.php

@@ -137,10 +137,10 @@ if ($resql)
 		include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
 		$dolgraph = new DolGraph();
 		$dolgraph->SetData($dataseries);
-		$dolgraph->setShowLegend(1);
+		$dolgraph->setShowLegend(2);
 		$dolgraph->setShowPercent(1);
 		$dolgraph->SetType(array('pie'));
-		$dolgraph->setWidth('100%');
+		$dolgraph->setHeight('200');
 		$dolgraph->draw('idgraphstatus');
 		print $dolgraph->show($total ? 0 : 1);
 

+ 2 - 2
htdocs/mrp/index.php

@@ -101,10 +101,10 @@ if ($conf->use_javascript_ajax)
     		include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
     		$dolgraph = new DolGraph();
     		$dolgraph->SetData($dataseries);
-    		$dolgraph->setShowLegend(1);
+    		$dolgraph->setShowLegend(2);
     		$dolgraph->setShowPercent(1);
     		$dolgraph->SetType(array('pie'));
-    		$dolgraph->SetHeight(200);
+    		$dolgraph->SetHeight('200');
     		$dolgraph->draw('idgraphstatus');
     		print $dolgraph->show($totalnb?0:1);
 

+ 5 - 5
htdocs/product/index.php

@@ -174,15 +174,15 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us
 		{
 			$dataseries[] = array($langs->trans("ServicesOnSale"), round($SommeD));
 			$dataseries[] = array($langs->trans("ServicesOnPurchase"), round($SommeE));
-			$dataseries[] = array($langs->trans("ServicesNotOnSell"), round($SommeF));
+			$dataseries[] = array(dol_trunc($langs->trans("ServicesNotOnSell"), 24), round($SommeF));
 		}
 
 		include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
 		$dolgraph = new DolGraph();
 		$dolgraph->SetData($dataseries);
-		$dolgraph->setShowLegend(1);
+		$dolgraph->setShowLegend(2);
 		$dolgraph->setShowPercent(0);
-		$dolgraph->SetType(array('piesemicircle'));
+		$dolgraph->SetType(array('pie'));
 		$dolgraph->setHeight('200');
 		$dolgraph->draw('idgraphstatus');
 		print $dolgraph->show($total ? 0 : 1);
@@ -241,10 +241,10 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA
 			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
 			$dolgraph = new DolGraph();
 			$dolgraph->SetData($dataseries);
-			$dolgraph->setShowLegend(1);
+			$dolgraph->setShowLegend(2);
 			$dolgraph->setShowPercent(1);
 			$dolgraph->SetType(array('pie'));
-			$dolgraph->setWidth('100%');
+			$dolgraph->setHeight('200');
 			$dolgraph->draw('idstatscategproduct');
 			print $dolgraph->show($total ? 0 : 1);
 		}

+ 1 - 1
htdocs/projet/graph_opportunities.inc.php

@@ -80,7 +80,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
 	        include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
 	        $dolgraph = new DolGraph();
 	        $dolgraph->SetData($dataseries);
-	        $dolgraph->setShowLegend(1);
+	        $dolgraph->setShowLegend(2);
 	        $dolgraph->setShowPercent(1);
 	        $dolgraph->SetType(array('pie'));
 	        //$dolgraph->setWidth('100%');

+ 3 - 3
htdocs/societe/index.php

@@ -112,7 +112,7 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) +
     include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
     $dolgraph = new DolGraph();
 	$dolgraph->SetData($dataseries);
-	$dolgraph->setShowLegend(1);
+	$dolgraph->setShowLegend(2);
 	$dolgraph->setShowPercent(1);
 	$dolgraph->SetType(array('pie'));
 	$dolgraph->setHeight('200');
@@ -200,10 +200,10 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA
 			include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
 			$dolgraph = new DolGraph();
 			$dolgraph->SetData($dataseries);
-			$dolgraph->setShowLegend(1);
+			$dolgraph->setShowLegend(2);
 			$dolgraph->setShowPercent(1);
 			$dolgraph->SetType(array('pie'));
-			$dolgraph->setWidth('100%');
+			$dolgraph->setHeight('200');
 			$dolgraph->draw('idgraphcateg');
 			print $dolgraph->show();
 		}

+ 1 - 1
htdocs/supplier_proposal/index.php

@@ -144,7 +144,7 @@ if ($resql)
         include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
         $dolgraph = new DolGraph();
         $dolgraph->SetData($dataseries);
-        $dolgraph->setShowLegend(1);
+        $dolgraph->setShowLegend(2);
         $dolgraph->setShowPercent(1);
         $dolgraph->SetType(array('pie'));
         $dolgraph->setHeight('200');

+ 2 - 1
htdocs/theme/eldy/global.inc.php

@@ -2348,7 +2348,8 @@ input.vmenusearchselectcombo[type=text] {
 
 
 a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu, span.vsmenu { white-space: nowrap; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; }
-a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-weight: bold;  }	/* bold = 600, 500 is ko with Edge on 1200x960 */
+a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active,
+span.vmenu, span.vmenu:link, span.vmenu:visited, span.vmenu:hover, span.vmenu:active { font-weight: bold;  }	/* bold = 600, 500 is ko with Edge on 1200x960 */
 font.vmenudisabled  { font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: bold; color: #aaa; margin-left: 4px; }												/* bold = 600, 500 is ko with Edge on 1200x960 */
 a.vmenu:link, a.vmenu:visited { color: var(--colortextbackvmenu); }
 

+ 1 - 0
htdocs/ticket/index.php

@@ -239,6 +239,7 @@ if (!empty($dataseries) && count($dataseries) > 1) {
             $legend[] = $i;
             $i++;
         }
+        $px1->setShowLegend(2);
         $px1->SetType(array('pie'));
         $px1->SetLegend($legend);
         $px1->SetMaxValue($px1->GetCeilMaxValue());