Skip to content
Snippets Groups Projects
Commit f943f877 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

New: Graph js librairie can accept url to click on values.

parent a3755324
Branches
Tags
No related merge requests found
......@@ -1238,8 +1238,9 @@ function dolibarr_trunc($string,$size=40,$trunc='right',$stringencoding='')
* @param showlegend Show legend
* @param type Type of graph ('pie', 'barline')
* @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 $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) {
var percent=Math.round(series.percent);
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+\'%\'';
print '+\'</div>\';
print '+\'';
if ($url) print '</a>';
print '</div>\';
},
background: {
opacity: 0.5,
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment