How to use d3js on ionic

Anyone can tell me how to use d3 library on ionic, i have ideas how to use it on ionic.

like it is described on the d3 page.

inlcude (the cdn path or the downloaded file

<script src="" charset="utf-8"></script>

in your index.html in your head-area.

After that you can use d3 globally in your “app”

ya, i include the d3 library, but it still cannot work.
Do you have any example can show me?

I’ve put the code in the controller but a better way is to write an own directive which builds your tags and so on.


and you directive transforms the this tag in the -part in the html dom and runs the d3 javacsript code from the controller at this dom nodes.

If you want to display charts using d3 then take a look at Angular NV3. It is much simpler to implement.

Hi bengtler,
Thank for reply.
I thinking to draw a line chart, but i don’t know how to use d3 create a chart on ionic.
Do you have any example?

Appreciate that if you can guide me.

yeah but then you can really use google charts:


is a really good tutorial… you can put all javscript stuff in the controller of your state you want to show the chart.
And the svg-tag in the state-template.