Pallav

maxValue = data value bug

Recommended Posts

I belive there is a small "bug" in the code for displaying colors and a legend.

consider the following:

<?php

$dataArray[0][1]="IL"; $dataArray[0][2]="10";

$dataArray[1][1]="IN"; $dataArray[1][2]="0";

$dataArray[2][1]="IA"; $dataArray[2][2]="0";

$dataArray[3][1]="MI"; $dataArray[3][2]="1";

$dataArray[4][1]="WI"; $dataArray[4][2]="2";

 

// Declare $strXML to store dataXML of the map

$strXML = "<map animation='0' showShadow='0' showBevel='0' showMarkerLabels='1' fillColor='F1f1f1' borderColor='000000' baseFont='Verdana' baseFontSize='10' markerBorderColor='000000' markerBgColor='FF5904' markerRadius='6' legendPosition='bottom' useHoverColor='1' showMarkerToolTip='1'  >";

// Opening MAP element

$strXML = "<map showLabels='1' includeNameInLabels='1' borderColor='FFFFFF' fillAlpha='80' showBevel='0' legendPosition='Bottom' >";

// Setting Color ranges : 4 color ranges for population ranges

$strXML .= "<colorRange>";

$strXML .= "<color minValue='1' maxValue='5' displayValue='0 - 5' color='FFD33A' />"; // CC0001

$strXML .= "<color minValue='6' maxValue='10' displayValue='6 - 10' color='CC0001' />"; // FFD33A

$strXML .= "<color minValue='11' maxValue='15' displayValue='11 - 15' color='069F06' />"; // 069F06

$strXML .= "<color minValue='16' maxValue='20' displayValue='> 16' color='ABF456' />"; // ABF456

$strXML .= "</colorRange><data>";

// Opening data element that will store map data

// Using Data from array for each entity

for($i=0;$i<=4;$i++){

$strXML .= "<entity id='" . $dataArray[$i][1] . "' value='" . $dataArray[$i][2] . "' />";

}

// closing data element

$strXML .= "</data>";

// closing map element

$strXML .= "</map>";

// Finally Rendering the World8 Maps with renderMap() php function present in FusionMaps.php (that we have inlcuded already)

// Since we're using dataXML method, we provide a "" value for dataURL here

print renderMap("FusionMaps/FCMap_USA.swf","",$strXML,"firstMap", 750, 460,0,0);

?>

the color is not displaying if the array value is equal to the max value in the color range.  I have to increase the maxvalue by 1 to the get the desired results.  However, this will throw off the range when I do this dynamically with a database.  I cannot check the max value each time to see if a value is equal to it.

Is there a work-around?

Share this post


Link to post
Share on other sites

Hi,

 

 

 

In our code for checking the color range block, we just include the min value and do not include the max value. So, it carries off to next block.

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