We decide that we will create all three divisional pie charts and place them side by side. This way, all the VPs will be able to compare each division. We do so by executing the following steps:
We start by repurposing our
dataPull
function. This time we make use of theoptions
object passed into the function. We pass in the name of the division inhashName
, which corresponds to an object in our JSON feed:... <script> function dataPull(remoteData,options) { var obj = remoteData[options.hashName]; var data = new Array(); var i = 0;
We then loop through each child object in our divisional object. We build an array element for each product category with a label and the dollar value. Then, we wrap our data array in another array and return it to jqPlot:
for (var name in obj) { data[i] = [name, obj[name]]; i++; } return [data]; }
For each chart, we use the same data feed. We decide to experiment with the...