Sanjukta

php class: changing bar colour when using array

Recommended Posts

Hello

 

 

 

i'm using a bar2d to output some data that is contained within an array.

 

 

 

i would like all bars to be the same colour except one, that represents the logged in user. assuming the following code snippet how can i customise the colour of one bar?

 

 

 


         //Store Name of Products in the first column of the array

         $arrData[0][0] = "Singapore";

         $arrData[1][0] = "India";

         $arrData[2][0] = "England";

         $arrData[3][0] = "Germany";



         //Store sales data in the second column of the array

         $arrData[0][1] = 567500;

         $arrData[1][1] = 815300;

         $arrData[2][1] = 556800;

         $arrData[3][1] = 734500;





//add the logged in user

         $arrData[4][0] = "You";

         $arrData[4][1] = 123455;







         $FC = new FusionCharts("Bar2D","600","300");





         # Call FusionCharts PHP Class Function to add data from the array

         $FC->addChartDataFromArray($arrData);

 

 

 

 

 

how can i have all the bars green, except "you" which can be in red?

Share this post


Link to post
Share on other sites

Hi,

Could you please use the attribute 'color' in your code to resolve the issue?

Ref.- $arrData[4][0] = "You;color=FF0000";

Hope this helps. :(

Edited by Guest

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