Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Oracle APEX Cookbook : Second Edition

You're reading from   Oracle APEX Cookbook : Second Edition Get straight into developing modern web applications, including mobile, using the recipes in this brilliant cookbook for Oracle Application Express (APEX). From the basics to more advanced features, it's a reference book and guide in one.

Arrow left icon
Product type Paperback
Published in Oct 2013
Publisher
ISBN-13 9781782179672
Length 444 pages
Edition Edition
Languages
Arrow right icon
Toc

Table of Contents (21) Chapters Close

Oracle APEX Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Creating a Basic APEX Application 2. Themes and Templates FREE CHAPTER 3. Extending APEX 4. Creating Websheet Applications 5. APEX Plug-ins 6. Creating Multilingual APEX Applications 7. APEX APIs 8. Using Web Services 9. Publishing from APEX 10. APEX Environment 11. APEX Administration 12. Team Development 13. HTML5 and CSS3 14. Mobile Index

Creating a map chart


A new type of chart available in Application Express 4.0 is the map chart. This allows users to present data on a geographical map. APEX 4.0 offers many maps from a world overview to maps of single countries.

Map charts allow applications a new way to visualize location-related data without much programming.

In this recipe, we will show you how to create a map that lists all contacts in the United States by state.

Getting ready

First we need to have a structure ready in our database tables that holds at least one geography-related column (for example, country, state, or province names). This will be the pointer for our chart to which it can relate its map.

For this recipe, we will reuse the APP_VW_CONTACTS view. This view holds a column called STATE that we can use in our chart.

How to do it...

Our starting point is again an empty page. The first thing to do is to add a new region.

  1. Right-click on Regions and select Create.

  2. Select Map as the Region Type.

    This will bring up a window with a couple of main categories of maps. Selecting one of these categories will bring up a list of sub categories that can be drilled down even further.

  3. Select United States of America and click on Next:

  4. In the following list select click on the + sign to open Country Maps and click on States:

  5. Enter Contacts by State for the title and leave the rest with their default values and click on Next.

  6. Enter the same text as the Map Title.

  7. Enter the following query in the appropriate SQL Query area:

    select null link
         , STATE label
         , COUNT(CONTACT_ID) value 
      from  APP_VW_CONTACTS
     group by STATE
    [9672_01_06.txt]
  8. Click on Create Region.

  9. Run the page to see the result:

As we can see, each state that contains one or more contacts is highlighted. APEX also generates labels containing the state name and number of contacts if there is room for it. The other labels can be viewed by hovering over the state with the mouse pointer.

How it works...

Application Express uses AnyChart 5 for displaying its charts. This is different from earlier versions of APEX, so migrating applications that make use of charts from Version 3.x to 4.0 is a little more complicated than migrating other functionalities.

When using a Map chart it is important that a column for the label is used that contains the name of the geographical region that you want highlighted on the map. For the standard maps provided by APEX, it's not allowed to use abbreviations, but it has to be the full name (for example, New York instead of NY and Virginia instead of VA).

There's more...

Just like any other chart type, it is possible to create links to other pages. This can be used to create, for instance, a drill-down type of structure. We could create a series of pages from a world map, to a continent map, to a country map, and so forth.

How such a link can be created is explained in the chart recipe before this one.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image