In the above code, after creating the Pie Chart style using the Oracle Maps API, it is set on the target theme-based FOI layer as the rendering style.function setupDynamicPieChartStyle(themebasedfoi) { var slices = new Array(5); slices[0] = new MVPieSlice("Item 1", "2a00ff"); slices[1] = new MVPieSlice("Item 2", "00ffcb"); slices[2] = new MVPieSlice("Item 3", "00ff21"); slices[3] = new MVPieSlice("Item 4", "ccff00"); slices[4] = new MVPieSlice("Item 5", "ff9900"); var piechart = new MVPieChartStyle("mypc", 25, slices); //now add the piechart style themebasedfoi.addStyle(piechart); themebasedfoi.setRenderingStyle("mypc"); }
2. Setup a Non-Spaial Data Provider and the actual XML business data on the theme
Note that the xml data only provide business data for some of the states, and only these have a pie chart displayed. In the above code, we first create a NSDP object (using the Oracle Maps API), tell it the name of the MapViewer pre-defined theme that should be joined with the business data (theme_demo_states in this case). You must also specify a key column from the base table of the pre-defined theme, so that MapViewer can fetch the join key values from the theme's base table. In this case the "state" column will be used to match the business data provided by the Non-Spatial Data Provider.function setupNsdp(themebasedfoi) { var nsdpInfo = new MVNSDP("defaultNSDP"); nsdpInfo.setTheme("theme_demo_states"); nsdpInfo.setKeyColumn("state"); var xml_data = "<nsdp_xml>"+ "<table>"+ "<tr><th>State</th><th>Item 1</th><th>Item 2</th><th>Item 3</th><th>Item 4</th><th>Item 5</th></tr>"+ "<tr><td>Oregon</td><td>500.0</td><td>200.0</td><td>1000.0</td><td>345.0</td><td>700.0</td></tr>"+ "<tr><td>California</td><td>624.0</td><td>275.0</td><td>800.0</td><td>154.0</td><td>200.0</td></tr>"+ "<tr><td>Nevada</td><td>200.0</td><td>396.0</td><td>900.0</td><td>347.0</td><td>400.0</td></tr>"+ "<tr><td>Arizona</td><td>100.0</td><td>458.0</td><td>10.0</td><td>369.0</td><td>70.0</td></tr>"+ "<tr><td>Texas</td><td>375.0</td><td>10.0</td><td>800.0</td><td>245.0</td><td>501.0</td></tr>"+ "<tr><td>Colorado</td><td>469.0</td><td>999.0</td><td>60.0</td><td>545.0</td><td>350.0</td></tr>"+ "<tr><td>Idaho</td><td>50.0</td><td>167.0</td><td>200.0</td><td>45.0</td><td>842.0</td></tr>"+ "<tr><td>Iowa</td><td>400.0</td><td>234.0</td><td>1500.0</td><td>845.0</td><td>696.0</td></tr>"+ "<tr><td>Ohio</td><td>100.0</td><td>555.0</td><td>100.0</td><td>35.0</td><td>444.0</td></tr>"+ "<tr><td>Michigan</td><td>800.0</td><td>473.0</td><td>300.0</td><td>30.0</td><td>1200.0</td></tr>"+ "<tr><td>North Dakota</td><td>260.0</td><td>609.0</td><td>50.0</td><td>90.0</td><td>340.0</td></tr>"+ "<tr><td>New Mexico</td><td>900.0</td><td>108.0</td><td>1000.0</td><td>1345.0</td><td>70.0</td></tr>"+ "<tr><td>Oklahoma</td><td>1050.0</td><td>168.0</td><td>1500.0</td><td>124.0</td><td>750.0</td></tr>"+ "<tr><td>Utah</td><td>10.0</td><td>1200.0</td><td>1040.0</td><td>34.0</td><td>600.0</td></tr>"+ "<tr><td>Wisconsin</td><td>650.0</td><td>500.0</td><td>880.0</td><td>2450.0</td><td>800.0</td></tr>"+ "<tr><td>Alabama</td><td>440.0</td><td>10.0</td><td>900.0</td><td>34.0</td><td>700.0</td></tr>"+ "</table>"+ "</nsdp_xml>"; var ps = new Object(); ps["xml"] = xml_data; nsdpInfo.setParameters(ps); themebasedfoi.setNSDP(nsdpInfo); }