How can we use libraries like d3.js along with Vue.js framework? I have created a view with Vue which gets a JSON from a REST call which has to be now converted into a graph using D3.js. I have downloaded the minified version of D3.js into my libs folder. How should i refer the fetched JSON to D3's api to render the SVG graph into the DOM?
Thanks for your time!
Just install it via npm. If you use browserify you can simply require it or import, depends on which syntax u are using.
Hi,
I figured out the way.
plugins :[
new webpack.ProvidePlugin({
d3: "d3"
})
]
Jia
Tyrone
Think about writing code
A few months late... We had to port our D3 charting to Vue.js recently. We decided that instead of using D3's DOM manipulation, it would be much better if we relied solely on Vue thus maintaining reactivity etc.
It turned out to be relatively easy:
dproperty of each element inmounted(), watchers, computed propertiesExample
Corresponding blog post