简体   繁体   中英

d3.scale is undefined using express

I am trying to bind c3-chart in my web application using node.js and express. But the c3.js file gives following error message:

TypeError: d3.scale is undefined

Below is my layout.yade file:

doctype html
html
  head
    title= title
    link(rel='stylesheet', href='http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css')
    link(rel='stylesheet', href='/stylesheets/c3.css')
    link(rel='stylesheet', href='/stylesheets/style.css')
    script(src='http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js')
    script(src='/javascripts/leaflet.ajax.js')  
    script(src='http://d3js.org/d3.v3.min.js')
    script(src='/javascripts/c3.min.js')
    script(src='/javascripts/jquery.js')

  body
    block content

I solved it, for those who have the same problem below you can find the right order and the right versions of the libararys:

doctype html
html
head
    title= title
    link(rel='stylesheet', href='http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css')
    link(rel='stylesheet', href='/stylesheet/c3.css')
    link(rel='stylesheet', href='/stylesheets/style.css')
    script(src='http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js')
    script(src='/javascripts/c3.min.js')
    script(src='/javascripts/leaflet.ajax.js')
    script(src='http://d3js.org/d3.v3.min.js' charset='utf-8')
    script(src='/javascripts/jquery.js')
body
    block content

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM