Search code examples
ruby-on-railsnode.jsd3.jsdc.jscrossfilter

how to properly install dc.js for using with Rails 5?


I am exploring dc.js which would provide great feature to my data quality analysis application. But I am getting crazy about how to setup the libraries to get it fully operational:

  • D3 is installed thanks to the d3-rails gem
  • Installation of dc.js with npm install dc simply returns dc@2.1.6 ../../../node_modules/dc, but brings no feature.
  • Referencing dc.js by

    <script src="https://dc-js.github.io/dc.js/js/crossfilter.js" 
    

    et

    <script src="https://dc-js.github.io/dc.js/js/dc.js"></script>
    

generates errors such as d3.time is undefined. (does dc only relies on D3 3.x ?).

Finally, which is the clean, lean recommended way of implementing dc.js ?

Thanks.


Solution

    1. dc.js is only fully compatible with d3 v3, more info here and here.

    2. IMHO, the easiest way is the old-school one (copy the libraries locally).

      2.1. Cloudflare doesn't provide the up-to-date code since you asks a specific version in the URL (in your case, 2.0.0).