After installation, import the VueFunnelGraph component and register it in your Vue instance. You can then use the <vue-funnel-graph> component in your templates, passing data via props.
<template>
<vue-funnel-graph
:width="width"
:height="height"
:labels="labels"
:values="values"
:colors="colors"
:sub-labels="subLabels"
:direction="direction"
:gradient-direction="gradientDirection"
:animated="true"
:display-percentage="true"
></vue-funnel-graph>
</template>
<script>
import { VueFunnelGraph } from 'vue-funnel-graph-js';
export default {
components: {
VueFunnelGraph
},
data() {
return {
width: 800,
height: 300,
labels: ['Impressions', 'Add To Cart', 'Buy'],
subLabels: ['Direct', 'Social Media', 'Ads'],
values: [
[3000, 2500, 6500], // Segments of "Impressions"
[3000, 1700, 1000], // Segments of "Add To Cart"
[600, 200, 130] // Segments of "Buy"
],
colors: [
['#FFB178', '#FF3C8E'],
['#A0BBFF', '#EC77FF'],
['#A0F9FF', '#7795FF']
],
direction: 'horizontal',
gradientDirection: 'horizontal'
};
}
}
</script>