deven

X Aixs Labels Are Not Visible

Recommended Posts

hi

I am trying to implement fusion chart free version into my application . So I started learning from Fusion Chart documentation

In the FusionCharts PHP Class section i tried Creating first chart

I followed the instructions and run the example, but in my output x axis labels are not visible.

I implemented it into my application, there also it is not visible .I am attaching the screenshot of that . Please help me to figure out this thanks

post-27345-0-28928500-1329287120_thumb.png

Edited by deven

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Could you please ensure you have set “showNames” attribute of chart element to ‘1’, to display X-axis data labels?

This attribute can take either the value of 0 or 1. A value of 1 indicates that the name of the data set will be displayed in the graph as X-Axis labels whereas 0 indicates it won't be displayed.

You can apply “shownames” attribute using PHP Class API as below:

$FC->setChartParam("shownames", "1");

Hope this helps!!

Share this post


Link to post
Share on other sites

HI thanks for your reply but it is not working

 

here is the code

 

# Create Column3D chart Object

$FC = new FusionCharts("Column3D","800","500");

# set the relative path of the SWF file

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

# Set chart attributes

$strParam="caption=Total Student Variations;xAxisName=Year;yAxisName=Number Of Students;ShowNames=1";

$FC->setChartParams($strParam);

 

# add chart values and category names

 

 

// fetching no of students per year

 

$year_sql = "select distinct(year),tot_stud

from summary_result where class='.$_POST[course].' and year>='".$_POST[from]."' and year<='".$_POST[to]."'

order by year";

//echo $year_sql;

$rs_sql = mysql_query($year_sql);

 

while($arr_sql = mysql_fetch_array($rs_sql))

{

// $FC->addCategory($arr_sql[year]);

 

$FC->addChartData($arr_sql[tot_stud]);

 

}

$FC->renderChart();

 

I also tried doing this

 

$strParam="caption=Total Student Variations;xAxisName=Year;yAxisName=Number Of Students";

 

$FC->setChartParams("showNames","1");

 

please guide me if i am making any mistake

Share this post


Link to post
Share on other sites

Hey,

 

For a Single series chart(Column 3D), addChartData() function, pass the value first and then the category name against each value as a parameter i.e., name=Week 1 etc.

 

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

 

In your code:

$FC->addChartData($arr_sql[tot_stud]);

 

addChartData() has only data values passed and data labels are empty, so X axis data labels are not displayed.:(

 

 

 

Share this post


Link to post
Share on other sites

thanks swarnam for your valuable reply , i changed the code as you have mentioned but i am still not getting right output

 

here is the code thanks in advace

 

include('class/FusionCharts_Gen.php');

<script language='javascript' src='FusionCharts/FusionCharts.js'></script>

 

# Create Column3D chart Object

$FC = new FusionCharts("Column3D","800","500");

# set the relative path of the SWF file

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

# Set chart attributes

$strParam="caption=Total Student Variations;xAxisName=Year;yAxisName=Number Of Students";

$FC->setChartParams($strParam);

$FC->setChartParams("showNames","1");

 

# add chart values and category names

 

 

// fetching no of students per year

 

$year_sql = "select distinct(year),tot_stud

from summary_result where class='.$_POST[course].' and year>='".$_POST[from]."' and year<='".$_POST[to]."'

order by year";

 

$rs_sql = mysql_query($year_sql);

 

while($arr_sql = mysql_fetch_array($rs_sql))

{

 

 

$FC->addChartData($arr_sql[tot_stud],$arr_sql[year]);

 

}

$FC->renderChart();

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hey,

Could you please do the following changes in your code and check?

// “setChartParam” to set single chart attribute

// “setChartParams” to set any number of chart attributes

$FC->setChartParam("showNames","1");

//Below changes done inside while loop

$FC->addChartData(“‘” . $arr_sql[‘tot_stud’] . “‘ , ‘name=” . $arr_sql[‘year’] . “ ‘ ”);

Also please check and reconfirm whether the SQL query is providing expected data from your DB as per your requirement or not.

Hope this helps!! :)

Share this post


Link to post
Share on other sites

thanks shashibhushan and swarnam for your tips

 

i changed

 

$FC->addChartData($arr_sql[tot_stud],$arr_sql[year]);

 

to

 

$FC->addChartData($arr_sql[tot_stud],"Name=".$arr_sql[year]);

 

and it is working fine thanks cheers

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