Jamie T Report post Posted July 18, 2008 Hello All. I'm trying to plot my inventory ..... stocktype (eg. Bearings, Motors etc) against quantity (from the same table), but the chart won't plot. I think it's because the chart only works with numbers. Is this true? So how can I plot how many bearings and motors I have without creating another table etc.? Thanks. Jamie. Share this post Link to post Share on other sites
Arindam Report post Posted July 19, 2008 (edited) Hi Jamie, Please follow the XML for Single series data that will help you and see the documentation http://www.fusioncharts.com/docs/Contents/ChartSS/Column2D.html <chart caption='Stock' xAxisName='Stock Type' yAxisName='Qty'> <set label='Bearings' value='20' /> <set label='Motors' value='30' /> </chart> Edited July 19, 2008 by Guest Share this post Link to post Share on other sites
Jamie T Report post Posted July 19, 2008 Thanks for the quick response. I'm plotting from a database with MySql/PHP. My table looks similar to this: PartNumber catagory quantity 1 bearing 4 2 bearing 5 3 bearing 15 4 motor 2 5 motor 6 6 belt 2 7 belt 5 I want a simple graph to show total quantities for each catagory. I can do it if catagory was a number, but not as a word. Can you help? Thanks. Jamie. Share this post Link to post Share on other sites
Arindam Report post Posted July 19, 2008 Hi, Already I gave you xml structure. Follow that structure. here first need to sum of individual category by using sql i.e Select category, sum (quantity) as Qty from table group by category Then fetch this record and using loop put all data into an xml (already given xml structure). further help please follow php sample code and documentation Share this post Link to post Share on other sites
Jamie T Report post Posted July 21, 2008 Thanks Arindam. The XML structure you've given me is a static XML page. I'm trying to plot dynamically from a database table. I've done the SQL and it is plotting with the base line (catag) values as numbers (1,2,3 etc), but if I change these values to words (bearings, motors etc) then it won't return data to plot. Any ideas what I'm doing wrong. I appreciate how frustrating it must be trying to guide people who don't know what they're doing but I've been struggling with this for 2 weeks now. Your help is much appreciated while I build an evaluation of your product. Jamie. Share this post Link to post Share on other sites
FusionCharts Support Report post Posted July 22, 2008 (edited) Hi Jamie, Could you please go through the Documentation of similar example from our online Documentation? http://www.fusioncharts.com/docs? Section: Guide for Web Developers >> Using With PHP >> Plotting from Database or Creating Drilldown charts. You would need to FOLLOW the XML structure that Arindam has sent you in earlier post, even while fetching the data dynamically from database. That XML was just an example of how your final dynamically generated XML might look like. In the XML the numeric values (sum) go to value attribute, while the category names go to label attribute. You would need to iterate through all the records that your SQL fetches. While irerating you would need to build the XML string using string concatination. <set label='{Your Category from each row }' value='{Your numeric Sum from each row}' /> If you find that you are unable to figure out the code in Documentation pages sepified, please let us know. Edited July 22, 2008 by Guest Share this post Link to post Share on other sites