Import Google Chart (JS) into Storyline
Jul 05, 2016
I'm wondering if it's possible to import/embed a Google chart into storyline. It's in javascript, so I created an Execute JavaScript trigger then pasted the chart javascript there. But when I published, nothing happens. Am I missing a step?
Here's the js I tried to bring in:
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawSeriesChart);
function drawSeriesChart() {
var data = google.visualization.arrayToDataTable([
['ID', 'Life Expectancy', 'Fertility Rate', 'Region', 'Population'],
['CAN', 80.66, 1.67, 'North America', 33739900],
['DEU', 79.84, 1.36, 'Europe', 81902307],
['DNK', 78.6, 1.84, 'Europe', 5523095],
['EGY', 72.73, 2.78, 'Middle East', 79716203],
['GBR', 80.05, 2, 'Europe', 61801570],
['IRN', 72.49, 1.7, 'Middle East', 73137148],
['IRQ', 68.09, 4.77, 'Middle East', 31090763],
['ISR', 81.55, 2.96, 'Middle East', 7485600],
['RUS', 68.6, 1.54, 'Europe', 141850000],
['USA', 78.09, 2.05, 'North America', 307007000]
]);
var options = {
title: 'Correlation between life expectancy, fertility rate ' +
'and population of some world countries (2010)',
hAxis: {title: 'Life Expectancy'},
vAxis: {title: 'Fertility Rate'},
bubble: {textStyle: {fontSize: 11}}
};
var chart = new google.visualization.BubbleChart(document.getElementById('series_chart_div'));
chart.draw(data, options);
}
4 Replies
I'm betting you don't have an element with id="series_chart_div" in your HTML markup so the code is failing in the last few lines listed here. Plus, your don't list anything here, but there's no inclusion of the necessary <SCRIPT> calls to load the Google chart library.
Hi, Steve -- Thanks so much for your question! As you may already be aware, we are not able to provide support for JavaScript or related questions, but I see that Brian has already stopped in with an idea you can try! Hope that does the trick, and in case you'd like to check it out, here is our JavaScript Best Practices and Examples, as well.
Maybe I should rephrase the question. How do you import a javascript based graph like a Google graph into Storyline? Apparently not through just the Execute JavaScript trigger.
Hi, Steve -- Thanks for the additional details, and apologies if this is not what you are looking for, but have you had a chance to take a look at the following?
This discussion is closed. You can start a new discussion or contact Articulate Support.