使用动态数据c3.js创建圆环图

时间:2015-11-16 22:58:47

标签: javascript arrays json d3.js c3.js

我不明白这个sytax错误,不知道我在这里做错了什么

SyntaxError:missing;在陈述之前

为什么我需要一个;在声明不是这些假设结束声明之前?

这里是JS小提琴 this

我的代码

[
    {
        "Continent": "Europe",
        "Country_Names": "Albania",
        "Total": "3.8",
        "Change_total": "-38.7",
        "Main activity electricity and heat production": "0.1",
        "Main activity electricity plants": "",
        "Main activity CHP plants": "",
        "Unallocated autoproducers / Other energy industry own use": "0.1",
        "Other": "1.4",
        "Manufacturing industries and construction": "1",
        "Iron and steel": "0",
        "Chemical and petrochemical": "0",
        "Machinery": "",
        "Mining and quarrying": "",
        "Food and tobacco": "0.1",
        "Paper, pulp and printing": "",
        "Construction": "0",
        "Transport": "2.2",
        "Road": "2.2",
        "Domestic aviation": "",
        "Rail": "0",
        "Domestic navigation": "0.1",
        "Residential": "0.2",
        "Commercial and public services": "0",
        "Agriculture/forestry": "0.2",
        "Sub-bituminous coal / Lignite": "",
        "Other bituminous coal": "",
        "Natural gas": "0",
        "Motor gasoline excl. bio": "0.3",
        "Gas/diesel oil excl. bio": "2.2"
    }]

我的数据集看起来像这样(完整的数据集可以在小提琴中看到)

list(sum(zip(a, b), ()))

1 个答案:

答案 0 :(得分:1)

看起来你只是有一些语法错误......

此:

checkIt(data){

应该是:

function checkIt(data) {

而且:

obj.push('Road ' + m.countriesByName[i].key.values.Food and tobacco);

应该是:

obj.push('Road ' + m.countriesByName[i].key.values.Food + ' and tobacco');