c3.js:通过另一个数据源更改散点图半径?

c3.js: changing scatterplot radius via another data source?

来自 example of c3.js,散点图由

生成
data: {
    x: 'setosa_x',
    columns: [
        ["setosa_x", ...SOME DATA...],
        ["setosa", ...SOME OTHER DATA...],
    ],
    type: 'scatter'
},

和google和告诉我可以用这种方式改变散点图气泡的半径:

point: {
    r: function(d) { // <- d has x, value, and index
        return d.x+d.value+d.index;
    }
}

以这种方式,我可以访问所有信息(xvalueindex),因为数据列只有 xvalue改变半径的数据。但是我想为半径附加额外的数据,并通过这个半径函数访问数据 r: function(d) {}。提前致谢!

你是这个意思吗?

var otherData = [17, 11, 4, 8, 12, 34]

var chart = c3.generate({
    data: {
        columns: [
            ['data1', 30, 200, 100, 400, 150, 250],
            ['data2', 50, 20, 10, 40, 15, 25]
        ],
        type: 'scatter',

    },
    point: {
        r: function(d) { return otherData[d.index]; },
    }
});