• Content count

  • Joined

  • Last visited

Everything posted by jgcrossman2

  1. Mysql, Php To Xy Chart

    I would like to create an XY Scatter chart from data in a MySQL database. I have done this successfully with a 2D line chart where the key elements are: $FC->addCategoryFromDatabase($result, "Date"); $ctrlField = "Date"; $valueField = "IRP_System;SPY"; $FC->addDatasetsFromDatabase($result, $ctrlField, $valueField,$datasetParamArray,""); I note that the format for XY Charts is: $FC->addDataSet("Server 1","anchorRadius=6"); $FC->addChartData("21","y=2.4"); How does that translate when one wants to pull the data off of a MySQL database? I tried this but it did not work... $strQuery = "SELECT `Ticker`, `PB`, `ROE` FROM `PEcalc`"; $result = mysql_query($strQuery) or die(mysql_error()); if ($result) { $FC->addCategoryFromDatabase($result, "Ticker"); $ctrlField = "Ticker"; $valueField = "ROE;PB"; $FC->addDatasetsFromDatabase($result, $ctrlField, $valueField); } I suspect that addCategoryFromDatabase and addDatasetsFromDatabase are not properly configured or named. Any help, including links to an existing article or document that I failed to find would be much appreciated. BTW, trying to shoehorn in a $row[x] calls using a mysql_query into a while ... mysql_fetch_row... construction did not work. But if someone has a suggestion along those lines, I am all ears. Thanks in advance, John
  2. Xy Chart Legend Feature

    I would like to have more options with the tag interactiveLegend in XY Charts. Specifically, I would like it to change the scatterpoint in more interesting ways than just making it disappear. Perhaps if there was an option to make it the only point to appear, change the alpha of the other points to a lower setting or change the size or shape of the point to add a way for users to dynamically highlight individual points. If this feature already exists and I just missed it in the documentation, please let me know. I am getting better at FusionCharts but would still rank myself as a beginner. Thanks, John
  3. Xy Chart Legend Feature

    OK, thanks. Might be an idea for the future. Perhaps something ajax-like to go in and change one point after the chart has been displayed. I don't have the skills to do it although it should be possible. If you were going to continue to extend this particular chart, another idea is to add the extra dimension of time (like Google Docs Motion Chart).
  4. Line In Xy Chart

    I would like to add a sloping line in an XY Chart. It would not be the same as a regression line because that would give each point an equal weighting. I have used the $FC->addTrendLine function with a different startValue and endValue as a temporary fix. However, I would like to draw a line with points that I define. I found this in an old post: <dataset seriesName='Mean' color='009900' anchorSides='3' anchorRadius='4' anchorBgColor='D5FFD5' anchorBorderColor='009900' drawLine='1' anchorAlpha='0'> <set y='2.4' x='21' /> <set y='3.5' x='32' /> <set y='2.5' x='43' /> <set y='4.1' x='48' /> <set y='3.5' x='50' /> <set y='4.6' x='56' /> <set y='4.8' x='59' /> <set y='4.9' x='73' /> <set y='4.6' x='89' /> <set y='4.2' x='93' /> </dataset> How would I turn that into $FC-> syntax that both FusionCharts and PHP can understand? I start with this: $FC->addDataSet("seriesName=P/E;drawLine=1;color=00FF00;thickness=2"); And I assume that the problem is in the addDataChart lines. I have tried a few variations on: $FC->addChartData("y=0", "x=0"); $FC->addChartData("y=6", "x=40"); but to no avail. Any suggestions would be appreciated. Here is the chart I am working on so you can see what is going on: http://www.fund-king.com/requests/XYChart1.php?etf=XLV
  5. Line In Xy Chart

    Thank you very much. "DrawLine" before "drawLine=1" was the missing element. Now it works just as I wanted. I decided to experiment and found that you do not need "DrawLine" in particular. Any label will do. If you look at this example, I have changed out "DrawLine" with "15x P/E" (which is more relevant in this case). http://www.fund-king.com/requests/XYChart2.php?etf=XLV Again, thank you for you patience with a newbie like myself. Regards, John
  6. Line In Xy Chart

    OK, it is definitely close but just not quite there. This is what I want: I am starting here: http://www.fund-king.com/requests/XYChart1.php?etf=XLV The key part of the code is: while ($row1 = mysql_fetch_row($result1)) { echo $FC->addDataset("$row1[0]"); echo $FC->addChartData("$row1[4]","y=$row1[3]"); } //$FC->addDataSet("drawLine=1"); //$FC->addChartData("0", "y=0"); //$FC->addChartData("40", "y=6"); ?> <html> <head> <title>Scatter Chart : FusionCharts PHP Class</title> <script language="javascript" src="../FusionCharts/FusionCharts.js"></script> </head> <body> <?php # Render Chart $FC->renderChart(); ?> <h3>Equities List</h3> <table border=0> <tr><td>Ticker</td><td>Company Name</td><td>Price/Book</td><td>Return on Equity</td></tr> <?php while ($row2 = mysql_fetch_row($result2)) { echo "<tr><td><a href = '../steam/InfoSteam.php?stock_ticker=".$row2[0]."' target='_blank'>".$row2[0]."</a></td><td>".$row2[1]."</td><td>".$row2[2]."x</td><td>".$row2[3]."%</td></tr>"; } ?> </body> </html> As you can see, I have commented out my attempt at drawing a line. Here is the result: When I add in the following code after the code that builds the scatter points from my database: while ($row1 = mysql_fetch_row($result1)) { echo $FC->addDataset("$row1[0]"); echo $FC->addChartData("$row1[4]","y=$row1[3]"); } $FC->addDataSet("drawLine=1"); $FC->addChartData("0", "y=0"); $FC->addChartData("40", "y=6"); ?> <html> <head> <title>Scatter Chart : FusionCharts PHP Class</title> <script language="javascript" src="../FusionCharts/FusionCharts.js"></script> </head> <body> <?php # Render Chart $FC->renderChart(); ?> <h3>Equities List</h3> <table border=0> <tr><td>Ticker</td><td>Company Name</td><td>Price/Book</td><td>Return on Equity</td></tr> <?php while ($row2 = mysql_fetch_row($result2)) { echo "<tr><td><a href = '../steam/InfoSteam.php?stock_ticker=".$row2[0]."' target='_blank'>".$row2[0]."</a></td><td>".$row2[1]."</td><td>".$row2[2]."x</td><td>".$row2[3]."%</td></tr>"; } ?> </body> </html> I get this result: I have added in the red boxes and purple lines. I have saved this as: http://www.fund-king.com/requests/XYChart2.php?etf=XLV If you click on the datapoint in the legend box, you will notice that both points on the chart are selected so we are frustratingly close to the solution. What I need is some way to tell the chart that we need a line between these two points (0,0) and (40,6) as endpoints rather than having the chart pick up "drawLine=1" as a label for two scatter points on the chart. Perhaps the first line $FC->addDataSet("drawLine=1"); needs something more to distinguish it as a different element in the chart.
  7. Line In Xy Chart

    The solution you give only makes more scatter plot points. Maybe I was not clear, I want to draw a line through the chart as well. Can that be done?
  8. Mysql, Php To Xy Chart

    OK, I figured that one out. Basicallly, the workaround with mysql_fetch_row worked eventually. http://www.fund-king.com/requests/XYChart.php I would like to make the legend values into hyperlinks if possible. Can this be done? I am creating them now with: echo $FC->addDataset("$row[0]"); Any thoughts would be appreciated.
  9. I have recently upgraded from version 3.2 (I think) to XT and the results are pretty good. One thing I noticed is that one of my radial charts gets cropped in IE but it works fine in Firefox, Safari and even on the iPad. You can look at it here: http://www.fund-king.com/steam/Steam1a.php Most of my users access this little widget through Firefox or the iPad/iPhone but it is a shame that it cuts off a bit on the right and bottom. It is perfectly possible that I have stuffed something up in the CSS (as in, I have not included any special exceptions for Internet Explorer). Any suggestions would be much appreciated. John
  10. Fusionwidget Angular Chart And Ie Cropping

    Thanks for checking. it must be something funny with my browser at work. Glad to see that it is not a general problem. Regards, John
  11. Using PHP to write an XML file

    Rather than use the XML converter which comes with the package, I would like to use PHP to grab the data (from Google Docs in this case) and write an xml file. I build up a massive string with all the info that is contained in the regular XML file that works and wrote the file using fopen and fwrite functions. The output "looks" just like the original XML file but when I run it, it shows all the chart information (headers, extra lines) but none of the data. Do you have a tutorial on how to do this? I am sure that I am missing something.
  12. Facebook Fan Page

    I have been using Fusion Charts for about six months and now would like to try to implement them on a Facebook Fan Page. Rather than trying to reinvent the wheel, I was hoping someone could steer me in the right direction. I notice that things don't work quite the same in Facebook coding. Any help would be appreciated. John
  13. Facebook Fan Page

    OK, so it can be done. It looks like the actual chart is created on a different server and a link is placed in the Facebook page to call the chart into the page. Is that how it's done? Is there any step by step tutorial for the motivated amateur?
  14. I have finally figured out PHP and MySQL in the regular FusionCharts. Now I would like do the same for the Linear Gauge with one pointer value. Is there an example for HLinearGauge? I don't think the real time updates will work for me. I just want to pull the pointer value from a cell in my database. I have the MySQL query all sorted out, I just need to know how to build up the chart data so that FusionWidgets can put it all together properly. So far in the documents I have not seen an example that uses the same $FC-> method (found in FusionCharts) to build up the chart, parameters and data. If I have overlooked something in the documents, please feel free to point me to the right place. If anyone has figured this out, I would appreciate any code you might throw my way. Thanks, John
  15. I am a newbie but thanks to the documentation and hints from other users here, I have managed to get FusionCharts to work (via PHP) with a MySQL database (one critical post reminded me that values came before categories). I would like to move forward into multiple lines and before I mess everything up, I thought I would ask for some advice. Assuming I can keep my queries to MySQL straight, I foresee the big obstacle at my $FC line: $FC->addDataFromDatabase($result, "perform", "date"); Can I use addCategoryFromDatabase plus two addDataFromDatabase $FC->'s (assuming I have two lines here and the same range of dates)? Or do I try to cram it all into the addDataFromDatabase item? Is there an example? Thanks in advance for any assistance. Regards, John
  16. Combination Charts with php and MySQL

    Charles, Even though it is not supposed to work, would you be willing to explain a bit more about how you get Fusion Charts to access the data from a MySQL database? I was unable to make your code snippet work (although that it certainly due to my newbie level skills). Thanks & Regards, John
  17. Combination Charts with php and MySQL

    Rajroop, I am also looking at using FusionCharts with MySQL. I have just stumbled across Charles' solution so I haven't had time to try it out. But I think you should develop a section in the documentation to explore this idea. Our problem is that while we like Fusion Charts alot, the burden of updating all the XML is starting to drag the whole project down. If we could have FusionCharts fetch the data directly off a MySQL database, that would be fantastic. John
  18. I am new to both Fusion Charts and JavaScript... I saw an example of this feature in the documentation or on the website, so I know the solution exists but have since lost track of it. I would like to use JavaScript to change the myChart.setDataURL("Data1.xml"); to a list of different options (say Data2.xml, Data3.xml...and so on) which I would call up through some buttons linked into Javascript at the bottom of the chart. I was able to get the example that "changes the URL once and then turns off the button" to work well. Now I would like to get crazy and have five or six different URLs available for the same chart. And I would like the buttons to stay alive. If there is an example of this, please feel free to point me in that direction. Much appreciation in advance, John
  19. Changing external XML in same chart

    Rajroop, Thanks for that. It works with two charts. I probably need to play around with it to make it work with more buttons. As I said above, I am a newbie when it comes to JavaScript. Thanks & Regards, John
  20. Changing external XML in same chart

    Yes, that is the example I am looking at. The trouble I am having is using external XML files rather than coding all the XML data into the JavaScript arrays on the one sheet. Using that example, what would the proper syntax be for the array if the data were contained in separate files? The reason I would like to use XML files is because the data is already being used in different charts elsewhere in the website and I only want to update the numbers once. Thanks, John