Sign in to follow this  
stren

PHP API setChartParams() for line chart does not set lineColor

Recommended Posts

Hi - I'm using the setChartParams() call in the PHP API to create my XML. However, I have noticed that even if I set the lineColor attribute it gets ignored and comes back in the XML as the default color. I have also tried adding Params to the addDataFromDatabase() call. In that case I was setting the attribute 'color' but that did not seem to work either

 

 

 

Has anyone else run into this problem?

 

 

 

Thanks

Share this post


Link to post
Share on other sites

Hi,

Currently you can apply color to lines using  addChartData() function in line charts.

Try this code:

<?php

 # Include FusionCharts PHP Class

 include('../Class/FusionCharts_Gen.php');

 # Create Create Column3D chart Object

 $FC = new FusionCharts("Line","300","250");

 # set the relative path of the swf file

 $FC->setSWFPath("../FusionCharts/");

 

 #  Set chart attributes

 $strParam="caption=Weekly Sales;xAxisName=Week;yAxisName=Revenue;numberPrefix=$;decimalPrecision=0;anchorBorderColor=ff0000";

 $FC->setChartParams($strParam);

 

 # add chart values and  category names

 $FC->addChartData("40800","name=Week 1;color=ff0000");

 $FC->addChartData("31400","name=Week 2;color=ff0000");

 $FC->addChartData("26700","name=Week 3;color=ff0000");

 $FC->addChartData("54400","name=Week 4;color=ff0000"); 

?>

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