Javascript Graph.js页面不工作

Javascript Graph.js页面不工作,javascript,d3.js,graph,Javascript,D3.js,Graph,有人能帮我吗?我创建了一个graph.js页面,但它没有显示图形。下面是javascript: d3.queue() .defer(d3.sql, "data/Recipes_MySql.sql") .await(makeGraphs); function makeGraphs(error, recipeData) { var ndx = crossfilter(recipeData); show_recipe_balance(ndx); dc.renderAll(); }

有人能帮我吗?我创建了一个graph.js页面,但它没有显示图形。下面是javascript:

d3.queue()
  .defer(d3.sql, "data/Recipes_MySql.sql")
  .await(makeGraphs);

function makeGraphs(error, recipeData) {
  var ndx = crossfilter(recipeData);
  show_recipe_balance(ndx);
  dc.renderAll();
}

function show_recipe_balance(ndx) {
  var dim = ndx.dimension(dc.pluck('countryorigin'));
  var group = dim.group();

  dc.barChart("#recipe-balance")
    .width(400)
    .height(300)
    .margins({top: 10, right: 50, bottom: 30, left: 50})
    .dimension(dim)
    .group(group)
    .transitionDuration(500)
    .x(d3.scale.ordinal())
    .xUnits(dc.units.ordinal)
    .elasticY(true)
    .xAxisLabel("Country")
    .yAxis().ticks(20);
}
我错误地说:

d3未定义,请修复或添加/*全局d3*/


有人能帮忙吗

你必须把D3库放在你想使用它的任何页面上。我假设您在什么环境下运行此代码?我在浏览器中运行。在dc.js
script
标记之前为d3设置一个
script
标记