Sign in to follow this  
mr.fab

How to use MSLine.swf show data from database?

Recommended Posts

Hi All,

 

I have developed a line chart in PHP using Fusion Chart.but I'm not good at SQL.

I want lines to show these

 

Jan   Feb  Mar  Apr  May  Jun  Jul 

5        9       0      2      8      5      4

 

How I do that.? Thank you.

report-month6.php

Edited by mr.fab

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

For the "report-month6.php" it seems, you are building the XML data string in a correct way.

 

However, the fetching of data is depending on your database table structure.

 

You would need to create the XML string as per the FusionCharts XML data format, no matter the form of data you have.

 

So, in your case the XML structure would be something like below:

<chart legendPostion='' caption='Factory Output report' subCaption='By Quantity' xAxisName='Factory' yAxisName='Units' showValues='0' formatNumberScale='0' rotateValues='1' animation='1'>
   <categories>
      <category label='Jan' />
      <category label='Feb' />
      <category label='Mar' />
      <category label='Apr' />
      <category label='May' />
      <category label='Jun' />
      <category label='Jul' />
   </categories>
   <dataset seriesName='2006'>
      <set value='5' />
      <set value='9'/>
      <set value='0' />
      <set value='2' />
      <set value='8' />
      <set value='5' />
      <set value='4' />
   </dataset>
</chart>

However, in your PHP code it seems, you are appending "$ors[$valueField]" ($valueFiels takes "Quantity") to the value attribute in <set> element, but your query result is returning two columns "Month" and "Units sold".

 

Could you please try echoing "$strXML" and check whether the XML string generated is correct as per the sample provided above and modify your PHP code accordingly, if require?

 

Hope this helps!

Edited by Sashibhusan

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