With that out of the way, we move on to the pie chart showing revenue by division. There are only three data points, so it won't be as crammed. We use a different data source this time. We can see the results of the JSON feed in the following code:
{ "Nerd Corral": { "Service": 103405.96, "Parts": 47002.71 }, "Media & Software": { "Music CDs": 97045.54, "DVDs/Blu-ray": 83181.89, "Digital Media": 53375.05, "Software": 43670.49 }, "Electronics": { "Computers": 134764.98, "Game Consoles": 85518.01, "TVs": 76345.37, "Media Streamers": 35632.50, "DVD/Blu-ray Players": 21379.50 } }
With this chart, we create a function to parse the JSON feed and break up the functionality into several functions. Our data renderer will call our new function,
dataPull
. It loops through each top-level property in the object:... <script> function dataPull(remoteData,options) { var data = new Array(); var i =...