Take a moment to adjust the variables in the input boxes below and then click “Chart.”
Here are the source files we used.
Does this solution do what is needed or could it potentially do what is needed with minor modifications?
Minor modifications are obviously a term relative to how much time you have available. In our case the answer is not much. This can usually be decided by looking at examples.
Does this solution have clear, straightforward, and well-organized documentation?
It’s obviously best to have a good idea about what your doing, so you can verify that the documentation does or does not give you (at the very least), a vague idea for how your going to do it.
For now we are going to use a three bar item chart. In Storyline we created our variables that account for eight all together. One for the chart’s title, one for the y-Axis, and six since each bar item needs to have both a title and a quantity. Here is example code below:
barChartTitle = "Charlie's Fruit"
barChartyAxis = "Number of Fruits"
barChartItem01Title = "Apples"
barChartItem01Value = 03
barChartItem02Title = "Bananas"
barChartItem02Value = 33
barChartItem03Title = "Grapes"
barChartItem03Value = 53
var player = window.parent.GetPlayer();
var barChartTitle = player.GetVar("barChartTitle");
var barChartyAxis = player.GetVar("barChartyAxis");
var barChartItem01Title = player.GetVar("barChartItem01Title");
var barChartItem01Value = player.GetVar("barChartItem01Value");
var barChartItem02Title = player.GetVar("barChartItem02Title");
var barChartItem02Value = player.GetVar("barChartItem02Value");
var barChartItem03Title = player.GetVar("barChartItem03Title");
var barChartItem03Value = player.GetVar("barChartItem03Value");
Now all we have to do is populate the chart with the data that we are passing into the chart. This specific charting plugin uses JSON to populate its data. We must properly format our data so the plugin will be able to build a chart from it. Here is the segment of JSON code which we modified to change the title, yAxis, and each bar’s title and value.
In a future article, we will add the ability to adjust the number of bars items in the chart which can be modified by simply adding or removing “barTitle##” and barQuantity variables. So stay tuned!