Followed instructions for using vue-google-charts plugin : https://www.npmjs.com/package/vue-google-charts
Want to create an organization chart : https://developers.google.com/chart/interactive/docs/gallery/orgchart
Figured I had to use onChartReady() but not sure how to do it with organization charts.
<template >
<div class="container">
<GChart
type="OrgChart"
:data="chartData"
@ready="onChartReady"
/>
</div>
</template>
<script>
import { GChart } from 'vue-google-charts'
export default {
components: {
GChart
},
data () {
return {
// Array will be automatically processed with visualization.arrayToDataTable function
chartData: [
[{v:'Mike', f:'Mike<div style="color:red; font-style:italic">President</div>'},
'', 'The President'],
[{v:'Jim', f:'Jim<div style="color:red; font-style:italic">Vice President</div>'},
'Mike', 'VP'],
['Alice', 'Mike', ''],
['Bob', 'Jim', 'Bob Sponge'],
['Carol', 'Bob', '']
],
options: {allowHtml : true}
}
},
methods: {
onChartReady (chart, google) {
var chart = new google.visualization.OrgChart();
chart.draw(this.chartData, this.options)
}
}
}
</script>
When I run the following code I just get a blank web page with an error saying "Unhandled promise rejection TypeError: "google.visualization[type] is not a constructor".
Think I need to enter something into google.visualization.OrgChart(); but not sure what from the code I have.
'orgchart'
package... – WhiteHat