mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
New: Graph js librairie can accept url to click on values.
This commit is contained in:
@@ -1238,8 +1238,9 @@ function dolibarr_trunc($string,$size=40,$trunc='right',$stringencoding='')
|
|||||||
* @param showlegend Show legend
|
* @param showlegend Show legend
|
||||||
* @param type Type of graph ('pie', 'barline')
|
* @param type Type of graph ('pie', 'barline')
|
||||||
* @param showpercent Show percent (with type='pie' only)
|
* @param showpercent Show percent (with type='pie' only)
|
||||||
|
* @param url Param to add an url to click values
|
||||||
*/
|
*/
|
||||||
function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0)
|
function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
global $theme_datacolor; // To have var kept when function is called several times
|
global $theme_datacolor; // To have var kept when function is called several times
|
||||||
@@ -1301,9 +1302,14 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
|
|||||||
formatter: function(label, series) {
|
formatter: function(label, series) {
|
||||||
var percent=Math.round(series.percent);
|
var percent=Math.round(series.percent);
|
||||||
var number=series.data[0][1];
|
var number=series.data[0][1];
|
||||||
return \'<div style="font-size:8pt;text-align:center;padding:2px;color:white;">\'+'.($showlegend?'number':'label+\'<br/>\'+number');
|
return \'';
|
||||||
|
print '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">';
|
||||||
|
if ($url) print '<a style="color: #FFFFFF;" border="0" href="'.$url.'=">';
|
||||||
|
print '\'+'.($showlegend?'number':'label+\'<br/>\'+number');
|
||||||
if (! empty($showpercent)) print '+\'<br/>\'+percent+\'%\'';
|
if (! empty($showpercent)) print '+\'<br/>\'+percent+\'%\'';
|
||||||
print '+\'</div>\';
|
print '+\'';
|
||||||
|
if ($url) print '</a>';
|
||||||
|
print '</div>\';
|
||||||
},
|
},
|
||||||
background: {
|
background: {
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
|
|||||||
Reference in New Issue
Block a user