problem with data value = maxValue
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



problem with data value = maxValue Expand / Collapse
Author
Message
Posted 12/29/2007 3:11:01 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2/5/2008 11:01:18 AM
Posts: 6, Visits: 7
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?

Post #3552
Posted 12/30/2007 8:35:57 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2/5/2008 11:01:18 AM
Posts: 6, Visits: 7
I believe I have solved the problem.  The $dataArray MUST be in sorted order.  I discovered this accidentally, but it seems to have worked.
Post #3557
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 11:41pm


Execution: 0.047.