Jamie 1

Members
  • Content count

    31
  • Joined

  • Last visited

Everything posted by Jamie 1

  1. Hello. This has me stumped for several days. I need a drill down chart to open to another chart on the same page. I can't find anything to help with this. I am drawing from MySql. I have it working but only drilling in the same chart. It needs to go to another div. The child data is from a php file as shown below. What changes do I need to do to drill to another div please? Thanks. Jamie. <body> <?php // Form the SQL query that returns the top 10 most populous countries $strQuery = "SELECT a.areaname as Name, a.areaid as Population, a.areaid as Code FROM area a ORDER BY Population DESC LIMIT 10"; // Execute the query, or else return the error message. $result = $dbhandle->query($strQuery) or exit("Error code ({$dbhandle->errno}): {$dbhandle->error}"); // If the query returns a valid response, prepare the JSON string if ($result) { // The `$arrData` array holds the chart attributes and data $arrData = array( "chart" => array( "caption" => "Top 10 Most Populous Countries", "showValues"=> "0", "theme"=> "zune" ) ); $arrData["data"] = array(); // Push the data into the array while($row = mysqli_fetch_array($result)) { array_push($arrData["data"], array( "label" => $row["Name"], "value" => $row["Population"], "link" => "drillchild1.php?Country=".$row["Code"] ) ); } /*JSON Encode the data to retrieve the string containing the JSON representation of the data in the array. */ $jsonEncodedData = json_encode($arrData); /*Create an object for the column chart. Initialize this object using the FusionCharts PHP class constructor. The constructor is used to initialize the chart type, chart id, width, height, the div id of the chart container, the data format, and the data source. */ $columnChart = new FusionCharts("column2D", "myFirstChart" , 600, 300, "chart-1", "json", $jsonEncodedData); // Render the chart $columnChart->render(); // Close the database connection $dbhandle->close(); } ?> <div id="chart-1"><!-- Fusion Charts will render here--></div> </body>
  2. Images Above Column

    Hello. I would like to add an image above each column in my chart. So the image will represent the data in the column. I think I saw something about this once but cannot find it now. Any help please? Jamie
  3. Images Above Column

    Thank you Akash. That was exactly what I was looking for. Many thanks.
  4. Angle Gauge Limits

    Hello. I am making a gauge to show if we are ahead or behind our schedule. Hence the gauge needs to swing from -60 mins to +60 mins, with '0' at the centre. Problem. I have the Lower Value set at -60 and it needs to stay there so the gauge looks level. BUT upon update the Lower Limit always increases the lower limit. This happens regardless of the updated value. So if the updated value is +14, it still changes the Lower Limit. See picture. How can I stop it changing its self please? Jamie $Schedule = array( "chart" => array( "caption" => $schedule_main[0]['n1'], "showValue" => "1", "valueBelowPivot" => "1", "majorTMNumber" => "4", "minorTMNumber" => "4", "gaugeFillMix" => "{dark-30},{light-60},{dark-10}", "gaugeOuterRadius" => "100%", "gaugeInnerRadius" => "60%", "minValue" => "-60", "theme" => "fint" ) ); $colorRange = array( "color" => array( array( "minValue" => "-60", "maxValue" => $schedule_main[0]['t2'], "code" => $schedule_main[0]['colourL'] ), array( "minValue" => $schedule_main[0]['t2'], "maxValue" => $schedule_main[0]['t1'], "code" => $schedule_main[0]['colourM'] ), array( "minValue" => $schedule_main[0]['t1'], "maxValue" => $schedule_main[0]['tmax'], "code" => $schedule_main[0]['colourH'] ) ) );
  5. Drill-Down Chart from DB on Same Page

    Prerana. One problem I have with the sample code. It seems I have to manually write each year in the code. $arrDataMonth[2011]["linkeddata"] = array(); $arrDataMonth[2012]["linkeddata"] = array(); How do I get this to list the years automatically please? // data for linked chart will start from here, SQL query from quarterly_sales table $year = 2011; $strQuarterly = "SELECT Quarter, (Sales * 20) as Sales , Year FROM quarterly_sales WHERE 1"; $resultQuarterly = $dbhandle->query($strQuarterly) or exit("Error code ({$dbhandle->errno}): {$dbhandle->error}"); // if the query returns a valid response, preparing the associative JSON array for child chart if ($resultQuarterly) { $arrData["linkeddata"] = array(); // `linkeddata` is responsible for feeding data and chart options to child charts. $arrDataMonth[2011]["linkeddata"] = array(); $arrDataMonth[2012]["linkeddata"] = array(); $arrDataMonth[2013]["linkeddata"] = array(); $arrDataMonth[2014]["linkeddata"] = array(); $arrDataMonth[2015]["linkeddata"] = array(); $arrDataMonth[2016]["linkeddata"] = array(); $i = 0; if ($resultQuarterly) { while ($row = mysqli_fetch_array($resultQuarterly)) { // collect the year for which quarterly drilldown will be created $year = $row['Year']; // create the monthly drilldown data $arrMonthHeader[$year][$row["Quarter"]] = array(); $arrMonthData[$year][$row["Quarter"]] = array();
  6. Drill-Down Chart from DB on Same Page

    Thank you Prerana. That has massively helped me. I still need to figure out some parts but hopefully I should be ok now. Thanks again. Jamie. ps. Any idea when Fusioncharts Play will be available?
  7. Gauge with XML

    Hello. I've been trying all day to do this. Do you have an example of an Angulargauge, getting it's data in XML, dynamically from a database please? Thanks . Jamie.
  8. Gauge with XML

    Thanks again Prerana. Could you simplify this to have the colour range within the php page, not from the database please? I'm trying to convert from the old flash version of FC. Thanks. Jamie.
  9. Gauge with XML

    Thank you very much Prerana. That got me going. Can you explain how the colours work please? I can't get any colours across the gauge. I think it's something to do with the $code attribute? Jamie.
  10. Gauge with XML

    Thanks. I have been through those tutorials but it is different for the Angular Gauge. Do you have an example for this please?
  11. Inverted Values

    Hello. My chart data sometimes returns as a -ve value, which is correct. Sometimes Fusioncharts displays the -ve values with an inverted bar, which is correct, but sometimes it displays like a +ve value. See Photo. Is there a way to ensure that -ve values have inverted bars please? Jamie.
  12. Inverted Values

    Thanks for the reply. Yes that works ok in the JS Fiddle, but I am using the older Flash charts. As you can see from the photo the x-axis is negative, but the bars go upwards, not downwards from zero. This makes the chart inaccurate. Is there a way in the flash charts to fix this please? Jamie.
  13. Hello. I have the older Flash version of Widgets. I am trying to get a SparkColumn to show the Highest value id green and the lowest value in red (the same as your examples). All of my values are grey. Can you help please? Thankyou. Jamie.
  14. SparkColumn High/Low

    It's ok I found the problem. I needed this in the code ---- highColor='00CC33' lowColor='CC0000' Thanks anyway.
  15. SparkColumn High/Low

    I don't really want to pay again for the latest version just to get this feature working. I think it's more likely my code. Can you please check the code I attached? Thanks.
  16. Exporting Chart

    Hello. I would like to put the export feature on my charts. I am using a similar dashboard to your examples, but this is different to your export example. Would you please advise me where the code goes. Thanks, Jamie. <table width="875" align="center" cellpadding="0" cellspacing="0" border="0" style="Border-top:#EEEEEE 1px solid;"> <tr> <td align="left"> <?php echo renderChart("../../FusionCharts/MSColumn3DLineDY.swf?ChartNoDataText=Please select a column in the above chart to see machine-wise downtime.", "","<chart></chart>","SalesByProd", 875, 450, false, true); ?> </td> </tr> </table>
  17. Multi-Series not matching.

    Hello. I have a Multi-Series chart based upon the FC Demo. I'm using columns to show 'volume' and a line to show 'Run-Rate'. The chart is over 1 year and divided into Months, but there is not data for every month, hence I expect some gaps in the chart. The 'volume' columns match up to the months good, but the 'run-rate' line does not recognise the gaps. The MYSQL statement seems fine. Any help would be much appreciated, thanks. Here's the code, the generated XML and a screenshot of the chart. function getCumulativeSalesByCatXML($intYear, $forDataURL) { // Function to connect to the DB $link = connectToDB(); //To store categories - also flag to check whether category is //already generated //Initialize XML elements //Categories $strCat = "<categories>"; $arrCat =array(); $strSQL = "SELECT Month(o.date) as MonthNum from Months as o"; $result = mysql_query($strSQL) or die(mysql_error()); if ($result) { $mc=0; while($orsCat = mysql_fetch_array($result)) { //Add this category as dataset $arrCat[$mc++]=date("n",mktime(0,0,0,$orsCat['MonthNum'],2,1994)); $strCat .= "<category label='" . date("F",mktime(0,0,0,$orsCat['MonthNum'],2,1994)) . "' />"; } mysql_free_result($result); } $strCat .= "</categories>"; //First we need to get unique categories in the database $strSQL = "Select prodnum as areaid, prodname as areaname from PRODUCTS GROUP BY areaid"; $result = mysql_query($strSQL) or die(mysql_error()); //Initialize datasets $strAmtDS = "<dataset seriesname='Volume'>"; $strQtyDS = "<dataset seriesName='Run-Rate' parentYAxis='S'>"; //To store datasets and sets $strDataXML = ""; if ($result) { while($orsCat = mysql_fetch_array($result)) { //Add this category as dataset $strDataXML .= "<dataset seriesName='Volume'>"; //Now, we need to get monthly sales data for products in this category $strSQL = "SELECT CASE WHEN MONTH(timemixstart)>=7 THEN concat( 'F',date_format((timemixstart),'%y')+1) ELSE concat('F', date_format((timemixstart),'%y')) END AS SalesYear, YEAR(timemixstart) as year, Month(o.timemixstart) as MonthNum, p.prodnum as areaid, p.prodname as areaname, ROUND(SUM(o.mixact),0) as units, ROUND (SUM(o.mixact / TIMEDIFF(o.timemixfin, o.timemixstart)*6000)/COUNT(o.mixact),0) As rate FROM PRODUCTS as p, PROD as o WHERE o.mixnum = p.prodnum GROUP BY SalesYear, Month(o.timemixstart) HAVING SalesYear = 'F14'"; //Execute it $result2 = mysql_query($strSQL) or die(mysql_error()); $mc=0; while($ors = mysql_fetch_array($result2)) { //Append <category label=''> if not already done //Generate the link $strLink = urlencode("javaScript:updateProductChart(" . $intYear . "," . $ors['MonthNum'] . "," . $ors['areaid'] . ");"); while($arrCat[$mc++]<$ors["MonthNum"]){ $strDataXML .="<set/>"; } $strDataXML .= "<set value='" . $ors['units'] . "' link='" . $strLink . "'/>"; $strQtyDS .="<set value='" . $ors['rate'] . "' link='" . $strLink . "'/>"; } //Clear up objects mysql_free_result($result2); //Close dataset element $strDataXML .= "</dataset>"; $strQtyDS .= "</dataset>"; $strAmtDS .= "</dataset>"; } } mysql_close($link); //Create full XML $strXML = $strCat . $strQtyDS . $strDataXML; //Return return $strXML; } <?xml version="1.0"?> <chart legendPosition="BOTTOM" numDivLines="4" showValues="0" sFormatNumberScale="1" sYAxisName="Run-Rate" SYAxisName="Run-Rate" numberSuffix=" units" PYAxisName="Volume" formatNumberScale="1" animation="1" palette="2" XAxisName="Month" subcaption="(Click on a column to see monthly Run-Rate in the chart below this)" caption="Run-Rate / Volume for 2014"><categories><category label="January"/><category label="February"/><category label="March"/><category label="April"/><category label="May"/><category label="June"/><category label="July"/><category label="August"/><category label="September"/><category label="October"/><category label="November"/><category label="December"/></categories><dataset parentYAxis="S" seriesName="Run-Rate"><set link="javaScript%3AupdateProductChart%282014%2C1%2C14%29%3B" value="4073"/><set link="javaScript%3AupdateProductChart%282014%2C7%2C1%29%3B" value="4656"/><set link="javaScript%3AupdateProductChart%282014%2C8%2C1%29%3B" value="4552"/><set link="javaScript%3AupdateProductChart%282014%2C9%2C1%29%3B" value="4569"/><set link="javaScript%3AupdateProductChart%282014%2C10%2C1%29%3B" value="4160"/><set link="javaScript%3AupdateProductChart%282014%2C11%2C1%29%3B" value="4147"/><set link="javaScript%3AupdateProductChart%282014%2C12%2C1%29%3B" value="4092"/></dataset><dataset seriesName="Volume"><set link="javaScript%3AupdateProductChart%282014%2C1%2C14%29%3B" value="885966"/><set/><set/><set/><set/><set/><set link="javaScript%3AupdateProductChart%282014%2C7%2C1%29%3B" value="1744673"/><set link="javaScript%3AupdateProductChart%282014%2C8%2C1%29%3B" value="1610447"/><set link="javaScript%3AupdateProductChart%282014%2C9%2C1%29%3B" value="1698476"/><set link="javaScript%3AupdateProductChart%282014%2C10%2C1%29%3B" value="439920"/><set link="javaScript%3AupdateProductChart%282014%2C11%2C1%29%3B" value="1359675"/><set link="javaScript%3AupdateProductChart%282014%2C12%2C1%29%3B" value="1553473"/></dataset><styles><definition></definition><application><apply styles="CaptionFont" toObject="caption"/><apply styles="SubCaptionFont" toObject="SubCaption"/></application></styles></chart>
  18. Multi-Series not matching.

    I have managed to do this by creating another table just for financial year, so all good there thanks. If you can figure out what the MYSQL code is to put the gaps into the 2 data sets, then that would be very helpful. Thanks again. Jamie.
  19. Multi-Series not matching.

    Thanks very much for spending so much time on my problem. I suppose I will need to work a LEFT JOIN statement to get the gaps? I am trying to show the 'Financial Year', so need the chart to run from July - June, not January - December. Would you know how this could be done please? Jamie.
  20. Multi-Series not matching.

    I've now attached a screen of the XML, which shows the gap and lack of gap better. The gap should be the same for both datasets. By the way, I am trying to get results for the financial year, hence the tricky code.
  21. DateTime Problem

    Hello. I'm using the 3 tier page setup derived from the FusionCharts Demo. The charts do not like the date: dashboard.php?sumindex=2013-12-14 It works fine with everything else and even works without the dashes: dashboard.php?sumindex=2013214 It is a DateTime field in a MYSQL Table, so the date is stored as 2013-12-14 Cannot work it out, any help would be much appreciated. Thanks. Jamie
  22. Invalid Data with Linked Charts

    Ok I fixed my problem by conditioning the send from the default (index) page to remove the dashes.. $intsumindex = date("Ymd", strtotime($_GET['sumindex'])); Strange to have to do that and threw me for 2 days. Ok now thanks.
  23. DateTime Problem

    Ok I fixed my problem by conditioning the send from the default (index) page to remove the dashes.. $intsumindex = date("Ymd", strtotime($_GET['sumindex'])); Strange to have to do that and threw me for 2 days. Ok now thanks.
  24. Invalid Data with Linked Charts

    Hello. Sorry to jump your problem, but I'm having a similar problem. I'm using the 3 tier page setup derived from the FusionCharts Demo. The charts do not like the date: dashboard.php?sumindex=2013-12-14 It works fine with everything else and even works without the dashes: dashboard.php?sumindex=2013214 It is a DateTime field in a MYSQL Table. Cannot work it out, but maybe we have the same problem? Jamie
  25. Printing Blueprint Demo

    Hello I want to see if it is possible to print the blueprint demo using a CSS Print Media. This is just to prove it can be done before I start on my own database. I use <link rel="stylesheet" type="text/css" href="print.css" media="print" /> in my main page to reference the CSS in my other pages, but I cannot get it to work with the blueprint. Can anyone tell me where I should have this code in order to use CSS Print? Thankyou. Jamie.