vue-orgchart
vue-orgchart copied to clipboard
How to change options after chart is rendered?
Hi,
I am trying to create a chart with zoom and pan which is initially set to false.
<vo-edit :data="chartData" :pan="isPanAllowed" :zoom="isZoomAllowed"></vo-edit>
data() { return { isPanAllowed: false, isZoomAllowed: false }; },
I have a checkbox that toggles these values:
<input type="checkbox" v-model="isPanAllowed"> <input type="checkbox" v-model="isZoomAllowed">
But this is not updating chart options.
I even tried something like
watch: { isZoomAllowed: { handler(isZoomAllowed) { this.orgchart.setOptions('zoom', isZoomAllowed); } } }
But I get error TypeError: this.orgchart.setOptions is not a function
Is there any way to do something like this in vue (https://codepen.io/dabeng/pen/KMKaRY)
$('#toggleZoom').on('click', function() { oc.setOptions('zoom', this.checked); });