Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Creating Maps for your Applications > Time for action — creating the XML for...

Time for action — creating the XML for our first map

Time for action — creating the XML for our first map Create an empty XML file in the LearningFusionMaps folder and name it as Data.xml.Write the following XML in the file and save it: <map fillColor='F1F1F1' numberPrefix='$'> <colorRange> <color minValue='0' maxValue='40000' displayValue='Poor' color='FF9377' /> <color minValue='40000' maxValue='100000' displayValue='Average' color='FFFFCC' /> <color minValue='100000' maxValue='5000000' displayValue='Good' color='A7E9BC' /> </colorRange> <data> <entity id='AL' value='78000' /> <entity id='CA' value='148000' /> <entity id='FL' value='95100' /> <entity id='HI' value='77000' /> <entity id='IL' value='21000' /> <entity id='LA' value='128000' /> <entity id='MA' value='50000' /> <entity id='NV' value='93000' /> <entity id='NY' value='128000' /> <entity id='TX' value='38000' /> </data> </map> What just happened? We just defined the data for our first map. To start with, the XML for each map you create has to have the<map> element. Similar to the charts, the attributes of the map give you control over both the functional and cosmetic properties of the map. For our map, we defined the default fill for the entities using the fillColor attribute. This color will be shown for all the states that we are not plotting values for; the other states will pick up colors depending on which range they fall in. We also prefixed $ to the numbers on the chart using the numberPrefix attribute. To define the color range, we use the<colorRange>...</colorRange> elements. Each color range thereafter is defined using the<color> element for which we have specified its starting value, ending value, name, and color, as in the following lines of code: <colorRange> <color minValue='0' maxValue='40000' displayValue='Poor' color='FF9377' /> <color minValue='40000' maxValue='100000' displayValue='Average' color='FFFFCC' /> <color minValue='100000' maxValue='5000000' displayValue='Good' color='A7E9BC' /> </colorRange> Then begins the actual data for the chart enclosed within the<data> and</data> elements. For each state that we want to plot a value for, we need the<entity> element. Then, using the ID of the state from the specification sheet (Map Specification Sheets | USA & States | USA), we associate values to them, as in the following line of code: <entity id='AL' value='78000' />

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint