Selecting values for a scale for line and bar graphs is cumbersome many a times what should be the minimum value and what should be the maximum value is a question by many...
Here is the formula which might help you to scale a graph perfectly
$minval=floor($minval($minval<0?1.1:(1/1.1)/10)*10)
$maxval=ceil($maxval*($maxval>0?1.1:(1/1.1)/10)*10)
and expand/increment/step by 1.1 in above formula leads to a chart with nice space
//label spacing
$xlabelsteps=1;
if(count($data)>10)
{
$xlabelsteps=ceil(count($data)/10);
}
//grid spacing
$xsteps=1;
if(count($data)>100)
{
$xsteps=ceil(count($data)/100);
}
Tested on "Fusion charts"
Here is the formula which might help you to scale a graph perfectly
$minval=floor($minval($minval<0?1.1:(1/1.1)/10)*10)
$maxval=ceil($maxval*($maxval>0?1.1:(1/1.1)/10)*10)
and expand/increment/step by 1.1 in above formula leads to a chart with nice space
//label spacing
$xlabelsteps=1;
if(count($data)>10)
{
$xlabelsteps=ceil(count($data)/10);
}
//grid spacing
$xsteps=1;
if(count($data)>100)
{
$xsteps=ceil(count($data)/100);
}
Tested on "Fusion charts"
No comments:
Post a Comment