jbrack321 Report post Posted February 10, 2012 (edited) Hello, I am very new to Fusion Maps and hope someone can assist. I would like to dynamically apply makers based on data base values. Through the tutorials I see that I can apply definitions of the markers only and then apply <application> to call the marker. I am using the dataXML method and PHP. Can someone provide an example of this for me? I cannot get this to work. Thanks, lhardee Edited February 10, 2012 by jbrack321 Share this post Link to post Share on other sites
Guest Sumedh Report post Posted February 10, 2012 Greetings. For applying markers dynamically, you would need to add markers xml format in the dataXML, Ref. Code; $strxml .="<markers>"; $strxml .="<definition>"; $strxml .="<marker id='HO' x='140.09' y='165.19' label='Head Office' />"; $strxml .="<marker id='PF' x='553.37' y='182.25' label='Production Center' />"; $strxml .="<marker id='SA' x='447.04' y='106.57' label='Sales' />"; $strxml .="</definition>"; $strxml .="<application>"; $strxml .="<marker id='HO' shapeId='circle' />"; $strxml .=''<marker id='PF' shapeId='arc' />"; $strxml .="<marker id='SA' shapeId='trianngle' />"; $strxml .="</application>"; $strxml .="</markers>"; Also note that, you would need to define marker id's with the predefined id's in the database file. Please refer the following links, for more information: http://docs.fusionch...HPDB_USMap.html http://docs.fusionch...s/MarkerOv.html Hope this helps. Share this post Link to post Share on other sites
jbrack321 Report post Posted February 12, 2012 Hi Sumedh, Thanks for your reply. I checked out your suggestions and cannot seem to find a solution. Below is an example of some markers I created. However I only want to call those markers if ($rs1['datap']= a certain value. I cannot figure out what I am doing incorrectly to call the markers properly. Any help would be appreciated. $strXML .= "<markers>"; $strXML .= "<shapes>"; $strXML .= "<shape id='myCustomShape' type='image' url='Resources/Google_Maps_Marker.png' labelPadding='12' />"; $strXML .= "</shapes>"; $strXML .= "<definition>"; $strXML .= "<marker id='1' x='709.31' y='69.94' label='example a' labelPos='top' />"; $strXML .= "<marker id='2' x='320.11' y='200.54' label='example b' labelPos='top' />"; $strXML .= "</definition>"; $strXML .= "<application>"; $strXML .= "<marker id='1' shapeId='myCustomShape' link='n-http%3a%2f%2example1webpage.php>"; $strXML .= "<marker id='2' shapeId='myCustomShape' link='n-http%3a%2f%2example2webpage.php' />"; $strXML .= "</application>"; $strXML .= "</markers>"; $strXML .= "<styles>"; $strXML .= "<definition>"; $strXML .= "<style name='markerAnim' type='animation' param='_y' start='0' duration='1.2' easing='bounce' />"; $strXML .= "</definition>"; $strXML .= "<application>"; $strXML .= "<apply toObject='MARKERS' styles='markerAnim' />"; $strXML .= "</application>"; $strXML .= "</styles>"; ------------------------------------------------------------------------------------------------------ $strQuery = "select state, sum(datap) as datap from (select tracker.state, tracker.data datap from tracker union all select cable_intrusion.state, cable_intrusion.data datap from cable_intrusion union all select fibertesting.state, fibertesting.data datap from fibertesting) as datap group by state"; $result = mysql_query($strQuery) or die(mysql_error()); # Check if we've records to show if ($result) { # Iterate through each record while($rs1= mysql_fetch_array($result)) { if ($rs1['datap']>='10'){ if ($rs1['datap']<='900'){ $strXML .= "<entity id='" . $rs1['state'] . "' value='" . $rs1['datap'] . "'link='n-http://examplewebpage.php' />"; } } Thanks, lhardee Share this post Link to post Share on other sites
Guest Sumedh Report post Posted February 13, 2012 Hi. Please find the attached file for reference code with this reply. Hope this helps. markerDemo.php Share this post Link to post Share on other sites
jbrack321 Report post Posted February 13, 2012 Hi Sumedh, The code you attached displays markers. However, what I am trying to do is show markers conditionally. Is this possible? For example: $strQuery = "select state, sum(datap) as datap from (select tracker.state, tracker.data datap from tracker union all select cable_intrusion.state, cable_intrusion.data datap from cable_intrusion union all select fibertesting.state, fibertesting.data datap from fibertesting) as datap group by state"; $result = mysql_query($strQuery) or die(mysql_error()); # Check if we've records to show if ($result) { # Iterate through each record while($rs1= mysql_fetch_array($result)) { if ($rs1['datap']>='10'){ if ($rs1['datap']<='900'){ $strXML .="<markers>"; $strXML .="<definition>"; $strXML .= "<marker id='1' x='709.31' y='69.94' label='jump kit' labelPos='top' />"; $strXML .="</definition>"; $strXML .="<shapes>"; $strXML .= "<shape id='myCustomShape' type='image' url='base.png' labelPadding='12' />"; $strXML .="</shapes>"; $strXML .="<application>"; $strXML .= "<marker id='1' shapeId='myCustomShape' link='n-http%3a%2f%2examplewebpage'/>"; $strXML .="</application>"; $strXML .="</markers>"; $strXML .= "<styles>"; $strXML .= "<definition>"; $strXML .= "<stylename='markerAnim' type='animation' param='_y' start='0' duration='1.2' easing='bounce' />"; $strXML .= "</definition>"; $strXML .= "<application>"; $strXML .= "<applytoObject='MARKERS' styles='markerAnim' />"; $strXML .= "</application>"; $strXML .= "</styles>"; } } Thanks !!! lhardee Share this post Link to post Share on other sites
Guest Sumedh Report post Posted February 14, 2012 Hi. To apply markers dynamically, you would need to specify the condition in the php code accordingly.( as per your requirement). Above mentioned php code will work for your requirement. Hope you have a great day. Happy FusionCharting ! Share this post Link to post Share on other sites
jbrack321 Report post Posted February 16, 2012 Sumedh, Thanks for your assistance. However, I am having a difficult time calling markers upon a condition. Can anyone assist me with the following code below? I am trying to make a marker appear if $rs1['datap'] value is between 10 & 900. $strQuery = "select state, sum(datap) as datap from (select tracker.state, tracker.data datap from tracker union all select cable_intrusion.state, cable_intrusion.data datap from cable_intrusion union all select fibertesting.state, fibertesting.data datap from fibertesting) as datap group by state"; $result = mysql_query($strQuery) or die(mysql_error()); # Check if we've records to show if ($result) { # Iterate through each record while($rs1= mysql_fetch_array($result)) { if ($rs1['datap']>='10'){ if ($rs1['datap']<='900'){ ***call marker*** Thanks lhardee Share this post Link to post Share on other sites
Guest Sumedh Report post Posted February 17, 2012 Hi, Try to add following code before the while loop statement (in the above stated code.) $strXML = "<map showCanvasBorder='0' borderColor='FFFFFF' connectorColor='000000' fillAlpha='80' hoverColor='FFFFFF' showBevel='0' numberSuffix='%25 of total US population' legendBorderColor='F1f1f1' hoverColor='FFFFFF' legendPosition='bottom'>"; .... $strXML .="</map>"; ( you would need to add this statement, after the closing the database connection.) As you would need to specify the proper XML format for the map. Otherwise, map will not be rendered. XML should start with <map> and end with </map> tags. Please refer the following link for your reference: http://docs.fusionch...HPDB_USMap.html Hope this helps. Share this post Link to post Share on other sites