Sign in to follow this  
vkshrivastva

How to use Pie3D with Grid in php class

Recommended Posts

Hi,

I am using PHP Class to plot PIE 3D charts and grid to display legends.

Using Php class method with Pie3D using $obj->FusionCharts() and the same i want to use with grid.

But i am not succeeding.

Please help me with example.

Thanks

Share this post


Link to post
Share on other sites

if I am assigning one by one variable its working but if i am trying to assign dynamically inside loop its not working.

and the other thing after ploting the graph grid color and pie color are not matching.

Following is code for your reference.

# Create Multiseries Column3D chart object using FusionCharts PHP Class

$FC2 = new FusionCharts("Pie3D",$width,$height,"", True);

# Set the relative path of the swf file

$FC2->setSWFPath("MyFCPHPClassCharts/FusionCharts/");

# Store chart attributes in a variable

$strParam="caption=$qtn_s - Response Disposition; xAxisName=Week;yAxisName=Revenue;pieSliceDepth=30; pieYScale=50; showNames=1; pieBorderThickness=1; formatNumberScale=2; showPercentageValues=1; showPercentageInLabel=1; decimalPrecision=2; formatNumber=1;bgAlpha=40;pieRadius=170;smartLineThickness=3;smartLabelClearance=50;animation=1;enableRotation=1;isSliced=1;slicingDistance=50;";

$FC2->setChartParams($strParam);

$FC3 = new FusionCharts("grid","200","300","", True);

$FC3->setSWFPath("MyFCPHPClassCharts/FusionCharts/");

$FC3->setGridParams("baseFont=vardana;baseFontSize=12");

$FC3->setGridParams("numberItemsPerPage=10");

$FC3->setGridParams("colorBoxWidth=70");

$FC3->setGridParams("colorBoxHeight=10");

$FC3->setGridParams("textVerticalPadding=10");

$FC3->setGridParams("navButtonPadding=20");

$FC3->setGridParams("colorBoxPadding=20");

$FC3->setGridParams("valueColumnPadding=20");

$FC3->setGridParams("nameColumnPadding=20");

 

## This is working

$FC3->setGridParams("bgAlpha=100");

$FC3->addChartData("");

$FC3->addChartData("");

$FC3->addChartData("1");

$FC3->addChartData("2");

$FC3->addChartData("3");

$FC3->addChartData("4");

$FC3->addChartData("5");

## This is working

$i=0;

$leg[]="01";

$leg[]="02";

$leg[]="03";

$leg[]="04";

$leg[]="05";

if(count($arr2)>0)

{

 foreach($arr2 as $key=>$val)

 { 

$FC2->addChartData($val,"name=".$leg[$i]);

## this is not working

$FC3->addChartData($val,"label=$i");

## this is not working

$i++;

 }

}

Please suggest me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this